Skip to content

Commit 0653491

Browse files
vladmosaehlig
authored andcommitted
Fix string representation for the Root class
It can be accessed as ctx.genfiles_dir and should be printed as before for compatibility. PiperOrigin-RevId: 162360940
1 parent be83f13 commit 0653491

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • src/main/java/com/google/devtools/build/lib/actions

src/main/java/com/google/devtools/build/lib/actions/Root.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
2121
import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
2222
import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
23+
import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
24+
import com.google.devtools.build.lib.skylarkinterface.SkylarkValue;
2325
import com.google.devtools.build.lib.util.Preconditions;
2426
import com.google.devtools.build.lib.vfs.Path;
2527
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -48,7 +50,7 @@
4850
doc = "A root for files. The roots are the directories containing files, and they are mapped "
4951
+ "together into a single directory tree to form the execution environment.")
5052
@Immutable
51-
public final class Root implements Comparable<Root>, Serializable {
53+
public final class Root implements Comparable<Root>, Serializable, SkylarkValue {
5254

5355
/**
5456
* Returns the given path as a source root. The path may not be {@code null}.
@@ -217,4 +219,9 @@ public boolean equals(Object o) {
217219
public String toString() {
218220
return path + (isSourceRoot() ? "[source]" : "[derived]");
219221
}
222+
223+
@Override
224+
public void repr(SkylarkPrinter printer) {
225+
printer.append(toString());
226+
}
220227
}

0 commit comments

Comments
 (0)