From c5442570ecba9a540a552825c8aed7ac9c62c321 Mon Sep 17 00:00:00 2001 From: bbaren Date: Wed, 15 Aug 2018 13:58:00 -0700 Subject: Always use exactly two components in Xcode version feature When setting the standard Xcode version feature (see commit eb952d08f76afa907bb34eaf7e1a69899102c523), always use exactly two components for the version number. Grouping all point releases together simplifies writing CROSSTOOLs. Also fix a bug in MockObjcSupport that prevented Xcode version selection in tests from working properly. RELNOTES: The standard `xcode_VERSION` feature now always uses exactly two components in the version, even if you specify `--xcode_version` with more or fewer than two. PiperOrigin-RevId: 208877588 --- .../build/lib/rules/objc/ObjcLibraryTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java') 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 f0eb7ec5cc..ce828e5523 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 @@ -1265,6 +1265,30 @@ public class ObjcLibraryTest extends ObjcRuleTestCase { assertThat(action.getArguments()).doesNotContain("-DXCODE_FEATURE_FOR_TESTING=xcode_5.8"); } + @Test + public void testXcodeVersionFeatureTwoComponentsTooMany() throws Exception { + useConfiguration("--xcode_version=7.3.1"); + + createLibraryTargetWriter("//objc:lib") + .setAndCreateFiles("srcs", "a.m") + .write(); + CommandAction action = compileAction("//objc:lib", "a.o"); + + assertThat(action.getArguments()).contains("-DXCODE_FEATURE_FOR_TESTING=xcode_7.3"); + } + + @Test + public void testXcodeVersionFeatureTwoComponentsTooFew() throws Exception { + useConfiguration("--xcode_version=5"); + + 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.0"); + } + @Test public void testIosSdkVersionCannotBeDefinedButEmpty() throws Exception { try { -- cgit v1.2.3