aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-08-15 23:21:25 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-16 11:06:03 +0200
commit59f1d889f71d6d203ca061787d4ea16465df1916 (patch)
treed0e52ac5be0fe8eed9c0e6886127919e156a2c85 /src/main/java/com/google/devtools/build/lib
parentff746b4aaa5bb7109ff543a72c165fa6e785916f (diff)
Add more type safety to CustomCommandLine.
Allowing add(Object) is too loose and can easily lead to programmer mistakes. Because of type erasure, we can't use the same overload name for (eg.) add(NestedSet<String>) and add(NestedSet<Artifact>). The API is overhauled to use the same terms everywhere, eg. "add", "addPaths", "addExecPaths". This is similar to how it used to be a few CLs ago. The API is overhauled to make sure it's consistent for all types. While tedious, the facade methods immediately dispatch to internal helpers, so implementation wise it's not too heavy. While large, this CL is almost entirely an automated refactor. PiperOrigin-RevId: 165358287
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java378
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java19
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceMergingActionBuilder.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceParsingActionBuilder.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceValidatorActionBuilder.java30
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java30
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/LibraryRGeneratorActionBuilder.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/RClassGeneratorActionBuilder.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/ResourceShrinkerActionBuilder.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/RobolectricResourceSymbolsActionBuilder.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java48
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java27
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/OneVersionCheckActionBuilder.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/ResourceJarActionBuilder.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/SingleJarActionBuilder.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AppleStubBinary.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java22
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java23
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java43
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/LipoSupport.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java12
33 files changed, 536 insertions, 304 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
index 67e3811d7c..008f7defc2 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
@@ -15,7 +15,6 @@
package com.google.devtools.build.lib.analysis.actions;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableCollection;
@@ -26,10 +25,13 @@ import com.google.common.collect.Lists;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
+import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.BlazeInterners;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
+import com.google.devtools.build.lib.util.LazyString;
import com.google.devtools.build.lib.util.Preconditions;
+import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.errorprone.annotations.CompileTimeConstant;
import java.util.ArrayList;
import java.util.Collections;
@@ -37,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import java.util.function.Function;
import javax.annotation.Nullable;
/**
@@ -105,9 +108,9 @@ public final class CustomCommandLine extends CommandLine {
/**
* An ArgvFragment that expands a collection of objects in a user-specified way.
*
- * <p>To construct one, use {@link VectorArg#of} with your collection of objects,
- * and configure the returned object depending on how you want the expansion to
- * take place. Finally, pass it to {@link CustomCommandLine.Builder#add(VectorArg.Builder}.
+ * <p>To construct one, use {@link VectorArg#of} with your collection of objects, and configure
+ * the returned object depending on how you want the expansion to take place. Finally, pass it to
+ * {@link CustomCommandLine.Builder#addExecPaths(VectorArg.Builder}.
*/
public static final class VectorArg implements ArgvFragment {
private static Interner<VectorArg> interner = BlazeInterners.newStrongInterner();
@@ -232,10 +235,13 @@ public final class CustomCommandLine extends CommandLine {
}
/** Each argument is mapped using the supplied map function */
- public Builder<T> mapEach(Function<T, String> mapFn) {
+ @SuppressWarnings("unchecked")
+ public Builder<String> mapEach(Function<T, String> mapFn) {
Preconditions.checkNotNull(mapFn);
this.mapFn = mapFn;
- return this;
+
+ // To save on GC we can simply cast the object and return it.
+ return (Builder<String>) this;
}
/** Once all arguments have been evaluated, they are joined with this delimiter */
@@ -251,7 +257,7 @@ public final class CustomCommandLine extends CommandLine {
* <p>Prefer use of {@link Builder#joinWith} to this method, as it will be more memory
* efficient.
*/
- public Builder joinWithDynamicString(String delimiter) {
+ public Builder<T> joinWithDynamicString(String delimiter) {
Preconditions.checkNotNull(delimiter);
this.joinWith = delimiter;
return this;
@@ -446,28 +452,12 @@ public final class CustomCommandLine extends CommandLine {
private final List<Object> arguments = new ArrayList<>();
/**
- * Adds a value to the argument list.
- *
- * <p>At expansion time, the object is turned into a string by calling {@link Object#toString},
- * unless it is an {@link Artifact}, in which case the exec path is used.
- */
- public Builder add(@Nullable Object value) {
- if (value != null) {
- arguments.add(value);
- }
- return this;
- }
-
- /**
* Adds a constant-value string.
*
* <p>Prefer this over its dynamic cousin, as using static strings saves memory.
*/
public Builder add(@CompileTimeConstant String value) {
- if (value != null) {
- arguments.add(value);
- }
- return this;
+ return addObjectInternal(value);
}
/**
@@ -487,59 +477,274 @@ public final class CustomCommandLine extends CommandLine {
* constants or objects that are already on the heap elsewhere.
*/
public Builder addDynamicString(@Nullable String value) {
- return add((Object) value);
+ return addObjectInternal(value);
+ }
+
+ /**
+ * Adds a label value by calling {@link Label#getCanonicalForm}.
+ *
+ * <p>Prefer this over manually calling {@link Label#getCanonicalForm}, as it avoids a copy of
+ * the label value.
+ */
+ public Builder addLabel(@Nullable Label value) {
+ return addObjectInternal(value);
+ }
+
+ /**
+ * Adds an artifact by calling {@link PathFragment#getPathString}.
+ *
+ * <p>Prefer this over manually calling {@link PathFragment#getPathString}, as it avoids storing
+ * a copy of the path string.
+ */
+ public Builder addPath(@Nullable PathFragment value) {
+ return addObjectInternal(value);
+ }
+
+ /**
+ * Adds an artifact by calling {@link Artifact#getExecPath}.
+ *
+ * <p>Prefer this over manually calling {@link Artifact#getExecPath}, as it avoids storing a
+ * copy of the artifact path string.
+ */
+ public Builder addExecPath(@Nullable Artifact value) {
+ return addObjectInternal(value);
+ }
+
+ /** Adds a lazily expanded string. */
+ public Builder addLazyString(@Nullable LazyString value) {
+ return addObjectInternal(value);
+ }
+
+ private Builder addObjectInternal(@Nullable Object value) {
+ if (value != null) {
+ arguments.add(value);
+ }
+ return this;
+ }
+
+ /**
+ * Adds a string argument to the command line.
+ *
+ * <p>If the value is null, neither the arg nor the value is added.
+ */
+ public Builder add(@CompileTimeConstant String arg, @Nullable String value) {
+ return addObjectInternal(arg, value);
+ }
+
+ /**
+ * Adds a label value by calling {@link Label#getCanonicalForm}.
+ *
+ * <p>Prefer this over manually calling {@link Label#getCanonicalForm}, as it avoids storing a
+ * copy of the label value.
+ *
+ * <p>If the value is null, neither the arg nor the value is added.
+ */
+ public Builder addLabel(@CompileTimeConstant String arg, @Nullable Label value) {
+ return addObjectInternal(arg, value);
+ }
+
+ /**
+ * Adds an artifact by calling {@link PathFragment#getPathString}.
+ *
+ * <p>Prefer this over manually calling {@link PathFragment#getPathString}, as it avoids storing
+ * a copy of the path string.
+ *
+ * <p>If the value is null, neither the arg nor the value is added.
+ */
+ public Builder addPath(@CompileTimeConstant String arg, @Nullable PathFragment value) {
+ return addObjectInternal(arg, value);
+ }
+
+ /**
+ * Adds an artifact by calling {@link Artifact#getExecPath}.
+ *
+ * <p>Prefer this over manually calling {@link Artifact#getExecPath}, as it avoids storing a
+ * copy of the artifact path string.
+ *
+ * <p>If the value is null, neither the arg nor the value is added.
+ */
+ public Builder addExecPath(@CompileTimeConstant String arg, @Nullable Artifact value) {
+ return addObjectInternal(arg, value);
+ }
+
+ /** Adds a lazily expanded string. */
+ public Builder addLazyString(@CompileTimeConstant String arg, @Nullable LazyString value) {
+ return addObjectInternal(arg, value);
}
/** Adds the arg and the passed value if the value is non-null. */
- public Builder add(@CompileTimeConstant String arg, @Nullable Object value) {
+ private Builder addObjectInternal(@CompileTimeConstant String arg, @Nullable Object value) {
Preconditions.checkNotNull(arg);
if (value != null) {
arguments.add(arg);
- add(value);
+ addObjectInternal(value);
}
return this;
}
- /** Adds the string representation of the passed values. */
- public Builder add(@Nullable ImmutableCollection<?> values) {
+ /**
+ * Adds the passed strings to the command line.
+ *
+ * <p>If you are converting long lists or nested sets of a different type to string lists,
+ * please try to use {@link Builder#addExecPaths(VectorArg.Builder)} instead of this method.
+ */
+ public Builder add(@Nullable ImmutableCollection<String> values) {
+ return addImmutableCollectionInternal(values);
+ }
+
+ /** Adds the passed paths to the command line. */
+ public Builder addPaths(@Nullable ImmutableCollection<PathFragment> values) {
+ return addImmutableCollectionInternal(values);
+ }
+
+ /**
+ * Adds the artifacts' exec paths to the command line.
+ *
+ * <p>Do not use this method if the list is derived from a flattened nested set. Instead, figure
+ * out how to avoid flattening the set and use {@link
+ * Builder#addExecPaths(NestedSet<Artifact>)}.
+ */
+ public Builder addExecPaths(@Nullable ImmutableCollection<Artifact> values) {
+ return addImmutableCollectionInternal(values);
+ }
+
+ private Builder addImmutableCollectionInternal(@Nullable ImmutableCollection<?> values) {
if (values != null) {
arguments.add(values);
}
return this;
}
- /** Adds the string representation of the passed values. */
- public Builder add(@Nullable NestedSet<?> values) {
+ /** Adds the passed strings to the command line. */
+ public Builder add(@Nullable NestedSet<String> values) {
+ return addNestedSetInternal(values);
+ }
+
+ /** Adds the passed paths to the command line. */
+ public Builder addPaths(@Nullable NestedSet<PathFragment> values) {
+ return addNestedSetInternal(values);
+ }
+
+ /** Adds the artifacts' exec paths to the command line. */
+ public Builder addExecPaths(@Nullable NestedSet<Artifact> values) {
+ return addNestedSetInternal(values);
+ }
+
+ private Builder addNestedSetInternal(@Nullable NestedSet<?> values) {
if (values != null) {
arguments.add(values);
}
return this;
}
+ /** Calls {@link String#format} at command line expansion time. */
+ public Builder addFormatted(@CompileTimeConstant String formatStr, Object... args) {
+ Preconditions.checkNotNull(formatStr);
+ FormatArg.push(arguments, formatStr, args);
+ return this;
+ }
+
+ /** Cancatenates the passed prefix string and the object's string representation. */
+ public Builder addWithPrefix(@CompileTimeConstant String prefix, @Nullable Object arg) {
+ Preconditions.checkNotNull(prefix);
+ if (arg != null) {
+ PrefixArg.push(arguments, prefix, arg);
+ }
+ return this;
+ }
+
+ /**
+ * Cancatenates the passed prefix string and the object's string representation.
+ *
+ * <p>Prefer {@link Builder#addWithPrefix}, as it will be more memory efficient.
+ */
+ public Builder addWithDynamicPrefix(String prefix, @Nullable Object arg) {
+ Preconditions.checkNotNull(prefix);
+ if (arg != null) {
+ PrefixArg.push(arguments, prefix, arg);
+ }
+ return this;
+ }
+
+ /**
+ * Adds the arg followed by the passed strings.
+ *
+ * <p>If values is empty, the arg isn't added.
+ */
+ public Builder add(
+ @CompileTimeConstant String arg, @Nullable ImmutableCollection<String> values) {
+ return addImmutableCollectionInternal(arg, values);
+ }
+
/**
- * Adds the arg followed by the string representation of the passed values.
+ * Adds the arg followed by the path strings.
*
* <p>If values is empty, the arg isn't added.
*/
- public Builder add(@CompileTimeConstant String arg, @Nullable ImmutableCollection<?> values) {
+ public Builder addPaths(
+ @CompileTimeConstant String arg, @Nullable ImmutableCollection<PathFragment> values) {
+ return addImmutableCollectionInternal(arg, values);
+ }
+
+ /**
+ * Adds the arg followed by the artifacts' exec paths.
+ *
+ * <p>Do not use this method if the list is derived from a flattened nested set. Instead, figure
+ * out how to avoid flattening the set and use {@link Builder#addExecPaths(String,
+ * NestedSet<Artifact>)}.
+ *
+ * <p>If values is empty, the arg isn't added.
+ */
+ public Builder addExecPaths(
+ @CompileTimeConstant String arg, @Nullable ImmutableCollection<Artifact> values) {
+ return addImmutableCollectionInternal(arg, values);
+ }
+
+ private Builder addImmutableCollectionInternal(
+ @CompileTimeConstant String arg, @Nullable ImmutableCollection<?> values) {
Preconditions.checkNotNull(arg);
if (values != null && !values.isEmpty()) {
arguments.add(arg);
- add(values);
+ addImmutableCollectionInternal(values);
}
return this;
}
/**
- * Adds the arg followed by the string representation of the passed values.
+ * Adds the arg followed by the passed strings.
+ *
+ * <p>If values is empty, the arg isn't added.
+ */
+ public Builder add(@CompileTimeConstant String arg, @Nullable NestedSet<String> values) {
+ return addNestedSetInternal(arg, values);
+ }
+
+ /**
+ * Adds the arg followed by the path fragments.
*
* <p>If values is empty, the arg isn't added.
*/
- public Builder add(@CompileTimeConstant String arg, @Nullable NestedSet<?> values) {
+ public Builder addPaths(
+ @CompileTimeConstant String arg, @Nullable NestedSet<PathFragment> values) {
+ return addNestedSetInternal(arg, values);
+ }
+
+ /**
+ * Adds the arg followed by the artifacts' exec paths.
+ *
+ * <p>If values is empty, the arg isn't added.
+ */
+ public Builder addExecPaths(
+ @CompileTimeConstant String arg, @Nullable NestedSet<Artifact> values) {
+ return addNestedSetInternal(arg, values);
+ }
+
+ private Builder addNestedSetInternal(
+ @CompileTimeConstant String arg, @Nullable NestedSet<?> values) {
Preconditions.checkNotNull(arg);
if (values != null && !values.isEmpty()) {
arguments.add(arg);
- add(values);
+ addNestedSetInternal(values);
}
return this;
}
@@ -549,79 +754,90 @@ public final class CustomCommandLine extends CommandLine {
*
* <p>Please see {@link VectorArg} for more information.
*/
- public Builder add(VectorArg.Builder<?> vectorArg) {
- if (!vectorArg.isEmpty) {
- VectorArg.push(arguments, vectorArg);
- }
- return this;
+ public Builder add(VectorArg.Builder<String> vectorArg) {
+ return addVectorArgInternal(vectorArg);
}
/**
- * Adds the arg followed by the expansion of the vector arg.
+ * Adds the expansion of the passed vector arg's path strings.
*
* <p>Please see {@link VectorArg} for more information.
+ */
+ public Builder addPaths(VectorArg.Builder<PathFragment> vectorArg) {
+ return addVectorArgInternal(vectorArg);
+ }
+
+ /**
+ * Adds the expansion of the passed vector arg's exec paths.
*
- * <p>If values is empty, the arg isn't added.
+ * <p>Please see {@link VectorArg} for more information.
*/
- public Builder add(@CompileTimeConstant String arg, VectorArg.Builder<?> vectorArg) {
- Preconditions.checkNotNull(arg);
- if (!vectorArg.isEmpty) {
- arguments.add(arg);
- add(vectorArg);
- }
- return this;
+ public Builder addExecPaths(VectorArg.Builder<Artifact> vectorArg) {
+ return addVectorArgInternal(vectorArg);
}
- public Builder add(@Nullable CustomArgv arg) {
- if (arg != null) {
- arguments.add(arg);
+ private Builder addVectorArgInternal(VectorArg.Builder<?> vectorArg) {
+ if (!vectorArg.isEmpty) {
+ VectorArg.push(arguments, vectorArg);
}
return this;
}
- public Builder add(@Nullable CustomMultiArgv arg) {
- if (arg != null) {
- arguments.add(arg);
- }
- return this;
+ /**
+ * Adds the arg followed by the expansion of the vector arg.
+ *
+ * <p>Please see {@link VectorArg} for more information.
+ *
+ * <p>If values is empty, the arg isn't added.
+ */
+ public Builder add(@CompileTimeConstant String arg, VectorArg.Builder<String> vectorArg) {
+ return addVectorArgInternal(arg, vectorArg);
}
- /** Calls {@link String#format} at command line expansion time. */
- public Builder addFormatted(@CompileTimeConstant String formatStr, Object... args) {
- Preconditions.checkNotNull(formatStr);
- FormatArg.push(arguments, formatStr, args);
- return this;
+ /**
+ * Adds the arg followed by the expansion of the vector arg's path strings.
+ *
+ * <p>Please see {@link VectorArg} for more information.
+ *
+ * <p>If values is empty, the arg isn't added.
+ */
+ public Builder addPaths(
+ @CompileTimeConstant String arg, VectorArg.Builder<PathFragment> vectorArg) {
+ return addVectorArgInternal(arg, vectorArg);
}
/**
- * Calls {@link String#format} at command line expansion time.
+ * Adds the arg followed by the expansion of the vector arg's exec paths.
*
- * <p>Prefer {@link Builder#addFormatted} instead, as it will be more memory efficient.
+ * <p>Please see {@link VectorArg} for more information.
+ *
+ * <p>If values is empty, the arg isn't added.
*/
- public Builder addFormattedWithDynamicFormatStr(String formatStr, Object... args) {
- Preconditions.checkNotNull(formatStr);
- FormatArg.push(arguments, formatStr, args);
+ public Builder addExecPaths(
+ @CompileTimeConstant String arg, VectorArg.Builder<Artifact> vectorArg) {
+ return addVectorArgInternal(arg, vectorArg);
+ }
+
+ private Builder addVectorArgInternal(
+ @CompileTimeConstant String arg, VectorArg.Builder<?> vectorArg) {
+ Preconditions.checkNotNull(arg);
+ if (!vectorArg.isEmpty) {
+ arguments.add(arg);
+ addVectorArgInternal(vectorArg);
+ }
return this;
}
- /** Cancatenates the passed prefix string and the object's string representation. */
- public Builder addWithPrefix(@CompileTimeConstant String prefix, @Nullable Object arg) {
- Preconditions.checkNotNull(prefix);
+ public Builder addCustomArgv(@Nullable CustomArgv arg) {
if (arg != null) {
- PrefixArg.push(arguments, prefix, arg);
+ arguments.add(arg);
}
return this;
}
- /**
- * Cancatenates the passed prefix string and the object's string representation.
- *
- * <p>Prefer {@link Builder#addWithPrefix}, as it will be more memory efficient.
- */
- public Builder addWithDynamicPrefix(String prefix, @Nullable Object arg) {
- Preconditions.checkNotNull(prefix);
+ public Builder addCustomMultiArgv(@Nullable CustomMultiArgv arg) {
if (arg != null) {
- PrefixArg.push(arguments, prefix, arg);
+ arguments.add(arg);
}
return this;
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java
index a1bb0611e6..820a9ae457 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java
@@ -88,6 +88,7 @@ public final class ParamFileHelper {
ImmutableList<String> executableArgs, ParamFileInfo paramFileInfo, Artifact parameterFile) {
return CustomCommandLine.builder()
.add(executableArgs)
+ // This is actually a constant, but there is no way to suppress the warning
.addWithDynamicPrefix(paramFileInfo.getFlag(), parameterFile)
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java
index 8d3b0e5316..32ec7a8506 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.analysis.actions;
import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType;
import com.google.devtools.build.lib.util.Preconditions;
+import com.google.errorprone.annotations.CompileTimeConstant;
import java.nio.charset.Charset;
import java.util.Objects;
import javax.annotation.concurrent.Immutable;
@@ -31,7 +32,11 @@ public final class ParamFileInfo {
private final String flag;
private final boolean always;
- public ParamFileInfo(ParameterFileType fileType, Charset charset, String flag, boolean always) {
+ public ParamFileInfo(
+ ParameterFileType fileType,
+ Charset charset,
+ @CompileTimeConstant String flag,
+ boolean always) {
this.fileType = Preconditions.checkNotNull(fileType);
this.charset = Preconditions.checkNotNull(charset);
this.flag = Preconditions.checkNotNull(flag);
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
index a391dd653b..9e9ff3d436 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
@@ -1068,7 +1068,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
public Builder addArguments(Iterable<String> arguments) {
Preconditions.checkState(commandLine == null);
if (arguments instanceof NestedSet) {
- commandLineBuilder.add((NestedSet) arguments);
+ commandLineBuilder.addExecPaths((NestedSet) arguments);
} else {
commandLineBuilder.add(ImmutableList.copyOf(arguments));
}
@@ -1082,7 +1082,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
public Builder addInputArgument(Artifact argument) {
Preconditions.checkState(commandLine == null);
addInput(argument);
- commandLineBuilder.add(argument);
+ commandLineBuilder.addExecPath(argument);
return this;
}
@@ -1093,9 +1093,9 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
public Builder addInputArguments(Iterable<Artifact> arguments) {
addInputs(arguments);
if (arguments instanceof NestedSet) {
- commandLineBuilder.add((NestedSet) arguments);
+ commandLineBuilder.addExecPaths((NestedSet) arguments);
} else {
- commandLineBuilder.add(ImmutableList.copyOf(arguments));
+ commandLineBuilder.addExecPaths(ImmutableList.copyOf(arguments));
}
return this;
}
@@ -1107,7 +1107,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
public Builder addOutputArgument(Artifact argument) {
Preconditions.checkState(commandLine == null);
outputs.add(argument);
- commandLineBuilder.add(argument);
+ commandLineBuilder.addExecPath(argument);
return this;
}
@@ -1285,12 +1285,17 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
* artifact must be specified.
*/
public Builder useParameterFile(
- ParameterFileType parameterFileType, Charset charset, String flagPrefix) {
+ ParameterFileType parameterFileType,
+ Charset charset,
+ @CompileTimeConstant String flagPrefix) {
return useParameterFile(parameterFileType, charset, flagPrefix, /*always=*/ false);
}
private Builder useParameterFile(
- ParameterFileType parameterFileType, Charset charset, String flagPrefix, boolean always) {
+ ParameterFileType parameterFileType,
+ Charset charset,
+ @CompileTimeConstant String flagPrefix,
+ boolean always) {
paramFileInfo = new ParamFileInfo(parameterFileType, charset, flagPrefix, always);
return this;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index ebec97f3c9..f13b70e70c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -1341,8 +1341,8 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
CommandLine mergeCommandLine =
CustomCommandLine.builder()
- .add(VectorArg.of(shardDexes).beforeEach("--input_zip"))
- .add("--output_zip", classesDex)
+ .addExecPaths(VectorArg.of(shardDexes).beforeEach("--input_zip"))
+ .addExecPath("--output_zip", classesDex)
.build();
ruleContext.registerAction(
new SpawnAction.Builder()
@@ -1565,11 +1565,11 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
CustomCommandLine.Builder shardCommandLine =
CustomCommandLine.builder()
- .add(VectorArg.of(shards).beforeEach("--output_jar"))
- .add("--output_resources", javaResourceJar);
+ .addExecPaths(VectorArg.of(shards).beforeEach("--output_jar"))
+ .addExecPath("--output_resources", javaResourceJar);
if (mainDexList != null) {
- shardCommandLine.add("--main_dex_filter", mainDexList);
+ shardCommandLine.addExecPath("--main_dex_filter", mainDexList);
shardAction.addInput(mainDexList);
}
@@ -1581,7 +1581,7 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
if (proguardedJar != null) {
// When proguard is used we can't use dex archives, so just shuffle the proguarded jar
checkArgument(!useDexArchives, "Dex archives are incompatible with Proguard");
- shardCommandLine.add("--input_jar", proguardedJar);
+ shardCommandLine.addExecPath("--input_jar", proguardedJar);
shardAction.addInput(proguardedJar);
} else {
ImmutableList<Artifact> classpath =
@@ -1620,11 +1620,11 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
} else {
classpath = classpath.stream().map(derivedJarFunction::apply).collect(toImmutableList());
}
- shardCommandLine.add(VectorArg.of(classpath).beforeEach("--input_jar"));
+ shardCommandLine.addExecPaths(VectorArg.of(classpath).beforeEach("--input_jar"));
shardAction.addInputs(classpath);
if (inclusionFilterJar != null) {
- shardCommandLine.add("--inclusion_filter_jar", inclusionFilterJar);
+ shardCommandLine.addExecPath("--inclusion_filter_jar", inclusionFilterJar);
shardAction.addInput(inclusionFilterJar);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java
index fee0bbbaa4..7e0dfbb075 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java
@@ -335,13 +335,13 @@ public class AndroidIdlHelper {
.setExecutable(ruleContext.getExecutablePrerequisite("$idlclass", Mode.HOST))
.setCommandLine(
CustomCommandLine.builder()
- .add("--manifest_proto", manifestProtoOutput)
- .add("--class_jar", classJar)
- .add("--output_class_jar", idlClassJar)
- .add("--output_source_jar", idlSourceJar)
+ .addExecPath("--manifest_proto", manifestProtoOutput)
+ .addExecPath("--class_jar", classJar)
+ .addExecPath("--output_class_jar", idlClassJar)
+ .addExecPath("--output_source_jar", idlSourceJar)
.add("--temp_dir")
- .add(idlTempDir)
- .add(ImmutableList.copyOf(generatedIdlJavaFiles))
+ .addPath(idlTempDir)
+ .addExecPaths(ImmutableList.copyOf(generatedIdlJavaFiles))
.build())
.useParameterFile(ParameterFileType.SHELL_QUOTED)
.setProgressMessage("Building idl jars %s", idlClassJar.prettyPrint())
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceMergingActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceMergingActionBuilder.java
index 780acde3b6..d205930765 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceMergingActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceMergingActionBuilder.java
@@ -133,7 +133,7 @@ public class AndroidResourceMergingActionBuilder {
// Use a FluentIterable to avoid flattening the NestedSets
NestedSetBuilder<Artifact> inputs = NestedSetBuilder.naiveLinkOrder();
- builder.add("--androidJar", sdk.getAndroidJar());
+ builder.addExecPath("--androidJar", sdk.getAndroidJar());
inputs.add(sdk.getAndroidJar());
Preconditions.checkNotNull(primary);
@@ -141,7 +141,7 @@ public class AndroidResourceMergingActionBuilder {
inputs.addTransitive(RESOURCE_CONTAINER_TO_ARTIFACTS.apply(primary));
Preconditions.checkNotNull(primary.getManifest());
- builder.add("--primaryManifest", primary.getManifest());
+ builder.addExecPath("--primaryManifest", primary.getManifest());
inputs.add(primary.getManifest());
ResourceContainerConverter.convertDependencies(
@@ -149,19 +149,19 @@ public class AndroidResourceMergingActionBuilder {
List<Artifact> outs = new ArrayList<>();
if (classJarOut != null) {
- builder.add("--classJarOutput", classJarOut);
+ builder.addExecPath("--classJarOutput", classJarOut);
outs.add(classJarOut);
}
if (mergedResourcesOut != null) {
- builder.add("--resourcesOutput", mergedResourcesOut);
+ builder.addExecPath("--resourcesOutput", mergedResourcesOut);
outs.add(mergedResourcesOut);
}
// For now, do manifest processing to remove placeholders that aren't handled by the legacy
// manifest merger. Remove this once enough users migrate over to the new manifest merger.
if (manifestOut != null) {
- builder.add("--manifestOutput", manifestOut);
+ builder.addExecPath("--manifestOutput", manifestOut);
outs.add(manifestOut);
}
@@ -174,7 +174,7 @@ public class AndroidResourceMergingActionBuilder {
// TODO(corysmith): Move the data binding parsing out of the merging pass to enable faster
// aapt2 builds.
if (dataBindingInfoZip != null) {
- builder.add("--dataBindingInfoOut", dataBindingInfoZip);
+ builder.addExecPath("--dataBindingInfoOut", dataBindingInfoZip);
outs.add(dataBindingInfoZip);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceParsingActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceParsingActionBuilder.java
index a68c2610e3..f7a69b074a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceParsingActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceParsingActionBuilder.java
@@ -140,7 +140,7 @@ public class AndroidResourceParsingActionBuilder {
inputs.addTransitive(RESOURCE_CONTAINER_TO_ARTIFACTS.apply(primary));
Preconditions.checkNotNull(output);
- builder.add("--output", output);
+ builder.addExecPath("--output", output);
SpawnAction.Builder spawnActionBuilder = new SpawnAction.Builder();
if (OS.getCurrent() == OS.WINDOWS) {
@@ -178,17 +178,17 @@ public class AndroidResourceParsingActionBuilder {
.add("COMPILE_LIBRARY_RESOURCES")
.add("--")
.add("--resources", resourceDirectories)
- .add("--output", compiledSymbols);
+ .addExecPath("--output", compiledSymbols);
outs.add(compiledSymbols);
// The databinding needs to be processed before compilation, so the stripping happens here.
if (dataBindingInfoZip != null) {
- flatFileBuilder.add("--manifest", resourceContainer.getManifest());
+ flatFileBuilder.addExecPath("--manifest", resourceContainer.getManifest());
inputs.add(resourceContainer.getManifest());
if (!Strings.isNullOrEmpty(resourceContainer.getJavaPackage())) {
flatFileBuilder.add("--packagePath", resourceContainer.getJavaPackage());
}
- builder.add("--dataBindingInfoOut", dataBindingInfoZip);
+ builder.addExecPath("--dataBindingInfoOut", dataBindingInfoZip);
outs.add(dataBindingInfoZip);
}
// Create the spawn action.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceValidatorActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceValidatorActionBuilder.java
index 40ae0972e8..ccd4e4ee39 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceValidatorActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceValidatorActionBuilder.java
@@ -157,7 +157,7 @@ public class AndroidResourceValidatorActionBuilder {
// Set the busybox tool.
builder.add("--tool").add("LINK_STATIC_LIBRARY").add("--");
- builder.add("--aapt2", sdk.getAapt2().getExecutable());
+ builder.addExecPath("--aapt2", sdk.getAapt2().getExecutable());
FluentIterable<Artifact> libraries =
FluentIterable.from(resourceDeps.getResources()).transform(
@@ -165,15 +165,15 @@ public class AndroidResourceValidatorActionBuilder {
builder
.add("--libraries")
- .add(
+ .addExecPaths(
VectorArg.of(ImmutableList.copyOf(libraries))
.joinWithDynamicString(context.getConfiguration().getHostPathSeparator()));
inputs.addAll(libraries);
- builder.add("--compiled", compiledSymbols);
+ builder.addExecPath("--compiled", compiledSymbols);
inputs.add(compiledSymbols);
- builder.add("--manifest", primary.getManifest());
+ builder.addExecPath("--manifest", primary.getManifest());
inputs.add(validated.getManifest());
if (!Strings.isNullOrEmpty(customJavaPackage)) {
@@ -182,13 +182,13 @@ public class AndroidResourceValidatorActionBuilder {
builder.add("--packageForR", customJavaPackage);
}
- builder.add("--sourceJarOut", aapt2SourceJarOut);
+ builder.addExecPath("--sourceJarOut", aapt2SourceJarOut);
outs.add(aapt2SourceJarOut);
- builder.add("--rTxtOut", aapt2RTxtOut);
+ builder.addExecPath("--rTxtOut", aapt2RTxtOut);
outs.add(aapt2RTxtOut);
- builder.add("--staticLibraryOut", staticLibraryOut);
+ builder.addExecPath("--staticLibraryOut", staticLibraryOut);
outs.add(staticLibraryOut);
ruleContext.registerAction(
@@ -225,21 +225,21 @@ public class AndroidResourceValidatorActionBuilder {
builder.add("--buildToolsVersion", sdk.getBuildToolsVersion());
}
- builder.add("--aapt", sdk.getAapt().getExecutable());
+ builder.addExecPath("--aapt", sdk.getAapt().getExecutable());
ImmutableList.Builder<Artifact> inputs = ImmutableList.builder();
- builder.add("--annotationJar", sdk.getAnnotationsJar());
+ builder.addExecPath("--annotationJar", sdk.getAnnotationsJar());
inputs.add(sdk.getAnnotationsJar());
- builder.add("--androidJar", sdk.getAndroidJar());
+ builder.addExecPath("--androidJar", sdk.getAndroidJar());
inputs.add(sdk.getAndroidJar());
Preconditions.checkNotNull(mergedResources);
- builder.add("--mergedResources", mergedResources);
+ builder.addExecPath("--mergedResources", mergedResources);
inputs.add(mergedResources);
- builder.add("--manifest", primary.getManifest());
+ builder.addExecPath("--manifest", primary.getManifest());
inputs.add(primary.getManifest());
if (debug) {
@@ -253,15 +253,15 @@ public class AndroidResourceValidatorActionBuilder {
}
List<Artifact> outs = new ArrayList<>();
Preconditions.checkNotNull(rTxtOut);
- builder.add("--rOutput", rTxtOut);
+ builder.addExecPath("--rOutput", rTxtOut);
outs.add(rTxtOut);
Preconditions.checkNotNull(sourceJarOut);
- builder.add("--srcJarOutput", sourceJarOut);
+ builder.addExecPath("--srcJarOutput", sourceJarOut);
outs.add(sourceJarOut);
if (apkOut != null) {
- builder.add("--packagePath", apkOut);
+ builder.addExecPath("--packagePath", apkOut);
outs.add(apkOut);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java
index 87a6d54b84..5605a04d6f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java
@@ -282,7 +282,7 @@ public class AndroidResourcesProcessorBuilder {
// Set the busybox tool.
builder.add("--tool").add("AAPT2_PACKAGE").add("--");
- builder.add("--aapt2", sdk.getAapt2().getExecutable());
+ builder.addExecPath("--aapt2", sdk.getAapt2().getExecutable());
ResourceContainerConverter.convertDependencies(
dependencies, builder, inputs, AAPT2_RESOURCE_DEP_TO_ARG, AAPT2_RESOURCE_DEP_TO_ARTIFACTS);
@@ -345,7 +345,7 @@ public class AndroidResourcesProcessorBuilder {
ResourceContainerConverter.convertDependencies(
dependencies, builder, inputs, RESOURCE_DEP_TO_ARG, RESOURCE_DEP_TO_ARTIFACTS);
- builder.add("--aapt", sdk.getAapt().getExecutable());
+ builder.addExecPath("--aapt", sdk.getAapt().getExecutable());
configureCommonFlags(outs, inputs, builder);
if (OS.getCurrent() == OS.WINDOWS) {
@@ -404,10 +404,10 @@ public class AndroidResourcesProcessorBuilder {
builder.add("--buildToolsVersion", sdk.getBuildToolsVersion());
}
- builder.add("--annotationJar", sdk.getAnnotationsJar());
+ builder.addExecPath("--annotationJar", sdk.getAnnotationsJar());
inputs.add(sdk.getAnnotationsJar());
- builder.add("--androidJar", sdk.getAndroidJar());
+ builder.addExecPath("--androidJar", sdk.getAndroidJar());
inputs.add(sdk.getAndroidJar());
if (isLibrary) {
@@ -415,40 +415,40 @@ public class AndroidResourcesProcessorBuilder {
}
if (rTxtOut != null) {
- builder.add("--rOutput", rTxtOut);
+ builder.addExecPath("--rOutput", rTxtOut);
outs.add(rTxtOut);
}
if (symbols != null) {
- builder.add("--symbolsOut", symbols);
+ builder.addExecPath("--symbolsOut", symbols);
outs.add(symbols);
}
if (sourceJarOut != null) {
- builder.add("--srcJarOutput", sourceJarOut);
+ builder.addExecPath("--srcJarOutput", sourceJarOut);
outs.add(sourceJarOut);
}
if (proguardOut != null) {
- builder.add("--proguardOutput", proguardOut);
+ builder.addExecPath("--proguardOutput", proguardOut);
outs.add(proguardOut);
}
if (mainDexProguardOut != null) {
- builder.add("--mainDexProguardOutput", mainDexProguardOut);
+ builder.addExecPath("--mainDexProguardOutput", mainDexProguardOut);
outs.add(mainDexProguardOut);
}
if (manifestOut != null) {
- builder.add("--manifestOutput", manifestOut);
+ builder.addExecPath("--manifestOutput", manifestOut);
outs.add(manifestOut);
}
if (mergedResourcesOut != null) {
- builder.add("--resourcesOutput", mergedResourcesOut);
+ builder.addExecPath("--resourcesOutput", mergedResourcesOut);
outs.add(mergedResourcesOut);
}
if (apkOut != null) {
- builder.add("--packagePath", apkOut);
+ builder.addExecPath("--packagePath", apkOut);
outs.add(apkOut);
}
if (resourceFilter.hasConfigurationFilters() && !resourceFilter.isPrefiltering()) {
@@ -490,7 +490,7 @@ public class AndroidResourcesProcessorBuilder {
}
if (dataBindingInfoZip != null) {
- builder.add("--dataBindingInfoOut", dataBindingInfoZip);
+ builder.addExecPath("--dataBindingInfoOut", dataBindingInfoZip);
outs.add(dataBindingInfoZip);
}
@@ -501,12 +501,12 @@ public class AndroidResourcesProcessorBuilder {
}
if (featureOf != null) {
- builder.add("--featureOf", featureOf);
+ builder.addExecPath("--featureOf", featureOf);
inputs.add(featureOf);
}
if (featureAfter != null) {
- builder.add("--featureAfter", featureAfter);
+ builder.addExecPath("--featureAfter", featureAfter);
inputs.add(featureAfter);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
index 996523b50e..8d0e87b66e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
@@ -373,10 +373,10 @@ public final class DexArchiveAspect extends NativeAspectClass implements Configu
Artifact result) {
CustomCommandLine args =
new Builder()
- .add("--input", jar)
- .add("--output", result)
- .add(VectorArg.of(classpath).beforeEach("--classpath_entry"))
- .add(VectorArg.of(bootclasspath).beforeEach("--bootclasspath_entry"))
+ .addExecPath("--input", jar)
+ .addExecPath("--output", result)
+ .addExecPaths(VectorArg.of(classpath).beforeEach("--classpath_entry"))
+ .addExecPaths(VectorArg.of(bootclasspath).beforeEach("--bootclasspath_entry"))
.build();
// Just use params file, since classpaths can get long
@@ -427,8 +427,8 @@ public final class DexArchiveAspect extends NativeAspectClass implements Configu
// Write command line arguments into a params file for compatibility with WorkerSpawnStrategy
CustomCommandLine args =
new Builder()
- .add("--input_jar", jar)
- .add("--output_zip", dexArchive)
+ .addExecPath("--input_jar", jar)
+ .addExecPath("--output_zip", dexArchive)
.add(ImmutableList.copyOf(incrementalDexopts))
.build();
Artifact paramFile =
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/LibraryRGeneratorActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/LibraryRGeneratorActionBuilder.java
index f361f8a89a..185953c5c1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/LibraryRGeneratorActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/LibraryRGeneratorActionBuilder.java
@@ -76,13 +76,13 @@ public class LibraryRGeneratorActionBuilder {
if (!symbolProviders.isEmpty()) {
ImmutableList<Artifact> symbols =
symbolProviders.stream().map(ResourceContainer::getSymbols).collect(toImmutableList());
- builder.add("--symbols", symbols);
+ builder.addExecPaths("--symbols", symbols);
inputs.addTransitive(NestedSetBuilder.wrap(Order.NAIVE_LINK_ORDER, symbols));
}
- builder.add("--classJarOutput", rJavaClassJar);
+ builder.addExecPath("--classJarOutput", rJavaClassJar);
- builder.add("--androidJar", sdk.getAndroidJar());
+ builder.addExecPath("--androidJar", sdk.getAndroidJar());
inputs.add(sdk.getAndroidJar());
// Create the spawn action.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java
index b04e63f5d1..0f0c682ffb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java
@@ -100,7 +100,7 @@ public class ManifestMergerActionBuilder {
.getRunfilesSupport()
.getRunfilesArtifactsWithoutMiddlemen());
- builder.add("--manifest", manifest);
+ builder.addExecPath("--manifest", manifest);
inputs.add(manifest);
if (mergeeManifests != null && !mergeeManifests.isEmpty()) {
@@ -123,11 +123,11 @@ public class ManifestMergerActionBuilder {
builder.add("--customPackage", customPackage);
}
- builder.add("--manifestOutput", manifestOutput);
+ builder.addExecPath("--manifestOutput", manifestOutput);
outputs.add(manifestOutput);
if (logOut != null) {
- builder.add("--log", logOut);
+ builder.addExecPath("--log", logOut);
outputs.add(logOut);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/RClassGeneratorActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/RClassGeneratorActionBuilder.java
index 9eba56e56b..3d68a65203 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/RClassGeneratorActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/RClassGeneratorActionBuilder.java
@@ -89,11 +89,11 @@ public class RClassGeneratorActionBuilder {
List<Artifact> outs = new ArrayList<>();
if (primary.getRTxt() != null) {
- builder.add("--primaryRTxt", primary.getRTxt());
+ builder.addExecPath("--primaryRTxt", primary.getRTxt());
inputs.add(primary.getRTxt());
}
if (primary.getManifest() != null) {
- builder.add("--primaryManifest", primary.getManifest());
+ builder.addExecPath("--primaryManifest", primary.getManifest());
inputs.add(primary.getManifest());
}
if (!Strings.isNullOrEmpty(primary.getJavaPackage())) {
@@ -115,7 +115,7 @@ public class RClassGeneratorActionBuilder {
.transformAndConcat(chooseDepsToArtifacts(version))));
}
}
- builder.add("--classJarOutput", classJarOut);
+ builder.addExecPath("--classJarOutput", classJarOut);
outs.add(classJarOut);
// Create the spawn action.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceShrinkerActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceShrinkerActionBuilder.java
index e2af72db31..3e4519bcc3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceShrinkerActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceShrinkerActionBuilder.java
@@ -162,12 +162,12 @@ public class ResourceShrinkerActionBuilder {
.getRunfilesSupport()
.getRunfilesArtifactsWithoutMiddlemen());
- commandLine.add("--aapt", sdk.getAapt().getExecutable());
+ commandLine.addExecPath("--aapt", sdk.getAapt().getExecutable());
- commandLine.add("--annotationJar", sdk.getAnnotationsJar());
+ commandLine.addExecPath("--annotationJar", sdk.getAnnotationsJar());
inputs.add(sdk.getAnnotationsJar());
- commandLine.add("--androidJar", sdk.getAndroidJar());
+ commandLine.addExecPath("--androidJar", sdk.getAndroidJar());
inputs.add(sdk.getAndroidJar());
if (!uncompressedExtensions.isEmpty()) {
@@ -194,24 +194,24 @@ public class ResourceShrinkerActionBuilder {
checkNotNull(primaryResources.getManifest());
checkNotNull(resourceApkOut);
- commandLine.add("--resources", resourceFilesZip);
+ commandLine.addExecPath("--resources", resourceFilesZip);
inputs.add(resourceFilesZip);
- commandLine.add("--shrunkJar", shrunkJar);
+ commandLine.addExecPath("--shrunkJar", shrunkJar);
inputs.add(shrunkJar);
- commandLine.add("--proguardMapping", proguardMapping);
+ commandLine.addExecPath("--proguardMapping", proguardMapping);
inputs.add(proguardMapping);
- commandLine.add("--rTxt", primaryResources.getRTxt());
+ commandLine.addExecPath("--rTxt", primaryResources.getRTxt());
inputs.add(primaryResources.getRTxt());
- commandLine.add("--primaryManifest", primaryResources.getManifest());
+ commandLine.addExecPath("--primaryManifest", primaryResources.getManifest());
inputs.add(primaryResources.getManifest());
ImmutableList<Artifact> dependencyManifests = getManifests(dependencyResources);
if (!dependencyManifests.isEmpty()) {
- commandLine.add("--dependencyManifest", dependencyManifests);
+ commandLine.addExecPaths("--dependencyManifest", dependencyManifests);
inputs.addAll(dependencyManifests);
}
@@ -219,13 +219,13 @@ public class ResourceShrinkerActionBuilder {
getResourcePackages(primaryResources, dependencyResources);
commandLine.add("--resourcePackages", VectorArg.of(resourcePackages).joinWith(","));
- commandLine.add("--shrunkResourceApk", resourceApkOut);
+ commandLine.addExecPath("--shrunkResourceApk", resourceApkOut);
outputs.add(resourceApkOut);
- commandLine.add("--shrunkResources", shrunkResourcesOut);
+ commandLine.addExecPath("--shrunkResources", shrunkResourcesOut);
outputs.add(shrunkResourcesOut);
- commandLine.add("--log", logOut);
+ commandLine.addExecPath("--log", logOut);
outputs.add(logOut);
ruleContext.registerAction(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/RobolectricResourceSymbolsActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/RobolectricResourceSymbolsActionBuilder.java
index ce177f4830..37e16721f8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/RobolectricResourceSymbolsActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/RobolectricResourceSymbolsActionBuilder.java
@@ -82,7 +82,7 @@ public class RobolectricResourceSymbolsActionBuilder {
List<Artifact> inputs = new ArrayList<>();
- builder.add("--androidJar", sdk.getAndroidJar());
+ builder.addExecPath("--androidJar", sdk.getAndroidJar());
inputs.add(sdk.getAndroidJar());
if (!Iterables.isEmpty(dependencies.getResources())) {
@@ -97,7 +97,7 @@ public class RobolectricResourceSymbolsActionBuilder {
Iterables.addAll(inputs, FluentIterable.from(dependencies.getResources())
.transformAndConcat(RESOURCE_CONTAINER_TO_ARTIFACTS));
- builder.add("--classJarOutput", classJarOut);
+ builder.addExecPath("--classJarOutput", classJarOut);
SpawnAction.Builder spawnActionBuilder = new SpawnAction.Builder();
if (OS.getCurrent() == OS.WINDOWS) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java
index 025f8babdc..dd11104253 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/DeployArchiveBuilder.java
@@ -170,7 +170,7 @@ public class DeployArchiveBuilder {
Compression compress, Artifact launcher) {
CustomCommandLine.Builder args = CustomCommandLine.builder();
- args.add("--output", outputJar);
+ args.addExecPath("--output", outputJar);
if (compress == Compression.COMPRESSED) {
args.add("--compression");
}
@@ -186,19 +186,19 @@ public class DeployArchiveBuilder {
if (buildInfoFiles != null) {
for (Artifact artifact : buildInfoFiles) {
- args.add("--build_info_file", artifact);
+ args.addExecPath("--build_info_file", artifact);
}
}
if (!includeBuildData) {
args.add("--exclude_build_data");
}
if (launcher != null) {
- args.add("--java_launcher", launcher);
+ args.addExecPath("--java_launcher", launcher);
}
- args.add("--classpath_resources", classpathResources);
+ args.addExecPaths("--classpath_resources", classpathResources);
if (runtimeClasspath != null) {
- args.add("--sources", ImmutableList.copyOf(runtimeClasspath));
+ args.addExecPaths("--sources", ImmutableList.copyOf(runtimeClasspath));
}
return args;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
index 67b9d9202e..3b75c46039 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
@@ -463,11 +463,11 @@ public final class JavaCompilationHelper {
javaToolchain.getJvmOptions())
.setCommandLine(
CustomCommandLine.builder()
- .add("--manifest_proto", manifestProto)
- .add("--class_jar", classJar)
- .add("--output_jar", genClassJar)
+ .addExecPath("--manifest_proto", manifestProto)
+ .addExecPath("--class_jar", classJar)
+ .addExecPath("--output_jar", genClassJar)
.add("--temp_dir")
- .add(tempDir(genClassJar))
+ .addPath(tempDir(genClassJar))
.build())
.setProgressMessage("Building genclass jar %s", genClassJar.prettyPrint())
.setMnemonic("JavaSourceJar")
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 d1ebd1bdd9..d60bca2bf0 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
@@ -425,13 +425,13 @@ public final class JavaCompileAction extends SpawnAction {
checkNotNull(javaBuilderJar);
CustomCommandLine.Builder builder =
- CustomCommandLine.builder().add(javaExecutable).add(javaBuilderJvmFlags);
+ CustomCommandLine.builder().addPath(javaExecutable).add(javaBuilderJvmFlags);
if (!instrumentationJars.isEmpty()) {
builder
- .add(
+ .addExecPaths(
"-cp",
VectorArg.of(
- ImmutableList.builder()
+ ImmutableList.<Artifact>builder()
.addAll(instrumentationJars)
.add(javaBuilderJar)
.build())
@@ -439,7 +439,7 @@ public final class JavaCompileAction extends SpawnAction {
.addDynamicString(javaBuilderMainClass);
} else {
// If there are no instrumentation jars, use simpler '-jar' option to launch JavaBuilder.
- builder.add("-jar", javaBuilderJar);
+ builder.addExecPath("-jar", javaBuilderJar);
}
return builder.build().arguments();
}
@@ -606,7 +606,7 @@ public final class JavaCompileAction extends SpawnAction {
// The actual params-file-based command line executed for a compile action.
CommandLine javaBuilderCommandLine =
CustomCommandLine.builder()
- .add(spawnCommandLineBase)
+ .addCustomMultiArgv(spawnCommandLineBase)
.addFormatted("@%s", paramFile.getExecPath())
.build();
@@ -664,37 +664,37 @@ public final class JavaCompileAction extends SpawnAction {
CustomCommandLine.Builder result = CustomCommandLine.builder();
- result.add("--classdir").add(classDirectory);
- result.add("--tempdir").add(tempDirectory);
+ result.add("--classdir").addPath(classDirectory);
+ result.add("--tempdir").addPath(tempDirectory);
if (outputJar != null) {
- result.add("--output", outputJar);
+ result.addExecPath("--output", outputJar);
}
if (sourceGenDirectory != null) {
- result.add("--sourcegendir").add(sourceGenDirectory);
+ result.add("--sourcegendir").addPath(sourceGenDirectory);
}
if (gensrcOutputJar != null) {
- result.add("--generated_sources_output", gensrcOutputJar);
+ result.addExecPath("--generated_sources_output", gensrcOutputJar);
}
if (manifestProtoOutput != null) {
- result.add("--output_manifest_proto", manifestProtoOutput);
+ result.addExecPath("--output_manifest_proto", manifestProtoOutput);
}
if (compressJar) {
result.add("--compress_jar");
}
if (outputDepsProto != null) {
- result.add("--output_deps_proto", outputDepsProto);
+ result.addExecPath("--output_deps_proto", outputDepsProto);
}
if (!extdirInputs.isEmpty()) {
- result.add("--extclasspath", extdirInputs);
+ result.addExecPaths("--extclasspath", extdirInputs);
}
if (!bootclasspathEntries.isEmpty()) {
- result.add("--bootclasspath", bootclasspathEntries);
+ result.addExecPaths("--bootclasspath", bootclasspathEntries);
}
if (!sourcePathEntries.isEmpty()) {
- result.add("--sourcepath", sourcePathEntries);
+ result.addExecPaths("--sourcepath", sourcePathEntries);
}
if (!processorPath.isEmpty()) {
- result.add("--processorpath", processorPath);
+ result.addExecPaths("--processorpath", processorPath);
}
if (!processorNames.isEmpty()) {
result.add("--processors", ImmutableList.copyOf(processorNames));
@@ -703,10 +703,10 @@ public final class JavaCompileAction extends SpawnAction {
result.add("--javacopts", ImmutableList.copyOf(processorFlags));
}
if (!sourceJars.isEmpty()) {
- result.add("--source_jars", ImmutableList.copyOf(sourceJars));
+ result.addExecPaths("--source_jars", ImmutableList.copyOf(sourceJars));
}
if (!sourceFiles.isEmpty()) {
- result.add("--sources", sourceFiles);
+ result.addExecPaths("--sources", sourceFiles);
}
if (!javacOpts.isEmpty()) {
result.add("--javacopts", ImmutableList.copyOf(javacOpts));
@@ -718,7 +718,7 @@ public final class JavaCompileAction extends SpawnAction {
result.add("--target_label");
if (targetLabel.getPackageIdentifier().getRepository().isDefault()
|| targetLabel.getPackageIdentifier().getRepository().isMain()) {
- result.add(targetLabel);
+ result.addLabel(targetLabel);
} else {
// @-prefixed strings will be assumed to be filenames and expanded by
// {@link JavaLibraryBuildRequest}, so add an extra &at; to escape it.
@@ -730,28 +730,28 @@ public final class JavaCompileAction extends SpawnAction {
}
if (!classpathEntries.isEmpty()) {
- result.add("--classpath", classpathEntries);
+ result.addExecPaths("--classpath", classpathEntries);
}
// strict_java_deps controls whether the mapping from jars to targets is
// written out and whether we try to minimize the compile-time classpath.
if (strictJavaDeps != BuildConfiguration.StrictDepsMode.OFF) {
result.add("--strict_java_deps", strictJavaDeps.toString());
- result.add(new JarsToTargetsArgv(classpathEntries, directJars));
+ result.addCustomMultiArgv(new JarsToTargetsArgv(classpathEntries, directJars));
if (configuration.getFragment(JavaConfiguration.class).getReduceJavaClasspath()
== JavaClasspathMode.JAVABUILDER) {
result.add("--reduce_classpath");
if (!compileTimeDependencyArtifacts.isEmpty()) {
- result.add("--deps_artifacts", compileTimeDependencyArtifacts);
+ result.addExecPaths("--deps_artifacts", compileTimeDependencyArtifacts);
}
}
}
if (metadata != null) {
result.add("--post_processor");
- result.add(JACOCO_INSTRUMENTATION_PROCESSOR, metadata);
- result.add(
+ result.addExecPath(JACOCO_INSTRUMENTATION_PROCESSOR, metadata);
+ result.addPath(
configuration
.getCoverageMetadataDirectory(targetLabel.getPackageIdentifier().getRepository())
.getExecPath());
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 562ce2f559..109a20004d 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
@@ -503,10 +503,10 @@ public class JavaHeaderCompileAction extends SpawnAction {
private CustomCommandLine.Builder getBaseArgs(JavaToolchainProvider javaToolchain) {
return CustomCommandLine.builder()
- .add(JavaCommon.getHostJavaExecutable(ruleContext))
+ .addPath(JavaCommon.getHostJavaExecutable(ruleContext))
.add("-Xverify:none")
.add(javaToolchain.getJvmOptions())
- .add("-jar", javaToolchain.getHeaderCompiler());
+ .addExecPath("-jar", javaToolchain.getHeaderCompiler());
}
/**
@@ -515,20 +515,20 @@ public class JavaHeaderCompileAction extends SpawnAction {
*/
private CustomCommandLine.Builder baseCommandLine(
CustomCommandLine.Builder result, NestedSet<Artifact> classpathEntries) {
- result.add("--output", outputJar);
+ result.addExecPath("--output", outputJar);
if (outputDepsProto != null) {
- result.add("--output_deps", outputDepsProto);
+ result.addExecPath("--output_deps", outputDepsProto);
}
- result.add("--temp_dir").add(tempDirectory);
+ result.add("--temp_dir").addPath(tempDirectory);
- result.add("--bootclasspath", bootclasspathEntries);
+ result.addExecPaths("--bootclasspath", bootclasspathEntries);
- result.add("--sources", sourceFiles);
+ result.addExecPaths("--sources", sourceFiles);
if (!sourceJars.isEmpty()) {
- result.add("--source_jars", ImmutableList.copyOf(sourceJars));
+ result.addExecPaths("--source_jars", ImmutableList.copyOf(sourceJars));
}
result.add("--javacopts", javacOpts);
@@ -540,14 +540,14 @@ public class JavaHeaderCompileAction extends SpawnAction {
result.add("--target_label");
if (targetLabel.getPackageIdentifier().getRepository().isDefault()
|| targetLabel.getPackageIdentifier().getRepository().isMain()) {
- result.add(targetLabel);
+ result.addLabel(targetLabel);
} else {
// @-prefixed strings will be assumed to be params filenames and expanded,
// so add an extra @ to escape it.
result.addWithPrefix("@", targetLabel);
}
}
- result.add("--classpath", classpathEntries);
+ result.addExecPaths("--classpath", classpathEntries);
return result;
}
@@ -562,12 +562,13 @@ public class JavaHeaderCompileAction extends SpawnAction {
result.add("--javacopts", ImmutableList.copyOf(processorFlags));
}
if (!processorPath.isEmpty()) {
- result.add("--processorpath", processorPath);
+ result.addExecPaths("--processorpath", processorPath);
}
if (strictJavaDeps != BuildConfiguration.StrictDepsMode.OFF) {
- result.add(new JavaCompileAction.JarsToTargetsArgv(classpathEntries, directJars));
+ result.addCustomMultiArgv(
+ new JavaCompileAction.JarsToTargetsArgv(classpathEntries, directJars));
if (!compileTimeDependencyArtifacts.isEmpty()) {
- result.add("--deps_artifacts", compileTimeDependencyArtifacts);
+ result.addExecPaths("--deps_artifacts", compileTimeDependencyArtifacts);
}
}
return result.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/OneVersionCheckActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/OneVersionCheckActionBuilder.java
index 57ff2e2ae5..eeaede26fc 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/OneVersionCheckActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/OneVersionCheckActionBuilder.java
@@ -89,12 +89,12 @@ public final class OneVersionCheckActionBuilder {
CustomCommandLine.Builder oneVersionArgsBuilder =
CustomCommandLine.builder()
- .add("--output", outputArtifact)
- .add("--whitelist", oneVersionWhitelist);
+ .addExecPath("--output", outputArtifact)
+ .addExecPath("--whitelist", oneVersionWhitelist);
if (enforcementLevel == OneVersionEnforcementLevel.WARNING) {
oneVersionArgsBuilder.add("--succeed_on_found_violations");
}
- oneVersionArgsBuilder.add(new OneVersionJarMapArgv(jarsToCheck));
+ oneVersionArgsBuilder.addCustomMultiArgv(new OneVersionJarMapArgv(jarsToCheck));
CustomCommandLine oneVersionArgs = oneVersionArgsBuilder.build();
ruleContext.registerAction(
new SpawnAction.Builder()
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 cc2aaf6822..af7d5968d3 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
@@ -104,9 +104,9 @@ public class ResourceJarActionBuilder {
.add("--normalize")
.add("--dont_change_compression")
.add("--exclude_build_data")
- .add("--output", outputJar);
+ .addExecPath("--output", outputJar);
if (!resourceJars.isEmpty()) {
- command.add("--sources", resourceJars);
+ command.addExecPaths("--sources", resourceJars);
}
if (!resources.isEmpty() || !messages.isEmpty()) {
command.add("--resources");
@@ -119,7 +119,7 @@ public class ResourceJarActionBuilder {
}
}
if (!classpathResources.isEmpty()) {
- command.add("--classpath_resources", classpathResources);
+ command.addExecPaths("--classpath_resources", classpathResources);
}
// TODO(b/37444705): remove this logic and always call useParameterFile once the bug is fixed
// Most resource jar actions are very small and expanding the argument list for
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/SingleJarActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/SingleJarActionBuilder.java
index 10a06eae07..8b3e64c7a4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/SingleJarActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/SingleJarActionBuilder.java
@@ -92,9 +92,9 @@ public final class SingleJarActionBuilder {
private static CommandLine sourceJarCommandLine(Artifact outputJar,
Map<PathFragment, Artifact> resources, Iterable<Artifact> resourceJars) {
CustomCommandLine.Builder args = CustomCommandLine.builder();
- args.add("--output", outputJar);
+ args.addExecPath("--output", outputJar);
args.add(SOURCE_JAR_COMMAND_LINE_ARGS);
- args.add("--sources", ImmutableList.copyOf(resourceJars));
+ args.addExecPaths("--sources", ImmutableList.copyOf(resourceJars));
if (!resources.isEmpty()) {
args.add("--resources");
for (Map.Entry<PathFragment, Artifact> resource : resources.entrySet()) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStubBinary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStubBinary.java
index 5880a7f280..70556f01ce 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStubBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStubBinary.java
@@ -156,7 +156,7 @@ public class AppleStubBinary implements RuleConfiguredTargetFactory {
new Builder()
.add("/bin/cp")
.addDynamicString(resolveXcenvBasedPath(ruleContext, platform))
- .add(ImmutableList.of(outputBinary))
+ .addExecPaths(ImmutableList.of(outputBinary))
.build();
ruleContext.registerAction(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
index d04c630cc1..805f90f68f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
@@ -267,17 +267,16 @@ final class BundleSupport {
Artifact storyboardInput) {
CustomCommandLine.Builder commandLine =
CustomCommandLine.builder()
- .add(zipOutput.getExecPath())
+ .addPath(zipOutput.getExecPath())
.addDynamicString(archiveRoot)
- .add("--minimum-deployment-target")
- .add(bundling.getMinimumOsVersion())
+ .add("--minimum-deployment-target", bundling.getMinimumOsVersion().toString())
.add("--module", ruleContext.getLabel().getName());
for (TargetDeviceFamily targetDeviceFamily : targetDeviceFamiliesForResources()) {
commandLine.add("--target-device", targetDeviceFamily.name().toLowerCase(Locale.US));
}
- return commandLine.add(storyboardInput.getExecPath()).build();
+ return commandLine.addPath(storyboardInput.getExecPath()).build();
}
private void registerMomczipActions(ObjcProvider objcProvider) {
@@ -293,7 +292,7 @@ final class BundleSupport {
.addInputs(datamodel.getInputs())
.setCommandLine(
CustomCommandLine.builder()
- .add(outputZip)
+ .addExecPath(outputZip)
.addDynamicString(datamodel.archiveRootForMomczip())
.addDynamicString("-XD_MOMC_SDKROOT=" + AppleToolchain.sdkDir())
.addDynamicString(
@@ -304,7 +303,7 @@ final class BundleSupport {
.getMultiArchPlatform(PlatformType.IOS)
.getLowerCaseNameInPlist())
.add("-XD_MOMC_TARGET_VERSION=10.6")
- .add(datamodel.getContainer())
+ .addPath(datamodel.getContainer())
.build())
.build(ruleContext));
}
@@ -340,9 +339,9 @@ final class BundleSupport {
CustomCommandLine.builder()
.add("-convert")
.add("binary1")
- .add("-o", bundled)
+ .addExecPath("-o", bundled)
.add("--")
- .add(strings.getExecPath())
+ .addPath(strings.getExecPath())
.build())
.addInput(strings)
.addInput(CompilationSupport.xcrunwrapper(ruleContext).getExecutable())
@@ -436,13 +435,12 @@ final class BundleSupport {
}
CustomCommandLine.Builder commandLine =
CustomCommandLine.builder()
- .add(zipOutput.getExecPath())
+ .addPath(zipOutput.getExecPath())
.add(
"--platform",
appleConfiguration.getMultiArchPlatform(platformType).getLowerCaseNameInPlist())
- .add("--output-partial-info-plist", partialInfoPlist)
- .add("--minimum-deployment-target")
- .add(bundling.getMinimumOsVersion());
+ .addExecPath("--output-partial-info-plist", partialInfoPlist)
+ .add("--minimum-deployment-target", bundling.getMinimumOsVersion().toString());
for (TargetDeviceFamily targetDeviceFamily : targetDeviceFamiliesForResources()) {
commandLine.add("--target-device", targetDeviceFamily.name().toLowerCase(Locale.US));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
index edfc4eb343..9882ea4a0d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
@@ -882,7 +882,7 @@ public abstract class CompilationSupport {
treeObjFiles.add(objFile);
objFilesToLinkParam.addExpandedTreeArtifactExecPaths(objFile);
} else {
- objFilesToLinkParam.add(objFile.getExecPath());
+ objFilesToLinkParam.addPath(objFile.getExecPath());
}
}
@@ -1074,15 +1074,16 @@ public abstract class CompilationSupport {
CustomCommandLine commandLine =
CustomCommandLine.builder()
- .add("--input_archive", j2objcArchive)
- .add("--output_archive", prunedJ2ObjcArchive)
- .add("--dummy_archive", dummyArchive)
- .add("--xcrunwrapper", xcrunwrapper(ruleContext).getExecutable())
- .add(
+ .addExecPath("--input_archive", j2objcArchive)
+ .addExecPath("--output_archive", prunedJ2ObjcArchive)
+ .addExecPath("--dummy_archive", dummyArchive)
+ .addExecPath("--xcrunwrapper", xcrunwrapper(ruleContext).getExecutable())
+ .addExecPaths(
"--dependency_mapping_files",
VectorArg.of(j2ObjcDependencyMappingFiles).joinWith(","))
- .add("--header_mapping_files", VectorArg.of(j2ObjcHeaderMappingFiles).joinWith(","))
- .add(
+ .addExecPaths(
+ "--header_mapping_files", VectorArg.of(j2ObjcHeaderMappingFiles).joinWith(","))
+ .addExecPaths(
"--archive_source_mapping_files",
VectorArg.of(j2ObjcArchiveSourceMappingFiles).joinWith(","))
.add("--entry_classes")
@@ -1168,8 +1169,8 @@ public abstract class CompilationSupport {
return CustomCommandLine.builder()
.add(STRIP)
.add(extraFlags)
- .add("-o", strippedArtifact)
- .add(unstrippedArtifact.getExecPath())
+ .addExecPath("-o", strippedArtifact)
+ .addPath(unstrippedArtifact.getExecPath())
.build();
}
@@ -1396,7 +1397,7 @@ public abstract class CompilationSupport {
XcodeConfig.getXcodeVersion(ruleContext).toStringWithMinimumComponents(2))
.add("--");
for (ObjcHeaderThinningInfo info : infos) {
- cmdLine.add(
+ cmdLine.addPaths(
VectorArg.of(
ImmutableList.of(
info.sourceFile.getExecPath(), info.headersListFile.getExecPath()))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
index 4bb491d284..0d018df6d2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
@@ -482,18 +482,19 @@ public class J2ObjcAspect extends NativeAspectClass implements ConfiguredAspectF
argBuilder.add("--java", javaExecutable.getPathString());
Artifact j2ObjcDeployJar = ruleContext.getPrerequisiteArtifact("$j2objc", Mode.HOST);
- argBuilder.add("--j2objc", j2ObjcDeployJar);
+ argBuilder.addExecPath("--j2objc", j2ObjcDeployJar);
argBuilder.add("--main_class").add("com.google.devtools.j2objc.J2ObjC");
- argBuilder.add("--objc_file_path").add(j2ObjcSource.getObjcFilePath());
+ argBuilder.add("--objc_file_path").addPath(j2ObjcSource.getObjcFilePath());
Artifact outputDependencyMappingFile = j2ObjcOutputDependencyMappingFile(ruleContext);
- argBuilder.add("--output_dependency_mapping_file", outputDependencyMappingFile);
+ argBuilder.addExecPath("--output_dependency_mapping_file", outputDependencyMappingFile);
ImmutableList.Builder<Artifact> sourceJarOutputFiles = ImmutableList.builder();
if (!Iterables.isEmpty(sourceJars)) {
sourceJarOutputFiles.addAll(sourceJarOutputs(ruleContext));
- argBuilder.add("--src_jars", VectorArg.of(ImmutableList.copyOf(sourceJars)).joinWith(","));
+ argBuilder.addExecPaths(
+ "--src_jars", VectorArg.of(ImmutableList.copyOf(sourceJars)).joinWith(","));
argBuilder.add(sourceJarFlags(ruleContext));
}
@@ -505,44 +506,45 @@ public class J2ObjcAspect extends NativeAspectClass implements ConfiguredAspectF
NestedSet<Artifact> depsHeaderMappingFiles =
depJ2ObjcMappingFileProvider.getHeaderMappingFiles();
if (!depsHeaderMappingFiles.isEmpty()) {
- argBuilder.add("--header-mapping", VectorArg.of(depsHeaderMappingFiles).joinWith(","));
+ argBuilder.addExecPaths(
+ "--header-mapping", VectorArg.of(depsHeaderMappingFiles).joinWith(","));
}
boolean experimentalJ2ObjcHeaderMap =
ruleContext.getFragment(J2ObjcConfiguration.class).experimentalJ2ObjcHeaderMap();
Artifact outputHeaderMappingFile = j2ObjcOutputHeaderMappingFile(ruleContext);
if (!experimentalJ2ObjcHeaderMap) {
- argBuilder.add("--output-header-mapping", outputHeaderMappingFile);
+ argBuilder.addExecPath("--output-header-mapping", outputHeaderMappingFile);
}
NestedSet<Artifact> depsClassMappingFiles = depJ2ObjcMappingFileProvider.getClassMappingFiles();
if (!depsClassMappingFiles.isEmpty()) {
- argBuilder.add("--mapping", VectorArg.of(depsClassMappingFiles).joinWith(","));
+ argBuilder.addExecPaths("--mapping", VectorArg.of(depsClassMappingFiles).joinWith(","));
}
Artifact archiveSourceMappingFile = j2ObjcOutputArchiveSourceMappingFile(ruleContext);
- argBuilder.add("--output_archive_source_mapping_file", archiveSourceMappingFile);
+ argBuilder.addExecPath("--output_archive_source_mapping_file", archiveSourceMappingFile);
Artifact compiledLibrary = ObjcRuleClasses.j2objcIntermediateArtifacts(ruleContext).archive();
- argBuilder.add("--compiled_archive_file_path", compiledLibrary);
+ argBuilder.addExecPath("--compiled_archive_file_path", compiledLibrary);
Artifact bootclasspathJar = ruleContext.getPrerequisiteArtifact("$jre_emul_jar", Mode.HOST);
argBuilder.addFormatted("-Xbootclasspath:%s", bootclasspathJar);
Artifact deadCodeReport = ruleContext.getPrerequisiteArtifact(":dead_code_report", Mode.HOST);
if (deadCodeReport != null) {
- argBuilder.add("--dead-code-report", deadCodeReport);
+ argBuilder.addExecPath("--dead-code-report", deadCodeReport);
}
- argBuilder.add("-d").add(j2ObjcSource.getObjcFilePath());
+ argBuilder.add("-d").addPath(j2ObjcSource.getObjcFilePath());
NestedSet<Artifact> compileTimeJars =
compArgsProvider.getRecursiveJavaCompilationArgs().getCompileTimeJars();
if (!compileTimeJars.isEmpty()) {
- argBuilder.add("-classpath", VectorArg.of(compileTimeJars).joinWith(":"));
+ argBuilder.addExecPaths("-classpath", VectorArg.of(compileTimeJars).joinWith(":"));
}
- argBuilder.add(ImmutableList.copyOf(sources));
+ argBuilder.addExecPaths(ImmutableList.copyOf(sources));
Artifact paramFile = j2ObjcOutputParamFile(ruleContext);
ruleContext.registerAction(new ParameterFileWriteAction(
@@ -585,14 +587,14 @@ public class J2ObjcAspect extends NativeAspectClass implements ConfiguredAspectF
if (experimentalJ2ObjcHeaderMap) {
CustomCommandLine.Builder headerMapCommandLine = CustomCommandLine.builder();
if (!Iterables.isEmpty(sources)) {
- headerMapCommandLine.add(
+ headerMapCommandLine.addExecPaths(
"--source_files", VectorArg.of(ImmutableList.copyOf(sources)).joinWith(","));
}
if (!Iterables.isEmpty(sourceJars)) {
- headerMapCommandLine.add(
+ headerMapCommandLine.addExecPaths(
"--source_jars", VectorArg.of(ImmutableList.copyOf(sourceJars)).joinWith(","));
}
- headerMapCommandLine.add("--output_mapping_file", outputHeaderMappingFile);
+ headerMapCommandLine.addExecPath("--output_mapping_file", outputHeaderMappingFile);
ruleContext.registerAction(new SpawnAction.Builder()
.setMnemonic("GenerateJ2objcHeaderMap")
.setExecutable(ruleContext.getPrerequisiteArtifact("$j2objc_header_map", Mode.HOST))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
index 696cb4a726..b5e312e7c5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
@@ -303,13 +303,13 @@ public class LegacyCompilationSupport extends CompilationSupport {
.add(ImmutableList.copyOf(compileFlagsForClang(appleConfiguration)))
.add(commonLinkAndCompileFlagsForClang(objcProvider, objcConfiguration, appleConfiguration))
.add(objcConfiguration.getCoptsForCompilationMode())
- .add(
+ .addPaths(
VectorArg.of(ObjcCommon.userHeaderSearchPaths(objcProvider, buildConfiguration))
.beforeEach("-iquote"))
- .add(VectorArg.of(ImmutableList.copyOf(pchFile.asSet())).beforeEach("-include"))
- .add(VectorArg.of(ImmutableList.copyOf(priorityHeaders)).beforeEach("-I"))
- .add(VectorArg.of(objcProvider.get(INCLUDE)).beforeEach("-I"))
- .add(VectorArg.of(objcProvider.get(INCLUDE_SYSTEM)).beforeEach("-isystem"))
+ .addExecPaths(VectorArg.of(ImmutableList.copyOf(pchFile.asSet())).beforeEach("-include"))
+ .addPaths(VectorArg.of(ImmutableList.copyOf(priorityHeaders)).beforeEach("-I"))
+ .addPaths(VectorArg.of(objcProvider.get(INCLUDE)).beforeEach("-I"))
+ .addPaths(VectorArg.of(objcProvider.get(INCLUDE_SYSTEM)).beforeEach("-isystem"))
.add(ImmutableList.copyOf(otherFlags))
.add(VectorArg.of(objcProvider.get(DEFINE)).formatEach("-D%s"))
.add(coverageFlags)
@@ -320,7 +320,7 @@ public class LegacyCompilationSupport extends CompilationSupport {
if (sourceFile.isTreeArtifact()) {
commandLine.addPlaceholderTreeArtifactExecPath(sourceFile);
} else {
- commandLine.add(sourceFile.getExecPath());
+ commandLine.addPath(sourceFile.getExecPath());
}
// Add output object file arguments.
@@ -328,12 +328,12 @@ public class LegacyCompilationSupport extends CompilationSupport {
if (objFile.isTreeArtifact()) {
commandLine.addPlaceholderTreeArtifactExecPath(objFile);
} else {
- commandLine.add(objFile.getExecPath());
+ commandLine.addPath(objFile.getExecPath());
}
// Add Dotd file arguments.
if (dotdFile.isPresent()) {
- commandLine.add("-MD").add("-MF", dotdFile.get());
+ commandLine.add("-MD").addExecPath("-MF", dotdFile.get());
}
// Add module map arguments.
@@ -348,7 +348,7 @@ public class LegacyCompilationSupport extends CompilationSupport {
// TODO(bazel-team): Use -fmodule-map-file when Xcode 6 support is dropped.
commandLine
.add("-iquote")
- .add(moduleMap.get().getArtifact().getExecPath().getParentDirectory())
+ .addPath(moduleMap.get().getArtifact().getExecPath().getParentDirectory())
.addFormatted("-fmodule-name=%s", moduleMap.get().getName());
}
@@ -510,10 +510,10 @@ public class LegacyCompilationSupport extends CompilationSupport {
.setCommandLine(
new CustomCommandLine.Builder()
.add("-static")
- .add("-filelist", objList)
+ .addExecPath("-filelist", objList)
.add("-arch_only", appleConfiguration.getSingleArchitecture())
.add("-syslibroot", AppleToolchain.sdkDir())
- .add("-o", archive)
+ .addExecPath("-o", archive)
.build())
.addInputs(objFiles)
.addInput(objList)
@@ -535,8 +535,8 @@ public class LegacyCompilationSupport extends CompilationSupport {
.add("-static")
.add("-arch_only", appleConfiguration.getSingleArchitecture())
.add("-syslibroot", AppleToolchain.sdkDir())
- .add("-o", outputArchive)
- .add(ImmutableList.copyOf(inputArtifacts))
+ .addExecPath("-o", outputArchive)
+ .addExecPaths(ImmutableList.copyOf(inputArtifacts))
.build())
.addInputs(inputArtifacts)
.addOutput(outputArchive)
@@ -667,7 +667,8 @@ public class LegacyCompilationSupport extends CompilationSupport {
ImmutableList<String> libraryNames = libraryNames(objcProvider);
CustomCommandLine.Builder commandLine =
- CustomCommandLine.builder().add(xcrunwrapper(ruleContext).getExecutable().getExecPath());
+ CustomCommandLine.builder()
+ .addPath(xcrunwrapper(ruleContext).getExecutable().getExecPath());
if (objcProvider.is(USES_CPP)) {
commandLine
.add(CLANG_PLUSPLUS)
@@ -711,7 +712,7 @@ public class LegacyCompilationSupport extends CompilationSupport {
.add("-Xlinker")
.add("-bitcode_symbol_map")
.add("-Xlinker")
- .add(bitcodeSymbolMap.get());
+ .addExecPath(bitcodeSymbolMap.get());
}
commandLine
@@ -735,8 +736,8 @@ public class LegacyCompilationSupport extends CompilationSupport {
VectorArg.of(SdkFramework.names(objcProvider.get(WEAK_SDK_FRAMEWORK)))
.beforeEach("-weak_framework"))
.add(VectorArg.of(libraryNames).formatEach("-l%s"))
- .add("-o", linkedBinary)
- .add(VectorArg.of(forceLinkArtifacts).beforeEach("-force_load"))
+ .addExecPath("-o", linkedBinary)
+ .addExecPaths(VectorArg.of(forceLinkArtifacts).beforeEach("-force_load"))
.add(ImmutableList.copyOf(extraLinkArgs))
.add(objcProvider.get(ObjcProvider.LINKOPT));
@@ -753,7 +754,7 @@ public class LegacyCompilationSupport extends CompilationSupport {
}
if (linkmap.isPresent()) {
- commandLine.add("-Xlinker -map").add("-Xlinker ", linkmap.get().getExecPath());
+ commandLine.add("-Xlinker -map").addPath("-Xlinker ", linkmap.get().getExecPath());
}
// Call to dsymutil for debug symbol generation must happen in the link action.
@@ -764,10 +765,10 @@ public class LegacyCompilationSupport extends CompilationSupport {
PathFragment dsymPath = FileSystemUtils.removeExtension(dsymBundleZip.get().getExecPath());
commandLine
.add("&&")
- .add(xcrunwrapper(ruleContext).getExecutable().getExecPath())
+ .addPath(xcrunwrapper(ruleContext).getExecutable().getExecPath())
.add(DSYMUTIL)
- .add(linkedBinary)
- .add("-o", dsymPath)
+ .addExecPath(linkedBinary)
+ .addPath("-o", dsymPath)
.addDynamicString(
"&& zipped_bundle=${PWD}/" + dsymBundleZip.get().getShellEscapedExecPathString())
.addDynamicString("&& cd " + dsymPath)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/LipoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/LipoSupport.java
index 762137f685..20471b3e22 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/LipoSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/LipoSupport.java
@@ -56,8 +56,8 @@ public class LipoSupport {
.setCommandLine(
CustomCommandLine.builder()
.add(ObjcRuleClasses.LIPO)
- .add("-create", inputBinaries)
- .add("-o", outputBinary)
+ .addExecPaths("-create", inputBinaries)
+ .addExecPath("-o", outputBinary)
.build())
.build(ruleContext));
} else {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java
index d7322d0f8e..abaed048bb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java
@@ -470,7 +470,7 @@ final class ProtobufSupport {
private CustomCommandLine getGenerationCommandLine(Artifact protoInputsFile) {
return new Builder()
.add("--input-file-list")
- .add(protoInputsFile)
+ .addExecPath(protoInputsFile)
.add("--output-dir")
.addDynamicString(getWorkspaceRelativeOutputDir().getSafePathString())
.add("--force")
@@ -478,7 +478,7 @@ final class ProtobufSupport {
.addDynamicString(getGenfilesPathString())
.add("--proto-root-dir")
.add(".")
- .add(VectorArg.of(portableProtoFilters).beforeEach("--config"))
+ .addExecPaths(VectorArg.of(portableProtoFilters).beforeEach("--config"))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java
index c7c6f8ddee..67dd444271 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java
@@ -156,16 +156,18 @@ final class ProtocolBuffers2Support {
private CustomCommandLine getGenerationCommandLine() {
CustomCommandLine.Builder commandLineBuilder =
new CustomCommandLine.Builder()
- .add(attributes.getProtoCompiler())
+ .addExecPath(attributes.getProtoCompiler())
.add("--input-file-list")
- .add(getProtoInputsFile())
+ .addExecPath(getProtoInputsFile())
.add("--output-dir")
.addDynamicString(getWorkspaceRelativeOutputDir().getSafePathString())
.add("--working-dir")
.add(".");
if (attributes.getOptionsFile().isPresent()) {
- commandLineBuilder.add("--compiler-options-path").add(attributes.getOptionsFile().get());
+ commandLineBuilder
+ .add("--compiler-options-path")
+ .addExecPath(attributes.getOptionsFile().get());
}
if (attributes.usesObjcHeaderNames()) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
index 1f2d9da01c..2a2145cfcb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
@@ -1029,12 +1029,12 @@ public final class ReleaseBundlingSupport {
commandLine
.add("--output_zip_path")
- .add(intermediateArtifacts.swiftFrameworksFileZip().getExecPath())
+ .addPath(intermediateArtifacts.swiftFrameworksFileZip().getExecPath())
.add("--bundle_path")
.add("Frameworks")
.add("--platform")
.addDynamicString(platform.getLowerCaseNameInPlist())
- .add("--scan-executable", combinedArchBinary);
+ .addExecPath("--scan-executable", combinedArchBinary);
ruleContext.registerAction(
ObjcRuleClasses.spawnAppleEnvActionBuilder(appleConfiguration, platform)
@@ -1061,12 +1061,12 @@ public final class ReleaseBundlingSupport {
commandLine
.add("--output_zip_path")
- .add(intermediateArtifacts.swiftSupportZip().getExecPath())
+ .addPath(intermediateArtifacts.swiftSupportZip().getExecPath())
.add("--bundle_path")
.addDynamicString("SwiftSupport/" + platform.getLowerCaseNameInPlist())
.add("--platform")
.addDynamicString(platform.getLowerCaseNameInPlist())
- .add("--scan-executable", combinedArchBinary);
+ .addExecPath("--scan-executable", combinedArchBinary);
ruleContext.registerAction(
ObjcRuleClasses.spawnAppleEnvActionBuilder(configuration, platform)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
index f7e934a1dd..86415309d5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
@@ -298,7 +298,7 @@ public class ProtoCompileActionBuilder {
// and thus we have to deal with "$xx_plugin" and "xx_plugin".
result.addFormatted(
"--plugin=protoc-gen-%s=%s", langPrefix, langPluginTarget.getExecutable().getExecPath());
- result.add(new LazyLangPluginFlag(langPrefix, langPluginParameter1));
+ result.addLazyString(new LazyLangPluginFlag(langPrefix, langPluginParameter1));
}
result.add(ruleContext.getFragment(ProtoConfiguration.class).protocOpts());
@@ -306,7 +306,7 @@ public class ProtoCompileActionBuilder {
boolean areDepsStrict = areDepsStrict(ruleContext);
// Add include maps
- result.add(
+ result.addCustomMultiArgv(
new ProtoCommandLineArgv(
areDepsStrict ? supportData.getProtosInDirectDeps() : null,
supportData.getTransitiveImports()));
@@ -318,7 +318,7 @@ public class ProtoCompileActionBuilder {
}
for (Artifact src : supportData.getDirectProtoSources()) {
- result.add(src.getRootRelativePath());
+ result.addPath(src.getRootRelativePath());
}
if (!hasServices) {
@@ -570,7 +570,7 @@ public class ProtoCompileActionBuilder {
ProtoLangToolchainProvider toolchain = invocation.toolchain;
- cmdLine.add(
+ cmdLine.addLazyString(
new LazyCommandLineExpansion(
toolchain.commandLine(),
ImmutableMap.of(
@@ -589,14 +589,14 @@ public class ProtoCompileActionBuilder {
cmdLine.add(protocOpts);
// Add include maps
- cmdLine.add(new ProtoCommandLineArgv(protosInDirectDeps, transitiveSources));
+ cmdLine.addCustomMultiArgv(new ProtoCommandLineArgv(protosInDirectDeps, transitiveSources));
if (protosInDirectDeps != null) {
cmdLine.addFormatted(STRICT_DEPS_FLAG_TEMPLATE, ruleLabel);
}
for (Artifact src : protosToCompile) {
- cmdLine.add(src.getExecPath());
+ cmdLine.addPath(src.getExecPath());
}
if (!allowServices) {