diff options
author | janakr <janakr@google.com> | 2018-03-26 09:26:53 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-26 09:28:16 -0700 |
commit | 171a7ebd9a28c4169f2c3018b9c4d740dadcf324 (patch) | |
tree | 6c97755630f7bce831ae7cc8a5fe0f0c9ee6cf1a /src/main/java/com/google/devtools/build/lib/runtime | |
parent | 8688b68d4331449f97b04a868c0d61c62eff71f2 (diff) |
Deprecate TransitiveInfoCollection#getConfiguration(), adding two new methods, TransitiveInfoCollection#getConfigurationKey() and ConfiguredTarget#getConfigurationChecksum(). These methods currently delegate to #getConfiguration(), but in the future they won't. I hope to get rid of #getConfigurationChecksum(), but I may have to fold the checksum into BuildConfigurationValue.Key or leave it as a separate field in ConfiguredTarget.
Transform a representative (random?) selection of #getConfiguration calls, to show that it's pretty much possible everywhere.
PiperOrigin-RevId: 190474978
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java | 10 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java | 12 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java b/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java index da47d3ce90..cb87802faa 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java @@ -432,8 +432,8 @@ public class TestSummary implements Comparable<TestSummary>, BuildEventWithOrder .compare(getSortKey(this.status), getSortKey(that.status)) .compare(this.getLabel(), that.getLabel()) .compare( - this.getTarget().getConfiguration().checksum(), - that.getTarget().getConfiguration().checksum()) + this.getTarget().getConfigurationChecksum(), + that.getTarget().getConfigurationChecksum()) .result(); } @@ -459,7 +459,8 @@ public class TestSummary implements Comparable<TestSummary>, BuildEventWithOrder @Override public BuildEventId getEventId() { return BuildEventId.testSummary( - AliasProvider.getDependencyLabel(target), target.getConfiguration().getEventId()); + AliasProvider.getDependencyLabel(target), + BuildEventId.configurationId(target.getConfigurationChecksum())); } @Override @@ -471,7 +472,8 @@ public class TestSummary implements Comparable<TestSummary>, BuildEventWithOrder public Collection<BuildEventId> postedAfter() { return ImmutableList.of( BuildEventId.targetCompleted( - AliasProvider.getDependencyLabel(target), target.getConfiguration().getEventId())); + AliasProvider.getDependencyLabel(target), + BuildEventId.configurationId(target.getConfigurationChecksum()))); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java index 303502bc78..fea730fbdd 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java @@ -397,7 +397,9 @@ public class RunCommand implements BlazeCommand { return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } - BuildConfiguration configuration = targetToRun.getConfiguration(); + BuildConfiguration configuration = + env.getSkyframeExecutor() + .getConfiguration(env.getReporter(), targetToRun.getConfigurationKey()); if (configuration == null) { // The target may be an input file, which doesn't have a configuration. In that case, we // choose any target configuration. @@ -529,9 +531,11 @@ public class RunCommand implements BlazeCommand { Artifact manifest = Preconditions.checkNotNull(runfilesSupport.getRunfilesManifest()); PathFragment runfilesDir = runfilesSupport.getRunfilesDirectoryExecPath(); Path workingDir = env.getExecRoot().getRelative(runfilesDir); + BuildConfiguration configuration = + env.getSkyframeExecutor().getConfiguration(env.getReporter(), target.getConfigurationKey()); // On Windows, runfiles tree is disabled. // Workspace name directory doesn't exist, so don't add it. - if (target.getConfiguration().runfilesEnabled()) { + if (configuration.runfilesEnabled()) { workingDir = workingDir.getRelative(runfilesSupport.getRunfiles().getSuffix()); } @@ -547,8 +551,8 @@ public class RunCommand implements BlazeCommand { manifest.getPath(), runfilesSupport.getRunfilesDirectory(), false); - helper.createSymlinksUsingCommand(env.getExecRoot(), target.getConfiguration(), - env.getBlazeWorkspace().getBinTools()); + helper.createSymlinksUsingCommand( + env.getExecRoot(), configuration, env.getBlazeWorkspace().getBinTools()); return workingDir; } |