From eb952d08f76afa907bb34eaf7e1a69899102c523 Mon Sep 17 00:00:00 2001 From: bbaren Date: Mon, 2 Jul 2018 13:11:49 -0700 Subject: Set Xcode version as a feature when building Objective-C Add a new standard feature set to the Xcode version being used for compilation. (The feature is named `xcode_VERSION`, where `VERSION` is at least a two-component version number; `xcode_9.0` and `xcode_9.2` are both possible values.) This provides CROSSTOOL authors a mechanism to deploy compiler flags supported only in certain Xcode versions. PiperOrigin-RevId: 203000420 --- .../com/google/devtools/build/lib/rules/objc/CompilationSupport.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main/java/com') 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 f6b6052895..ed95544092 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 @@ -223,6 +223,8 @@ public class CompilationSupport { private static final String GENERATE_LINKMAP_FEATURE_NAME = "generate_linkmap"; + private static final String XCODE_VERSION_FEATURE_NAME_PREFIX = "xcode_"; + /** Enabled if this target has objc sources in its transitive closure. */ private static final String CONTAINS_OBJC = "contains_objc_sources"; @@ -545,6 +547,9 @@ public class CompilationSupport { activatedCrosstoolSelectables.add(CppRuleClasses.PER_OBJECT_DEBUG_INFO); } + activatedCrosstoolSelectables.add(XCODE_VERSION_FEATURE_NAME_PREFIX + + XcodeConfig.getXcodeVersion(ruleContext).toStringWithMinimumComponents(2)); + activatedCrosstoolSelectables.addAll(ruleContext.getFeatures()); activatedCrosstoolSelectables.addAll(CcCommon.getCoverageFeatures(toolchain)); -- cgit v1.2.3