diff options
author | 2017-08-19 02:30:33 +0200 | |
---|---|---|
committer | 2017-08-21 14:16:27 +0200 | |
commit | 9d79c6013470315da86fdccc3854880806162528 (patch) | |
tree | 001c91bd5b682d81d84dbe4dc36ae947b9f56f20 /src/main/java/com/google/devtools/build/lib | |
parent | dc8b2e9a40770dde7638898bf3e3573eb51a79f8 (diff) |
Simplify RunfilesSupport interface by having it call RuleContext.shouldCreateRunfilesSymlinks() itself.
RELNOTES: None.
PiperOrigin-RevId: 165774395
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
3 files changed, 7 insertions, 28 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java index a7331ccd06..e9d711d240 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java @@ -91,10 +91,9 @@ public final class RunfilesSupport { RuleContext ruleContext, Artifact executable, Runfiles runfiles, - CommandLine args, - boolean createSymlinks) { + CommandLine args) { owningExecutable = Preconditions.checkNotNull(executable); - this.createSymlinks = createSymlinks; + createSymlinks = ruleContext.shouldCreateRunfilesSymlinks(); // Adding run_under target to the runfiles manifest so it would become part // of runfiles tree and would be executable everywhere. @@ -372,22 +371,7 @@ public final class RunfilesSupport { ruleContext, executable, runfiles, - computeArgs(ruleContext, CommandLine.EMPTY, ImmutableList.<MakeVariableSupplier>of()), - ruleContext.shouldCreateRunfilesSymlinks()); - } - - /** - * Creates and returns a {@link RunfilesSupport} object for the given rule and executable. Note - * that this method calls back into the passed in rule to obtain the runfiles. - */ - public static RunfilesSupport withExecutable( - RuleContext ruleContext, Runfiles runfiles, Artifact executable, boolean createSymlinks) { - return new RunfilesSupport( - ruleContext, - executable, - runfiles, - computeArgs(ruleContext, CommandLine.EMPTY, ImmutableList.<MakeVariableSupplier>of()), - createSymlinks); + computeArgs(ruleContext, CommandLine.EMPTY, ImmutableList.<MakeVariableSupplier>of())); } /** @@ -401,8 +385,7 @@ public final class RunfilesSupport { executable, runfiles, computeArgs( - ruleContext, CommandLine.of(appendingArgs), ImmutableList.<MakeVariableSupplier>of()), - ruleContext.shouldCreateRunfilesSymlinks()); + ruleContext, CommandLine.of(appendingArgs), ImmutableList.<MakeVariableSupplier>of())); } /** @@ -415,22 +398,19 @@ public final class RunfilesSupport { ruleContext, executable, runfiles, - computeArgs(ruleContext, appendingArgs, ImmutableList.<MakeVariableSupplier>of()), - ruleContext.shouldCreateRunfilesSymlinks()); + computeArgs(ruleContext, appendingArgs, ImmutableList.<MakeVariableSupplier>of())); } public static RunfilesSupport withExecutable( RuleContext ruleContext, Runfiles runfiles, Artifact executable, - boolean createSymlinks, ImmutableList<? extends MakeVariableSupplier> makeVariableSuppliers) { return new RunfilesSupport( ruleContext, executable, runfiles, - computeArgs(ruleContext, CommandLine.EMPTY, makeVariableSuppliers), - createSymlinks); + computeArgs(ruleContext, CommandLine.EMPTY, makeVariableSuppliers)); } private static CommandLine computeArgs( diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java index 0abbb09715..5f845aeb18 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java @@ -378,7 +378,7 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { helper.getCompilationUnitSources(), linkCompileOutputSeparately); RunfilesSupport runfilesSupport = RunfilesSupport.withExecutable( - ruleContext, runfiles, executable, ruleContext.getConfiguration().buildRunfiles()); + ruleContext, runfiles, executable); TransitiveLipoInfoProvider transitiveLipoInfo; if (cppConfiguration.isLipoContextCollector()) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java index de6d6be581..9f809dd1ef 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java @@ -92,7 +92,6 @@ public abstract class PyBinary implements RuleConfiguredTargetFactory { ruleContext, defaultRunfiles, common.getExecutable(), - ruleContext.shouldCreateRunfilesSymlinks(), ImmutableList.of(new CcFlagsSupplier(ruleContext))); if (ruleContext.hasErrors()) { |