Răsfoiți Sursa

Update Xcode9 recommendation settings

Kishikawa Katsumi 8 ani în urmă
părinte
comite
0360110233

+ 9 - 14
.travis.yml

@@ -1,30 +1,25 @@
 language: objective-c
-osx_image: xcode8
+osx_image: xcode9
 cache:
   directories:
-  - Lib/vendor/bundle
-# before_install:
-# - brew update
-# - brew outdated carthage || brew upgrade carthage
+  - Lib/vendor
+  - /usr/local/Homebrew
+  - $HOME/Library/Caches/Homebrew
+before_install:
+- brew update
+- brew outdated carthage || brew upgrade carthage
 install:
 - "(cd Lib && bundle install --path=vendor/bundle --binstubs=vendor/bin)"
 before_script:
-- openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in ./Lib/Certificates/ios_developer.p12.enc -d -a -out ./Lib/Certificates/ios_developer.p12 || true
-- openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in ./Lib/Certificates/developer_id_app.p12.enc -d -a -out ./Lib/Certificates/developer_id_app.p12 || true
-- openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in ./Lib/Certificates/iOS_Development.mobileprovision.enc -d -a -out ./Lib/Certificates/iOS_Development.mobileprovision || true
-- openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in ./Lib/Certificates/tvOS_Development.mobileprovision.enc -d -a -out ./Lib/Certificates/tvOS_Development.mobileprovision || true
-- openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in ./Lib/Certificates/KeychainAccess_Tests.provisionprofile.enc -d -a -out ./Lib/Certificates/KeychainAccess_Tests.provisionprofile || true
+- ./Lib/Scripts/decode_cert.sh || true
 - ./Lib/Scripts/add_key.sh || true
 script:
 - "(cd Lib && bundle exec rake $ACTION)"
-after_success:
-- bash <(curl -s https://codecov.io/bash) -D './build' -J 'KeychainAccess'
 env:
   matrix:
   - ACTION=build
   - ACTION='build:carthage'
-  - ACTION='test:iphonesimulator:debug'
-  - ACTION='test:iphonesimulator:release'
+  - ACTION='test:iphonesimulator'
   - ACTION='test:appletvsimulator'
   - ACTION='test:macosx'
   global:

+ 13 - 1
Examples/Example-iOS/Example-iOS.xcodeproj/project.pbxproj

@@ -157,7 +157,7 @@
 			isa = PBXProject;
 			attributes = {
 				LastSwiftUpdateCheck = 0700;
-				LastUpgradeCheck = 0800;
+				LastUpgradeCheck = 0900;
 				ORGANIZATIONNAME = "kishikawa katsumi";
 				TargetAttributes = {
 					14DAEE8F1A51E1BE0070B77E = {
@@ -268,14 +268,20 @@
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 				CLANG_WARN_EMPTY_BODY = YES;
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -316,14 +322,20 @@
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 				CLANG_WARN_EMPTY_BODY = YES;
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

+ 3 - 1
Examples/Example-iOS/Example-iOS.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0830"
+   LastUpgradeVersion = "0900"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -40,6 +40,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
          <TestableReference
@@ -69,6 +70,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"

+ 11 - 4
Lib/Configurations/Base.xcconfig

@@ -4,21 +4,27 @@ CLANG_CXX_LANGUAGE_STANDARD = gnu++0x;
 CLANG_CXX_LIBRARY = libc++;
 CLANG_ENABLE_MODULES = YES;
 CLANG_ENABLE_OBJC_ARC = YES;
+CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 CLANG_WARN_BOOL_CONVERSION = YES;
+CLANG_WARN_COMMA = YES;
 CLANG_WARN_CONSTANT_CONVERSION = YES;
 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 CLANG_WARN_EMPTY_BODY = YES;
 CLANG_WARN_ENUM_CONVERSION = YES;
-CLANG_WARN_INFINITE_RECURSION = YES
+CLANG_WARN_INFINITE_RECURSION = YES;
 CLANG_WARN_INT_CONVERSION = YES;
+CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-CLANG_WARN_SUSPICIOUS_MOVE = YES
+CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+CLANG_WARN_STRICT_PROTOTYPES = YES;
+CLANG_WARN_SUSPICIOUS_MOVE = YES;
 CLANG_WARN_UNREACHABLE_CODE = YES;
 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 CURRENT_PROJECT_VERSION = 1;
 ENABLE_STRICT_OBJC_MSGSEND = YES;
 GCC_C_LANGUAGE_STANDARD = gnu99;
-GCC_NO_COMMON_BLOCKS = YES
+GCC_NO_COMMON_BLOCKS = YES;
 GCC_DYNAMIC_NO_PIC = NO;
 GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -38,4 +44,5 @@ WATCHOS_DEPLOYMENT_TARGET = 2.0;
 TVOS_DEPLOYMENT_TARGET = 9.0;
 MACOSX_DEPLOYMENT_TARGET = 10.9;
 
-SWIFT_VERSION = 3.0;
+SWIFT_SWIFT3_OBJC_INFERENCE = On;
+SWIFT_VERSION = 4.0;

+ 2 - 3
Lib/Configurations/TestHost.xcconfig

@@ -15,9 +15,8 @@ PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.KeychainAccess.TestHost;
 CODE_SIGN_ENTITLEMENTS = TestHost/TestHost.entitlements;
 PROVISIONING_PROFILE_SPECIFIER[sdk=iphone*] = iOS Development;
 
-CODE_SIGN_IDENTITY[sdk=macosx*] = Developer ID Application
-PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*] = KeychainAccess Tests
-OTHER_CODE_SIGN_FLAGS[sdk=macosx*] = --deep;
+CODE_SIGN_IDENTITY[sdk=macosx*] = Developer ID Application;
+PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*] = KeychainAccess Tests;
 
 DEVELOPMENT_TEAM = 27AEDK3C9F;
 

+ 3 - 3
Lib/Gemfile.lock

@@ -1,9 +1,9 @@
 GEM
   remote: https://rubygems.org/
   specs:
-    rake (12.0.0)
+    rake (12.1.0)
     rouge (2.0.7)
-    xcjobs (0.8.1)
+    xcjobs (0.10.0)
     xcpretty (0.2.8)
       rouge (~> 2.0.7)
 
@@ -16,4 +16,4 @@ DEPENDENCIES
   xcpretty
 
 BUNDLED WITH
-   1.15.0
+   1.15.4

+ 6 - 1
Lib/KeychainAccess.xcodeproj/project.pbxproj

@@ -267,19 +267,24 @@
 			isa = PBXProject;
 			attributes = {
 				LastSwiftUpdateCheck = 0730;
-				LastUpgradeCheck = 0830;
+				LastUpgradeCheck = 0900;
 				ORGANIZATIONNAME = "kishikawa katsumi";
 				TargetAttributes = {
 					140F195B1A49D79400B0016A = {
 						CreatedOnToolsVersion = 6.1.1;
+						LastSwiftMigration = 0900;
 						ProvisioningStyle = Automatic;
 					};
 					140F19661A49D79500B0016A = {
 						CreatedOnToolsVersion = 6.1.1;
+						DevelopmentTeam = 27AEDK3C9F;
+						LastSwiftMigration = 0900;
 						TestTargetID = 14A62FFC1D32922C00809B3F;
 					};
 					14A630141D3293C700809B3F = {
 						CreatedOnToolsVersion = 7.3.1;
+						DevelopmentTeam = 27AEDK3C9F;
+						LastSwiftMigration = 0900;
 						SystemCapabilities = {
 							com.apple.Keychain = {
 								enabled = 1;

+ 3 - 1
Lib/KeychainAccess.xcodeproj/xcshareddata/xcschemes/KeychainAccess.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0830"
+   LastUpgradeVersion = "0900"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -40,6 +40,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
          <TestableReference
@@ -69,6 +70,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"

+ 3 - 1
Lib/KeychainAccess.xcodeproj/xcshareddata/xcschemes/TestHost.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0830"
+   LastUpgradeVersion = "0900"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
       </Testables>
@@ -45,6 +46,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"

+ 57 - 30
Lib/Rakefile

@@ -6,21 +6,26 @@ def destinations(platform: 'iphonesimulator')
     [ 'name=iPhone 5,OS=10.0',
       'name=iPhone 5s,OS=10.0',
       'name=iPhone 6,OS=10.0',
-      'name=iPhone 6s Plus,OS=10.0',
-      'name=iPhone SE,OS=10.0',
+      'name=iPhone 6s Plus,OS=10.3.1',
+      'name=iPhone SE,OS=10.3.1',
+      'name=iPhone 7,OS=11.0',
       'name=iPad Air 2,OS=10.0',
-      'name=iPad Pro (9.7 inch),OS=10.0',
-      'name=iPad Pro (12.9 inch),OS=10.0'
+      'name=iPad Pro (9.7-inch),OS=10.0',
+      'name=iPad Pro (12.9-inch),OS=10.0',
+      'name=iPad Pro (10.5-inch),OS=11.0'
     ]
   elsif platform == 'watchsimulator'
-    [ 'name=Apple Watch - 38mm,OS=3.0',
-      'name=Apple Watch - 42mm,OS=3.0'
+    [ 'name=Apple Watch - 38mm,OS=3.2',
+      'name=Apple Watch - 42mm,OS=4.0'
     ]
   elsif platform == 'appletvsimulator'
-    [ 'name=Apple TV 1080p,OS=10.0'
+    [ 'name=Apple TV 1080p,OS=10.2',
+      'name=Apple TV 1080p,OS=11.0'
     ]
   else
-    []
+    [
+      'platform=OS X,arch=x86_64'
+    ]
   end
 end
 
@@ -47,14 +52,15 @@ namespace :build do
       t.scheme = 'KeychainAccess'
       t.sdk = platform
       if platform == 'iphonesimulator'
-        t.add_destination('name=iPhone 6,OS=10.0')
+        t.add_destination('name=iPhone 7,OS=11.0')
       elsif platform == 'watchsimulator'
-        t.add_destination('name=Apple Watch - 42mm,OS=3.0')
+        t.add_destination('name=Apple Watch - 42mm,OS=4.0')
       elsif platform == 'appletvsimulator'
-        t.add_destination('name=Apple TV 1080p,OS=10.0')
+        t.add_destination('name=Apple TV 1080p,OS=11.0')
       end
       t.configuration = configuration
       t.build_dir = 'build'
+      t.hide_shell_script_environment = true
       t.formatter = 'xcpretty -c'
       if ENV['CI']
         t.add_build_setting('CODE_SIGN_IDENTITY', '')
@@ -62,12 +68,12 @@ namespace :build do
       end
     end
   end
-  
+
   task :carthage do
     sh %[echo 'github \"kishikawakatsumi/KeychainAccess\" \"#{branch_name}\"' > Cartfile]
     sh %[carthage update --no-use-binaries]
   end
-  
+
   def branch_name
     if ENV['CI']
       pull_req = %[https://api.github.com/repos/#{ENV['TRAVIS_REPO_SLUG']}/pulls/#{ENV['TRAVIS_PULL_REQUEST']}]
@@ -81,30 +87,51 @@ end
 
 namespace :test do
   supportedPlatforms
-    .select { |platform| platform == 'macosx' || platform.end_with?('simulator') }.map do |platform|
+    .select { |platform| platform == 'macosx' || platform == 'iphonesimulator' || platform == 'appletvsimulator' }
+    .each do |platform|
       task platform do |t|
-        configurations
-          .map { |configuration| Rake::Task["test:#{platform}:#{configuration.downcase}"] }
-          .map(&:invoke)
+        configurations.each do |configuration|
+          destinations(platform: platform)
+            .map { |destination| Rake::Task["test:#{platform}:#{configuration.downcase}:#{destination}"] }
+            .map(&:invoke)
+        end
       end
     end
 end
-    
+
 namespace :test do
-  supportedPlatforms.product(configurations).each do |platform, configuration|
-    XCJobs::Test.new("#{platform}:#{configuration.downcase}") do |t|
-      t.project = 'KeychainAccess'
-      t.scheme = 'KeychainAccess'
-      t.sdk = platform
+  supportedPlatforms
+    .select { |platform| platform == 'macosx' || platform == 'iphonesimulator' || platform == 'appletvsimulator' }
+    .product(configurations)
+    .each do |platform, configuration|
       destinations(platform: platform).each do |destination|
-        t.add_destination(destination)
+        XCJobs::Test.new("#{platform}:#{configuration.downcase}:#{destination}") do |t|
+          t.project = 'KeychainAccess'
+          t.scheme = 'KeychainAccess'
+          t.sdk = platform
+          t.configuration = configuration
+          t.add_destination(destination)
+          t.coverage = true
+          t.build_dir = 'build'
+          t.hide_shell_script_environment = true
+          t.after_action do
+            build_coverage_reports()
+            puts `curl -L https://codecov.io/bash | bash -s -- -f 'coverage.txt'`
+          end
+        end
       end
-      t.configuration = configuration
-      t.add_build_option('-enableCodeCoverage', 'YES')
-      t.build_dir = 'build'
-      t.formatter = 'xcpretty -c'
     end
-  end
 end
 
-XCJobs::Coverage::Coveralls.new()
+def build_coverage_reports()
+  project_name = 'KeychainAccess'
+  profdata = Dir.glob(File.join('build', '/**/Coverage.profdata')).first
+  Dir.glob(File.join('build', "/**/#{project_name}")) do |target|
+    output = `xcrun llvm-cov report -instr-profile "#{profdata}" "#{target}" -arch=x86_64`
+    if $?.success?
+      puts output
+      `xcrun llvm-cov show -instr-profile "#{profdata}" "#{target}" -arch=x86_64 -use-color=0 > coverage.txt`
+      break
+    end
+  end
+end

+ 2 - 0
Lib/Scripts/add_key.sh

@@ -9,6 +9,8 @@ security import ./Lib/Certificates/apple.cer -k ~/Library/Keychains/build.keycha
 security import ./Lib/Certificates/ios_developer.p12 -k ~/Library/Keychains/build.keychain -P $PASSPHRASE -T /usr/bin/codesign
 security import ./Lib/Certificates/developer_id_app.p12 -k ~/Library/Keychains/build.keychain -P $PASSPHRASE -T /usr/bin/codesign
 
+security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k travis build.keychain
+
 mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
 cp ./Lib/Certificates/*.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
 cp ./Lib/Certificates/*.provisionprofile ~/Library/MobileDevice/Provisioning\ Profiles/

+ 9 - 0
Lib/Scripts/decode_cert.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+CERT_DIR="./Lib/Certificates"
+FILES=('ios_developer.p12' 'developer_id_app.p12' 'iOS_Development.mobileprovision'\
+       'tvOS_Development.mobileprovision' 'KeychainAccess_Tests.provisionprofile')
+
+for file in ${FILES[@]}; do
+  openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in "$CERT_DIR"/"$file".enc -d -a -out "$CERT_DIR"/"$file"
+done