@@ -246,7 +246,7 @@ public static FileArtifactValue createFromStat(
246
246
stat .isFile (),
247
247
stat .getSize (),
248
248
FileContentsProxy .create (stat ),
249
- /*digest=*/ null ,
249
+ /* digest= */ null ,
250
250
xattrProvider );
251
251
}
252
252
@@ -272,7 +272,7 @@ private static FileArtifactValue create(
272
272
}
273
273
274
274
public static FileArtifactValue createForVirtualActionInput (byte [] digest , long size ) {
275
- return new RegularFileArtifactValue (digest , /*proxy=*/ null , size );
275
+ return new RegularFileArtifactValue (digest , /* proxy= */ null , size );
276
276
}
277
277
278
278
public static FileArtifactValue createForUnresolvedSymlink (Path symlink ) throws IOException {
@@ -305,7 +305,8 @@ public static FileArtifactValue createForNormalFile(
305
305
*/
306
306
public static FileArtifactValue createForNormalFileUsingPath (
307
307
Path path , long size , XattrProvider xattrProvider ) throws IOException {
308
- return create (path , /*isFile=*/ true , size , /*proxy=*/ null , /*digest=*/ null , xattrProvider );
308
+ return create (
309
+ path , /* isFile= */ true , size , /* proxy= */ null , /* digest= */ null , xattrProvider );
309
310
}
310
311
311
312
public static FileArtifactValue createForDirectoryWithHash (byte [] digest ) {
@@ -322,7 +323,7 @@ public static FileArtifactValue createForDirectoryWithMtime(long mtime) {
322
323
*/
323
324
public static FileArtifactValue createProxy (byte [] digest ) {
324
325
Preconditions .checkNotNull (digest );
325
- return createForNormalFile (digest , /*proxy=*/ null , /*size=*/ 0 );
326
+ return createForNormalFile (digest , /* proxy= */ null , /* size= */ 0 );
326
327
}
327
328
328
329
private static String bytesToString (byte [] bytes ) {
@@ -830,11 +831,17 @@ public boolean wasModifiedSinceDigest(Path path) {
830
831
* required to resolve the content.
831
832
*/
832
833
public static final class SourceFileArtifactValue extends FileArtifactValue {
834
+ private final PathFragment path ;
833
835
private final PathFragment execPath ;
834
836
private final byte [] digest ;
835
837
private final long size ;
836
838
837
- public SourceFileArtifactValue (PathFragment execPath , byte [] digest , long size ) {
839
+ public SourceFileArtifactValue (
840
+ PathFragment path , PathFragment execPath , byte [] digest , long size ) {
841
+ Preconditions .checkArgument (path .isAbsolute (), "path %s isn't absolute" , path );
842
+ Preconditions .checkArgument (
843
+ path .endsWith (execPath ), "path %s doesn't end with execPath %s" , path , execPath );
844
+ this .path = path ;
838
845
this .execPath = Preconditions .checkNotNull (execPath );
839
846
this .digest = Preconditions .checkNotNull (digest );
840
847
this .size = size ;
@@ -847,14 +854,19 @@ public boolean equals(Object o) {
847
854
}
848
855
849
856
SourceFileArtifactValue that = (SourceFileArtifactValue ) o ;
850
- return Objects .equals (execPath , that .execPath )
857
+ return Objects .equals (path , that .path )
858
+ && Objects .equals (execPath , that .execPath )
851
859
&& Arrays .equals (digest , that .digest )
852
860
&& size == that .size ;
853
861
}
854
862
855
863
@ Override
856
864
public int hashCode () {
857
- return Objects .hash (execPath , Arrays .hashCode (digest ), size );
865
+ return Objects .hash (path , execPath , Arrays .hashCode (digest ), size );
866
+ }
867
+
868
+ public PathFragment getPath () {
869
+ return path ;
858
870
}
859
871
860
872
public PathFragment getExecPath () {
0 commit comments