diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java | 44 |
1 files changed, 25 insertions, 19 deletions
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 0329afa5b3..56f171cc34 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 @@ -50,6 +50,7 @@ import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.actions.CommandLine; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; +import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg; import com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate; import com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate.OutputPathMapper; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; @@ -302,14 +303,15 @@ public class LegacyCompilationSupport extends CompilationSupport { .add(ImmutableList.copyOf(compileFlagsForClang(appleConfiguration))) .add(commonLinkAndCompileFlagsForClang(objcProvider, objcConfiguration, appleConfiguration)) .add(objcConfiguration.getCoptsForCompilationMode()) - .addBeforeEachPath( - "-iquote", ObjcCommon.userHeaderSearchPaths(objcProvider, buildConfiguration)) - .addBeforeEachExecPath("-include", ImmutableList.copyOf(pchFile.asSet())) - .addBeforeEachPath("-I", ImmutableList.copyOf(priorityHeaders)) - .addBeforeEachPath("-I", objcProvider.get(INCLUDE)) - .addBeforeEachPath("-isystem", objcProvider.get(INCLUDE_SYSTEM)) + .add( + 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")) .add(ImmutableList.copyOf(otherFlags)) - .addFormatEach("-D%s", objcProvider.get(DEFINE)) + .add(VectorArg.of(objcProvider.get(DEFINE)).formatEach("-D%s")) .add(coverageFlags) .add(ImmutableList.copyOf(getCompileRuleCopts())); @@ -318,7 +320,7 @@ public class LegacyCompilationSupport extends CompilationSupport { if (sourceFile.isTreeArtifact()) { commandLine.addPlaceholderTreeArtifactExecPath(sourceFile); } else { - commandLine.addPath(sourceFile.getExecPath()); + commandLine.add(sourceFile.getExecPath()); } // Add output object file arguments. @@ -326,12 +328,12 @@ public class LegacyCompilationSupport extends CompilationSupport { if (objFile.isTreeArtifact()) { commandLine.addPlaceholderTreeArtifactExecPath(objFile); } else { - commandLine.addPath(objFile.getExecPath()); + commandLine.add(objFile.getExecPath()); } // Add Dotd file arguments. if (dotdFile.isPresent()) { - commandLine.add("-MD").addExecPath("-MF", dotdFile.get()); + commandLine.add("-MD").add("-MF", dotdFile.get()); } // Add module map arguments. @@ -535,7 +537,7 @@ public class LegacyCompilationSupport extends CompilationSupport { .add(AppleToolchain.sdkDir()) .add("-o") .add(outputArchive.getExecPathString()) - .addExecPaths(ImmutableList.copyOf(inputArtifacts)) + .add(ImmutableList.copyOf(inputArtifacts)) .build()) .addInputs(inputArtifacts) .addOutput(outputArchive) @@ -665,8 +667,8 @@ public class LegacyCompilationSupport extends CompilationSupport { Optional<Artifact> bitcodeSymbolMap) { ImmutableList<String> libraryNames = libraryNames(objcProvider); - CustomCommandLine.Builder commandLine = CustomCommandLine.builder() - .addPath(xcrunwrapper(ruleContext).getExecutable().getExecPath()); + CustomCommandLine.Builder commandLine = + CustomCommandLine.builder().add(xcrunwrapper(ruleContext).getExecutable().getExecPath()); if (objcProvider.is(USES_CPP)) { commandLine .add(CLANG_PLUSPLUS) @@ -727,11 +729,15 @@ public class LegacyCompilationSupport extends CompilationSupport { .add("@executable_path/Frameworks") .add("-fobjc-link-runtime") .add(DEFAULT_LINKER_FLAGS) - .addBeforeEach("-framework", ImmutableList.copyOf(frameworkNames(objcProvider))) - .addBeforeEach("-weak_framework", SdkFramework.names(objcProvider.get(WEAK_SDK_FRAMEWORK))) - .addFormatEach("-l%s", libraryNames) - .addExecPath("-o", linkedBinary) - .addBeforeEachExecPath("-force_load", forceLinkArtifacts) + .add( + VectorArg.of(ImmutableList.copyOf(frameworkNames(objcProvider))) + .beforeEach("-framework")) + .add( + 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")) .add(ImmutableList.copyOf(extraLinkArgs)) .add(objcProvider.get(ObjcProvider.LINKOPT)); @@ -761,7 +767,7 @@ public class LegacyCompilationSupport extends CompilationSupport { PathFragment dsymPath = FileSystemUtils.removeExtension(dsymBundleZip.get().getExecPath()); commandLine .add("&&") - .addPath(xcrunwrapper(ruleContext).getExecutable().getExecPath()) + .add(xcrunwrapper(ruleContext).getExecutable().getExecPath()) .add(DSYMUTIL) .add(linkedBinary.getExecPathString()) .add("-o " + dsymPath) |