aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalObjcLibrary.java9
2 files changed, 14 insertions, 10 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 27dc24bdb9..6abcce77b3 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
@@ -130,6 +130,13 @@ public final class CompilationSupport {
static final ImmutableList<String> CLANG_COVERAGE_FLAGS =
ImmutableList.of("-fprofile-arcs", "-ftest-coverage");
+ // These are added by Xcode when building, because the simulator is built on OSX
+ // frameworks so we aim compile to match the OSX objc runtime.
+ @VisibleForTesting
+ static final ImmutableList<String> IOS_SIMULATOR_COMPILE_FLAGS =
+ ImmutableList.of(
+ "-fexceptions", "-fasm-blocks", "-fobjc-abi-version=2", "-fobjc-legacy-dispatch");
+
/**
* Returns the location of the xcrunwrapper tool.
*/
@@ -1511,13 +1518,7 @@ public final class CompilationSupport {
case IOS_DEVICE:
return ImmutableList.of();
case IOS_SIMULATOR:
- // These are added by Xcode when building, because the simulator is built on OSX
- // frameworks so we aim compile to match the OSX objc runtime.
- return ImmutableList.of(
- "-fexceptions",
- "-fasm-blocks",
- "-fobjc-abi-version=2",
- "-fobjc-legacy-dispatch");
+ return IOS_SIMULATOR_COMPILE_FLAGS;
default:
throw new AssertionError();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalObjcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalObjcLibrary.java
index aef4f2795f..e3ec44eaa5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalObjcLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalObjcLibrary.java
@@ -38,6 +38,8 @@ import java.util.Collection;
public class ExperimentalObjcLibrary implements RuleConfiguredTargetFactory {
private static final String PCH_FILE_VARIABLE_NAME = "pch_file";
+ private static final Iterable<String> ACTIVATED_ACTIONS =
+ ImmutableList.of("objc-compile", "objc++-compile");
private VariablesExtension variablesExtension(final RuleContext ruleContext) {
return new VariablesExtension() {
@@ -66,13 +68,14 @@ public class ExperimentalObjcLibrary implements RuleConfiguredTargetFactory {
.getPrerequisite(":cc_toolchain", Mode.TARGET)
.getProvider(CcToolchainProvider.class);
- ImmutableList.Builder<String> extraFeatures = ImmutableList.builder();
+ ImmutableList.Builder<String> activatedCrosstoolSelectables =
+ ImmutableList.<String>builder().addAll(ACTIVATED_ACTIONS);
if (ruleContext.getPrerequisiteArtifact("pch", Mode.TARGET) != null) {
- extraFeatures.add("pch");
+ activatedCrosstoolSelectables.add("pch");
}
FeatureConfiguration featureConfiguration =
- toolchain.getFeatures().getFeatureConfiguration(extraFeatures.build());
+ toolchain.getFeatures().getFeatureConfiguration(activatedCrosstoolSelectables.build());
Collection<Artifact> sources = Sets.newHashSet(compilationArtifacts.getSrcs());