diff options
author | Cal Peyser <cpeyser@google.com> | 2016-06-28 13:41:28 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-06-29 08:53:18 +0000 |
commit | 1673a7a1db1f72f9523e459f56097d57dec8b1eb (patch) | |
tree | 9bab2d085a5c42b2ba854245bcb82a5878c646a0 | |
parent | bda097c6310d7e1f7a00fe5f6bada57660b1b682 (diff) |
Add bitcode support to experimental_objc_library.
--
MOS_MIGRATED_REVID=126068553
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java | 33 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalObjcLibrary.java | 5 |
2 files changed, 22 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java index 379068dc09..c110cbbd49 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java @@ -208,25 +208,25 @@ public class AppleCommandLineOptions extends FragmentOptions { */ public enum AppleBitcodeMode { + /** Do not compile bitcode. */ + NONE("none", ImmutableList.<String>of()), /** - * Do not compile bitcode. + * Compile the minimal set of bitcode markers. This is often the best option for developer/debug + * builds. */ - NONE("none"), - /** - * Compile the minimal set of bitcode markers. This is often the best option for - * developer/debug builds. - */ - EMBEDDED_MARKERS("embedded_markers", "-fembed-bitcode-marker"), - /** - * Fully embed bitcode in compiled files. This is often the best option for release builds. - */ - EMBEDDED("embedded", "-fembed-bitcode"); + EMBEDDED_MARKERS( + "embedded_markers", ImmutableList.of("bitcode_embedded_markers"), "-fembed-bitcode-marker"), + /** Fully embed bitcode in compiled files. This is often the best option for release builds. */ + EMBEDDED("embedded", ImmutableList.of("bitcode_embedded"), "-fembed-bitcode"); private final String mode; + private final ImmutableList<String> featureNames; private final ImmutableList<String> compilerFlags; - private AppleBitcodeMode(String mode, String... compilerFlags) { + private AppleBitcodeMode( + String mode, ImmutableList<String> featureNames, String... compilerFlags) { this.mode = mode; + this.featureNames = featureNames; this.compilerFlags = ImmutableList.copyOf(compilerFlags); } @@ -235,9 +235,12 @@ public class AppleCommandLineOptions extends FragmentOptions { return mode; } - /** - * Returns the flags that should be added to compile actions to use this bitcode setting. - */ + /** Returns the names of any crosstool features that correspond to this bitcode mode. */ + public ImmutableList<String> getFeatureNames() { + return featureNames; + } + + /** Returns the flags that should be added to compile actions to use this bitcode setting. */ public ImmutableList<String> getCompilerFlags() { return compilerFlags; } 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 3ee305e68d..1740e2bdbe 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 @@ -168,7 +168,10 @@ public class ExperimentalObjcLibrary implements RuleConfiguredTargetFactory { if (ObjcCommon.shouldUseObjcModules(ruleContext)) { activatedCrosstoolSelectables.add(OBJC_MODULE_FEATURE_NAME); } - + + activatedCrosstoolSelectables.addAll( + ruleContext.getFragment(AppleConfiguration.class).getBitcodeMode().getFeatureNames()); + // We create a module map by default to allow for swift interop. activatedCrosstoolSelectables.add(CppRuleClasses.MODULE_MAPS); activatedCrosstoolSelectables.add(CppRuleClasses.COMPILE_ACTION_FLAGS_IN_FLAG_SET); |