From 938ba4103934db7459a920ca0cd96f0fd3953695 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Thu, 10 Dec 2015 15:49:53 -0500 Subject: Update the min toolchain for iOS/OS X to be Xcode 7 - Let Xcode update the projects, schemes, and info.plists. - Add workaround for shallow analyzer issues in current Xcode versions (deep analyze gets things correct). - Tweak the Swift based tests to avoid warnings from Xcode 7's XCTest using optionals for autoenclosure results. - No longer tag the ObjC iOS travis test as flaky, xctool seems to manage the simulator pretty well. --- .travis.yml | 4 ---- objectivec/DevTools/full_mac_build.sh | 9 ++------ objectivec/GPBDictionary.m | 25 ++++++++++++++++++++++ .../ProtocolBuffers_OSX.xcodeproj/project.pbxproj | 6 +++++- .../xcschemes/PerformanceTests.xcscheme | 13 ++++++----- .../xcschemes/ProtocolBuffers.xcscheme | 13 ++++++----- .../ProtocolBuffers_iOS.xcodeproj/project.pbxproj | 6 +++++- .../xcschemes/PerformanceTests.xcscheme | 13 ++++++----- .../xcschemes/ProtocolBuffers.xcscheme | 13 ++++++----- objectivec/README.md | 2 +- objectivec/Tests/GPBSwiftTests.swift | 16 +++++++------- objectivec/Tests/UnitTests-Info.plist | 2 +- objectivec/Tests/iOSTestHarness/Info.plist | 2 +- 13 files changed, 80 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7780174c..7daee86b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,9 +66,5 @@ matrix: env: CONFIG=ruby22 - os: osx env: CONFIG=jruby - # Travis seems be flaky in letting the iOS simulator launch, so keep that - # flake from failing builds by marking that build as an allowed failure. - - os: osx - env: CONFIG=objectivec_ios notifications: email: false diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh index 11e3f79b..709aae0a 100755 --- a/objectivec/DevTools/full_mac_build.sh +++ b/objectivec/DevTools/full_mac_build.sh @@ -231,13 +231,8 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then IOS_SIMULATOR_NAME="Simulator" case "${XCODE_VERSION}" in 6.* ) - XCODEBUILD_TEST_BASE_IOS+=( - -destination "platform=iOS Simulator,name=iPhone 4s,OS=7.1" # 32bit - -destination "platform=iOS Simulator,name=iPhone 6,OS=8.4" # 64bit - -destination "platform=iOS Simulator,name=iPad 2,OS=7.1" # 32bit - -destination "platform=iOS Simulator,name=iPad Air,OS=8.4" # 64bit - ) - IOS_SIMULATOR_NAME="iOS Simulator" + echo "ERROR: Xcode 6.3/6.4 no longer supported for building, please use 7.0 or higher." 1>&2 + exit 10 ;; 7.* ) XCODEBUILD_TEST_BASE_IOS+=( diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m index 7015b3ee..6baa2a18 100644 --- a/objectivec/GPBDictionary.m +++ b/objectivec/GPBDictionary.m @@ -45,6 +45,18 @@ // directly. // ------------------------------------------------------------------ +// Used to include code only visible to specific versions of the static +// analyzer. Useful for wrapping code that only exists to silence the analyzer. +// Determine the values you want to use for BEGIN_APPLE_BUILD_VERSION, +// END_APPLE_BUILD_VERSION using: +// xcrun clang -dM -E -x c /dev/null | grep __apple_build_version__ +// Example usage: +// #if GPB_STATIC_ANALYZER_ONLY(5621, 5623) ... #endif +#define GPB_STATIC_ANALYZER_ONLY(BEGIN_APPLE_BUILD_VERSION, END_APPLE_BUILD_VERSION) \ + (defined(__clang_analyzer__) && \ + (__apple_build_version__ >= BEGIN_APPLE_BUILD_VERSION && \ + __apple_build_version__ <= END_APPLE_BUILD_VERSION)) + enum { kMapKeyFieldNumber = 1, kMapValueFieldNumber = 2, @@ -496,6 +508,19 @@ void GPBDictionaryReadEntry(id mapDictionary, } if ((keyDataType == GPBDataTypeString) && GPBDataTypeIsObject(valueDataType)) { +#if GPB_STATIC_ANALYZER_ONLY(6020053, 7000181) + // Limited to Xcode 6.4 - 7.2, are known to fail here. The upper end can + // be raised as needed for new Xcodes. + // + // This is only needed on a "shallow" analyze; on a "deep" analyze, the + // existing code path gets this correct. In shallow, the analyzer decides + // GPBDataTypeIsObject(valueDataType) is both false and true on a single + // path through this function, allowing nil to be used for the + // setObject:forKey:. + if (value.valueString == nil) { + value.valueString = [@"" retain]; + } +#endif // mapDictionary is an NSMutableDictionary [(NSMutableDictionary *)mapDictionary setObject:value.valueString forKey:key.valueString]; diff --git a/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj index b17a4f4a..1c834bb2 100644 --- a/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj +++ b/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj @@ -567,8 +567,9 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 0710; LastTestingUpgradeCheck = 0600; - LastUpgradeCheck = 0630; + LastUpgradeCheck = 0710; TargetAttributes = { 8BBEA4A5147C727100C4ADB7 = { TestTargetID = 8B9A5EA41831993600A9D33B; @@ -756,6 +757,7 @@ ); INFOPLIST_FILE = "Tests/UnitTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = UnitTests; SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -773,6 +775,7 @@ ); INFOPLIST_FILE = "Tests/UnitTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = UnitTests; SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h"; }; @@ -792,6 +795,7 @@ CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; diff --git a/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme b/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme index 3b3eeb12..7ddf283d 100644 --- a/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme +++ b/objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -284,15 +284,18 @@ + + + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -81,15 +81,18 @@ ReferencedContainer = "container:ProtocolBuffers_OSX.xcodeproj"> + + + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -293,15 +293,18 @@ ReferencedContainer = "container:ProtocolBuffers_iOS.xcodeproj"> + + @@ -317,10 +320,10 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -81,15 +81,18 @@ ReferencedContainer = "container:ProtocolBuffers_iOS.xcodeproj"> + + @@ -105,10 +108,10 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/objectivec/Tests/iOSTestHarness/Info.plist b/objectivec/Tests/iOSTestHarness/Info.plist index 31ab1578..24bd333d 100644 --- a/objectivec/Tests/iOSTestHarness/Info.plist +++ b/objectivec/Tests/iOSTestHarness/Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.google.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName -- cgit v1.2.3