aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
diff options
context:
space:
mode:
authorGravatar Peter Schmitt <schmitt@google.com>2015-05-20 20:24:57 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-05-21 09:50:42 +0000
commit828c5441b0cb4af1435c9c20d21a5ebc6da83ec7 (patch)
tree6ce8789d35a4f14112956ccf5ffc5d31fa3fbfbb /src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
parentb66898e44d79ef67f856eaeae711bb461564a3c1 (diff)
*** Reason for rollback *** This was accidentally submitted (why did tappresubmit not complain about no LGTM?!) *** Original change description *** Allow objc_{library,binary} to depend on cc_library. This is an early version of support for this feature, likely still missing a number of edge cases. However the basic functionality should work. To allow a dependency from objc to cc, the following flags will have to be passed to bazel: --experimental_enable_objc_cc_deps --experimental_disable_java --cpu=ios_i386 --crosstool_top=//tools/objc/crosstool:crosstool The feature is also compatible with --ios_multi_cpus, with the familiar values f... *** -- MOS_MIGRATED_REVID=94118959
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java22
1 files changed, 4 insertions, 18 deletions
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 803090bf87..2c8220b203 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
@@ -49,7 +49,6 @@ import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.FileWriteAction;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
-import com.google.devtools.build.lib.rules.cpp.LinkerInputs;
import com.google.devtools.build.lib.rules.objc.ObjcCommon.CompilationAttributes;
import com.google.devtools.build.lib.rules.objc.XcodeProvider.Builder;
import com.google.devtools.build.lib.shell.ShellUtils;
@@ -79,8 +78,6 @@ final class CompilationSupport {
static final ImmutableList<String> CLANG_COVERAGE_FLAGS =
ImmutableList.of("-fprofile-arcs", "-ftest-coverage", "-fprofile-dir=./coverage_output");
- private static final String FRAMEWORK_SUFFIX = ".framework";
-
/**
* Iterable wrapper providing strong type safety for arguments to binary linking.
*/
@@ -285,37 +282,27 @@ final class CompilationSupport {
Artifact linkedBinary =
ObjcRuleClasses.intermediateArtifacts(ruleContext).singleArchitectureBinary();
- ImmutableList<Artifact> ccLibraries = ccLibraries(objcProvider);
ruleContext.registerAction(
ObjcRuleClasses.spawnOnDarwinActionBuilder()
.setMnemonic("ObjcLink")
.setShellCommand(ImmutableList.of("/bin/bash", "-c"))
- .setCommandLine(
- linkCommandLine(extraLinkArgs, objcProvider, linkedBinary, dsymBundle, ccLibraries))
+ .setCommandLine(linkCommandLine(extraLinkArgs, objcProvider, linkedBinary, dsymBundle))
.addOutput(linkedBinary)
.addOutputs(dsymBundle.asSet())
.addTransitiveInputs(objcProvider.get(LIBRARY))
.addTransitiveInputs(objcProvider.get(IMPORTED_LIBRARY))
.addTransitiveInputs(objcProvider.get(FRAMEWORK_FILE))
- .addInputs(ccLibraries)
.addInputs(extraLinkInputs)
.build(ruleContext));
}
- private ImmutableList<Artifact> ccLibraries(ObjcProvider objcProvider) {
- ImmutableList.Builder<Artifact> ccLibraryBuilder = ImmutableList.builder();
- for (LinkerInputs.LibraryToLink libraryToLink : objcProvider.get(ObjcProvider.CC_LIBRARY)) {
- ccLibraryBuilder.add(libraryToLink.getArtifact());
- }
- return ccLibraryBuilder.build();
- }
+ private static final String FRAMEWORK_SUFFIX = ".framework";
private CommandLine linkCommandLine(ExtraLinkArgs extraLinkArgs,
- ObjcProvider objcProvider, Artifact linkedBinary, Optional<Artifact> dsymBundle,
- ImmutableList<Artifact> ccLibraries) {
+ ObjcProvider objcProvider, Artifact linkedBinary, Optional<Artifact> dsymBundle) {
ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext);
- CustomCommandLine.Builder commandLine = CustomCommandLine.builder();
+ final CustomCommandLine.Builder commandLine = CustomCommandLine.builder();
if (objcProvider.is(USES_CPP)) {
commandLine
@@ -335,7 +322,6 @@ final class CompilationSupport {
.addExecPath("-o", linkedBinary)
.addExecPaths(objcProvider.get(LIBRARY))
.addExecPaths(objcProvider.get(IMPORTED_LIBRARY))
- .addExecPaths(ccLibraries)
.add(dylibPaths(objcProvider))
.addBeforeEach("-force_load", Artifact.toExecPaths(objcProvider.get(FORCE_LOAD_LIBRARY)))
.add(extraLinkArgs)