diff options
author | bbaren <bbaren@google.com> | 2018-07-02 13:11:49 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-02 13:13:08 -0700 |
commit | eb952d08f76afa907bb34eaf7e1a69899102c523 (patch) | |
tree | 22be39bdf237bfd07783854cf451ec6fabd7dd66 /src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java | |
parent | 151717ce36ad3fa99b5aaf79328f632ebd4b0f7c (diff) |
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
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java index f6a40e57ff..ae879d288c 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java @@ -1269,6 +1269,30 @@ public class ObjcLibraryTest extends ObjcRuleTestCase { } @Test + public void testXcodeVersionFeature() throws Exception { + useConfiguration("--xcode_version=5.8"); + + createLibraryTargetWriter("//objc:lib") + .setAndCreateFiles("srcs", "a.m") + .write(); + CommandAction action = compileAction("//objc:lib", "a.o"); + + assertThat(action.getArguments()).contains("-DXCODE_FEATURE_FOR_TESTING=xcode_5.8"); + } + + @Test + public void testXcodeVersionFeatureUnused() throws Exception { + useConfiguration("--xcode_version=7.3"); + + createLibraryTargetWriter("//objc:lib") + .setAndCreateFiles("srcs", "a.m") + .write(); + CommandAction action = compileAction("//objc:lib", "a.o"); + + assertThat(action.getArguments()).doesNotContain("-DXCODE_FEATURE_FOR_TESTING=xcode_5.8"); + } + + @Test public void testIosSdkVersionCannotBeDefinedButEmpty() throws Exception { try { useConfiguration("--ios_sdk_version="); |