aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2016-05-11 09:31:47 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2016-05-11 10:24:48 +0000
commit66ce9030d2d2a100593b90b1d0e2188001db2d3e (patch)
tree365b36228b8d78b12b156609ef5c57d676b0361c /src/main/java
parentf6fa7d94e7f682edb610e8ad651b131882e81779 (diff)
Reconcile cc and objc default compiler flags in the crosstool.
-- MOS_MIGRATED_REVID=122035585
Diffstat (limited to 'src/main/java')
-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());