Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.1.0] Implement debugPrint for built-in file providers #25161

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/starlarkbuildapi",
"//src/main/java/net/starlark/java/eval",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.starlarkbuildapi.FileProviderApi;
import net.starlark.java.eval.Printer;
import net.starlark.java.eval.StarlarkThread;

/**
* A representation of the concept "this transitive info provider builds these files".
Expand Down Expand Up @@ -53,6 +55,13 @@ public boolean isImmutable() {
return Depset.of(Artifact.class, filesToBuild);
}

@Override
public void debugPrint(Printer printer, StarlarkThread thread) {
printer.append("FileProvider(files_to_build = ");
printer.debugPrint(getFilesToBuildForStarlark(), thread);
printer.append(")");
}

public NestedSet<Artifact> getFilesToBuild() {
return filesToBuild;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.starlarkbuildapi.FilesToRunProviderApi;
import javax.annotation.Nullable;
import net.starlark.java.eval.Printer;
import net.starlark.java.eval.StarlarkThread;

/** Returns information about executables produced by a target and the files needed to run it. */
@Immutable
Expand Down Expand Up @@ -106,6 +108,17 @@ public Artifact getRepoMappingManifest() {
return runfilesSupport != null ? runfilesSupport.getRepoMappingManifest() : null;
}

@Override
public void debugPrint(Printer printer, StarlarkThread thread) {
printer.append("FilesToRunProvider(executable = ");
printer.debugPrint(getExecutable(), thread);
printer.append(", repo_mapping_manifest = ");
printer.debugPrint(getRepoMappingManifest(), thread);
printer.append(", runfiles_manifest = ");
printer.debugPrint(getRunfilesManifest(), thread);
printer.append(")");
}

/** A single executable. */
private static final class SingleExecutableFilesToRunProvider extends FilesToRunProvider {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.util.UUID;
import javax.annotation.Nullable;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Printer;
import net.starlark.java.eval.Sequence;
import net.starlark.java.eval.Starlark;
import net.starlark.java.eval.StarlarkSemantics;
Expand Down Expand Up @@ -1104,4 +1105,17 @@ String describeFingerprint(boolean digestAbsolutePaths) {
artifacts))
+ String.format("emptyFilesSupplier: %s\n", emptyFilesSupplier.getClass().getName());
}

@Override
public void debugPrint(Printer printer, StarlarkThread thread) {
printer.append("Runfiles(empty_files = ");
printer.debugPrint(getEmptyFilenamesForStarlark(), thread);
printer.append(", files = ");
printer.debugPrint(getArtifactsForStarlark(), thread);
printer.append(", root_symlinks = ");
printer.debugPrint(getRootSymlinksForStarlark(), thread);
printer.append(", symlinks = ");
printer.debugPrint(getSymlinksForStarlark(), thread);
printer.append(")");
}
}
Loading