diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
6 files changed, 48 insertions, 19 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java index ce171002b6..857e457a22 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java @@ -24,8 +24,9 @@ import com.google.devtools.build.lib.actions.ActionExecutionException; import com.google.devtools.build.lib.actions.ActionKeyContext; import com.google.devtools.build.lib.actions.ActionOwner; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.actions.CommandLine; import com.google.devtools.build.lib.actions.CommandLineExpansionException; +import com.google.devtools.build.lib.actions.CommandLines; +import com.google.devtools.build.lib.actions.CommandLines.CommandLineLimits; import com.google.devtools.build.lib.actions.ResourceSet; import com.google.devtools.build.lib.actions.RunfilesSupplier; import com.google.devtools.build.lib.analysis.actions.SpawnAction; @@ -67,8 +68,10 @@ public final class LtoBackendAction extends SpawnAction { Map<PathFragment, Artifact> allBitcodeFiles, Artifact importsFile, Collection<Artifact> outputs, + Artifact primaryOutput, ActionOwner owner, - CommandLine argv, + CommandLines argv, + CommandLineLimits commandLineLimits, boolean isShellCommand, ActionEnvironment env, Map<String, String> executionInfo, @@ -80,8 +83,10 @@ public final class LtoBackendAction extends SpawnAction { ImmutableList.<Artifact>of(), inputs, outputs, + primaryOutput, AbstractAction.DEFAULT_RESOURCE_SET, argv, + commandLineLimits, isShellCommand, env, ImmutableMap.copyOf(executionInfo), @@ -220,8 +225,10 @@ public final class LtoBackendAction extends SpawnAction { NestedSet<Artifact> tools, NestedSet<Artifact> inputsAndTools, ImmutableList<Artifact> outputs, + Artifact primaryOutput, ResourceSet resourceSet, - CommandLine actualCommandLine, + CommandLines commandLines, + CommandLineLimits commandLineLimits, boolean isShellCommand, ActionEnvironment env, ImmutableMap<String, String> executionInfo, @@ -233,8 +240,10 @@ public final class LtoBackendAction extends SpawnAction { bitcodeFiles, imports, outputs, + primaryOutput, owner, - actualCommandLine, + commandLines, + commandLineLimits, isShellCommand, env, executionInfo, diff --git a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java index ec9bcc9daa..6f8e75fb65 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java @@ -16,12 +16,14 @@ package com.google.devtools.build.lib.rules.genrule; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.ActionEnvironment; import com.google.devtools.build.lib.actions.ActionExecutionContext; import com.google.devtools.build.lib.actions.ActionOwner; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.actions.CommandLine; import com.google.devtools.build.lib.actions.CommandLineExpansionException; +import com.google.devtools.build.lib.actions.CommandLines; +import com.google.devtools.build.lib.actions.CommandLines.CommandLineLimits; import com.google.devtools.build.lib.actions.ExecException; import com.google.devtools.build.lib.actions.ResourceSet; import com.google.devtools.build.lib.actions.RunfilesSupplier; @@ -47,7 +49,7 @@ public class GenRuleAction extends SpawnAction { Iterable<Artifact> tools, Iterable<Artifact> inputs, Iterable<Artifact> outputs, - CommandLine argv, + CommandLines commandLines, ActionEnvironment env, ImmutableMap<String, String> executionInfo, RunfilesSupplier runfilesSupplier, @@ -57,8 +59,10 @@ public class GenRuleAction extends SpawnAction { tools, inputs, outputs, + Iterables.getFirst(outputs, null), GENRULE_RESOURCES, - argv, + commandLines, + CommandLineLimits.UNLIMITED, false, env, executionInfo, diff --git a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBase.java b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBase.java index 33e52c01b9..7f133d75a9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBase.java +++ b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBase.java @@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.actions.CommandLine; +import com.google.devtools.build.lib.actions.CommandLines; import com.google.devtools.build.lib.actions.CompositeRunfilesSupplier; import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; import com.google.devtools.build.lib.analysis.AliasProvider; @@ -222,7 +222,7 @@ public abstract class GenRuleBase implements RuleConfiguredTargetFactory { ImmutableList.copyOf(commandHelper.getResolvedTools()), inputs.build(), filesToBuild, - CommandLine.of(argv), + CommandLines.of(argv), ruleContext.getConfiguration().getActionEnvironment(), ImmutableMap.copyOf(executionInfo), new CompositeRunfilesSupplier(commandHelper.getToolsRunfilesSuppliers()), diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java index 1c02c96a08..b60cb2c30e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java @@ -31,6 +31,8 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactRoot; import com.google.devtools.build.lib.actions.CommandLine; import com.google.devtools.build.lib.actions.CommandLineExpansionException; +import com.google.devtools.build.lib.actions.CommandLines; +import com.google.devtools.build.lib.actions.CommandLines.CommandLineLimits; import com.google.devtools.build.lib.actions.ParameterFile; import com.google.devtools.build.lib.actions.ResourceSet; import com.google.devtools.build.lib.actions.RunfilesSupplier; @@ -180,6 +182,7 @@ public final class JavaCompileAction extends SpawnAction { Collection<Artifact> outputs, CommandLine javaCompileCommandLine, CommandLine commandLine, + CommandLineLimits commandLineLimits, PathFragment classDirectory, Artifact outputJar, NestedSet<Artifact> classpathEntries, @@ -203,8 +206,10 @@ public final class JavaCompileAction extends SpawnAction { tools, inputs, outputs, + outputJar, LOCAL_RESOURCES, - commandLine, + CommandLines.of(commandLine), + commandLineLimits, false, // TODO(#3320): This is missing the configuration's action environment! UTF8_ACTION_ENVIRONMENT, @@ -601,6 +606,7 @@ public final class JavaCompileAction extends SpawnAction { outputs, paramFileContents, javaBuilderCommandLine.build(), + configuration.getCommandLineLimits(), classDirectory, outputJar, classpathEntries, diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java index 51f91c2634..119dbcaafa 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java @@ -32,6 +32,8 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.BaseSpawn; import com.google.devtools.build.lib.actions.CommandLine; import com.google.devtools.build.lib.actions.CommandLineExpansionException; +import com.google.devtools.build.lib.actions.CommandLines; +import com.google.devtools.build.lib.actions.CommandLines.CommandLineLimits; import com.google.devtools.build.lib.actions.ExecException; import com.google.devtools.build.lib.actions.ParamFileInfo; import com.google.devtools.build.lib.actions.ParameterFile; @@ -97,8 +99,10 @@ public class JavaHeaderCompileAction extends SpawnAction { * @param directInputs the set of direct input artifacts of the compile action * @param inputs the set of transitive input artifacts of the compile action * @param outputs the outputs of the action + * @param primaryOutput the output jar + * @param commandLines the transitive command line arguments for the java header compiler * @param directCommandLine the direct command line arguments for the java header compiler - * @param argv the transitive command line arguments for the java header compiler + * @param commandLineLimits the command line limits * @param progressMessage the message printed during the progression of the build */ protected JavaHeaderCompileAction( @@ -107,16 +111,20 @@ public class JavaHeaderCompileAction extends SpawnAction { Iterable<Artifact> directInputs, Iterable<Artifact> inputs, Iterable<Artifact> outputs, + Artifact primaryOutput, + CommandLines commandLines, CommandLine directCommandLine, - CommandLine argv, + CommandLineLimits commandLineLimits, CharSequence progressMessage) { super( owner, tools, inputs, outputs, + primaryOutput, LOCAL_RESOURCES, - argv, + commandLines, + commandLineLimits, false, // TODO(#3320): This is missing the config's action environment. JavaCompileAction.UTF8_ACTION_ENVIRONMENT, @@ -148,9 +156,7 @@ public class JavaHeaderCompileAction extends SpawnAction { // if the direct input spawn failed, try again with transitive inputs to produce better // better messages try { - return context.exec( - getSpawn(actionExecutionContext.getClientEnv()), - actionExecutionContext); + return context.exec(getSpawn(actionExecutionContext), actionExecutionContext); } catch (CommandLineExpansionException commandLineExpansionException) { throw new UserExecException(commandLineExpansionException); } @@ -459,8 +465,10 @@ public class JavaHeaderCompileAction extends SpawnAction { tools, transitiveInputs, outputs, + outputJar, LOCAL_RESOURCES, - transitiveCommandLine, + CommandLines.of(transitiveCommandLine), + ruleContext.getConfiguration().getCommandLineLimits(), false, // TODO(b/63280599): This is missing the config's action environment. JavaCompileAction.UTF8_ACTION_ENVIRONMENT, @@ -489,8 +497,10 @@ public class JavaHeaderCompileAction extends SpawnAction { directInputs, transitiveInputs, outputs, + outputJar, + CommandLines.of(transitiveCommandLine), directCommandLine, - transitiveCommandLine, + ruleContext.getConfiguration().getCommandLineLimits(), getProgressMessage()) }; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/ResourceJarActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/ResourceJarActionBuilder.java index 5120208f11..d5931af5be 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/ResourceJarActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/ResourceJarActionBuilder.java @@ -135,7 +135,7 @@ public class ResourceJarActionBuilder { // the params file in situations where it is required for --min_param_file_size. if (sizeGreaterThanOrEqual( Iterables.concat(messages, resources.values(), resourceJars, classpathResources), 10) - || ruleContext.getConfiguration().getMinParamFileSize() < 10000) { + || ruleContext.getConfiguration().getCommandLineLimits().maxLength < 10000) { paramFileInfo = ParamFileInfo.builder(ParameterFileType.SHELL_QUOTED).build(); } ruleContext.registerAction( |