From a1221f39a62c8a33ea02b0069e8a233d16be7731 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 22:06:04 -0400 Subject: [PATCH 01/11] Xcode 9.3 recommended changes, including the new SWIFT_COMPILATION_MODE --- OneTimePassword.xcodeproj/project.pbxproj | 3 ++- .../xcshareddata/xcschemes/OneTimePassword (iOS).xcscheme | 8 +++----- .../xcschemes/OneTimePassword (watchOS).xcscheme | 8 +++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/OneTimePassword.xcodeproj/project.pbxproj b/OneTimePassword.xcodeproj/project.pbxproj index 6b08df04..71a02e60 100644 --- a/OneTimePassword.xcodeproj/project.pbxproj +++ b/OneTimePassword.xcodeproj/project.pbxproj @@ -521,7 +521,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Matt Rubin"; TargetAttributes = { 5B39F4931DBD06BA00CD2DAB = { @@ -742,6 +742,7 @@ baseConfigurationReference = C996EC2E1A74D5830076B105 /* Release.xcconfig */; buildSettings = { IPHONEOS_DEPLOYMENT_TARGET = 8.0; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_VERSION = 4.0; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; diff --git a/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (iOS).xcscheme b/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (iOS).xcscheme index 97fa36ad..02a72571 100644 --- a/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (iOS).xcscheme +++ b/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (iOS).xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -67,7 +66,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (watchOS).xcscheme b/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (watchOS).xcscheme index af2297cd..02738b64 100644 --- a/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (watchOS).xcscheme +++ b/OneTimePassword.xcodeproj/xcshareddata/xcschemes/OneTimePassword (watchOS).xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -47,7 +46,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" From bbfe6c9f608d0ec528b23192b9fd6b2c6ecc7407 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 22:12:46 -0400 Subject: [PATCH 02/11] Remove a SwiftLint disable comment that is no longer needed The underlying bug causing the false positive has been fixed in Swift 4.1 --- Tests/TokenSerializationTests.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tests/TokenSerializationTests.swift b/Tests/TokenSerializationTests.swift index 4ef313ba..551809e3 100644 --- a/Tests/TokenSerializationTests.swift +++ b/Tests/TokenSerializationTests.swift @@ -98,9 +98,6 @@ class TokenSerializationTests: XCTestCase { let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) let items = urlComponents?.queryItems let expectedItemCount = 4 - // SwiftLint gives a false positive here because of a Swift/SourceKit bug. - // See https://github.com/realm/SwiftLint/issues/1785 - // swiftlint:disable vertical_parameter_alignment_on_call XCTAssertEqual(items?.count, expectedItemCount, "There shouldn't be any unexpected query arguments: \(url)") // swiftlint:enable vertical_parameter_alignment_on_call From f6370fe72ba1040188d5446dd11edb9051023e2e Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 22:14:44 -0400 Subject: [PATCH 03/11] Ignore the SwiftLint identifier_name rule This rule is now catching many previously-missed violations. It may be enabled if the naming is cleaned up in the future. --- .swiftlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index 7b047986..35945f22 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -42,6 +42,7 @@ disabled_rules: - colon - comma - cyclomatic_complexity + - identifier_name trailing_comma: mandatory_comma: true From 013d9d4256890395792dafe2a598b6343198ad84 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 22:23:47 -0400 Subject: [PATCH 04/11] Set SWIFT_TREAT_WARNINGS_AS_ERRORS to NO New warnings in Swift 4.1 were breaking the ability to build the library via Carthage. (https://github.com/mattrubin/OneTimePassword/issues/166) --- OneTimePassword.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OneTimePassword.xcodeproj/project.pbxproj b/OneTimePassword.xcodeproj/project.pbxproj index 71a02e60..33062460 100644 --- a/OneTimePassword.xcodeproj/project.pbxproj +++ b/OneTimePassword.xcodeproj/project.pbxproj @@ -732,6 +732,7 @@ baseConfigurationReference = C996EC2C1A74D5830076B105 /* Debug.xcconfig */; buildSettings = { IPHONEOS_DEPLOYMENT_TARGET = 8.0; + SWIFT_TREAT_WARNINGS_AS_ERRORS = NO; SWIFT_VERSION = 4.0; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -743,6 +744,7 @@ buildSettings = { IPHONEOS_DEPLOYMENT_TARGET = 8.0; SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_TREAT_WARNINGS_AS_ERRORS = NO; SWIFT_VERSION = 4.0; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; From c1a2c55401613d9a57e129a29d7ec24a3950721e Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 22:39:33 -0400 Subject: [PATCH 05/11] Add a changelog entry --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9815d969..4c51e80f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # OneTimePassword Changelog - +## [In development][develop] + +- Update build and linter settings for Xcode 9.3. ([#167](https://github.com/mattrubin/OneTimePassword/pull/167)) + ## [3.1][] (2018-03-27) - Upgrade to Swift 4 and Xcode 9. From 986a1d6be689a631c32130fb86d33f86d93b53c9 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 22:55:53 -0400 Subject: [PATCH 06/11] Use conditional compilation to handle SE-0184 changes to deallocation --- Sources/Crypto.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/Crypto.swift b/Sources/Crypto.swift index ef35a502..d2e7c84f 100644 --- a/Sources/Crypto.swift +++ b/Sources/Crypto.swift @@ -30,7 +30,13 @@ func HMAC(algorithm: Generator.Algorithm, key: Data, data: Data) -> Data { let (hashFunction, hashLength) = algorithm.hashInfo let macOut = UnsafeMutablePointer.allocate(capacity: hashLength) - defer { macOut.deallocate(capacity: hashLength) } + defer { + #if swift(>=4.1) + macOut.deallocate() + #else + macOut.deallocate(capacity: hashLength) + #endif + } key.withUnsafeBytes { keyBytes in data.withUnsafeBytes { dataBytes in From 0924258988df19f4c4ade4e3e7958dc07310f54f Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 23:19:48 -0400 Subject: [PATCH 07/11] Add a changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c51e80f..f0e3055a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [In development][develop] - Update build and linter settings for Xcode 9.3. ([#167](https://github.com/mattrubin/OneTimePassword/pull/167)) +- Use conditional compilation to handle SE-0184 changes to the UnsafeMutablePointer `deallocate` API. ([#168](https://github.com/mattrubin/OneTimePassword/pull/168)) ## [3.1][] (2018-03-27) From 1ae1cada27c8f1ecc347d6959193401dbd6e64c7 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 23:10:25 -0400 Subject: [PATCH 08/11] Add Xcode 9.3's new IDEWorkspaceChecks.plist From the release notes: "Xcode 9.3 adds a new IDEWorkspaceChecks.plist file to a workspace's shared data, to store the state of necessary workspace checks. Committing this file to source control will prevent unnecessary rerunning of those checks for each user opening the workspace." --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 OneTimePassword.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/OneTimePassword.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/OneTimePassword.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/OneTimePassword.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + From 92140fa49a5c9fccd45a27631f17778f816deda0 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 23:12:50 -0400 Subject: [PATCH 09/11] Bump the version number to 3.1.1 --- OneTimePassword.podspec | 2 +- Sources/Info.plist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OneTimePassword.podspec b/OneTimePassword.podspec index 710c9760..437c2154 100644 --- a/OneTimePassword.podspec +++ b/OneTimePassword.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "OneTimePassword" - s.version = "3.1" + s.version = "3.1.1" s.summary = "A small library for generating TOTP and HOTP one-time passwords." s.homepage = "https://github.com/mattrubin/OneTimePassword" s.license = "MIT" diff --git a/Sources/Info.plist b/Sources/Info.plist index 54106c8d..ae3a3e0f 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.1 + 3.1.1 CFBundleSignature ???? CFBundleVersion - 3.1 + 3.1.1 NSPrincipalClass From 367785a2a18fa98d8d039bcbf464a8cff9fc52d0 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sat, 31 Mar 2018 23:40:26 -0400 Subject: [PATCH 10/11] Add a changelog header for 3.1.1 --- CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0e3055a..b7f72e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # OneTimePassword Changelog -## [In development][develop] + +## [3.1.1][] (2018-03-31) - Update build and linter settings for Xcode 9.3. ([#167](https://github.com/mattrubin/OneTimePassword/pull/167)) -- Use conditional compilation to handle SE-0184 changes to the UnsafeMutablePointer `deallocate` API. ([#168](https://github.com/mattrubin/OneTimePassword/pull/168)) +- Use conditional compilation to handle Swift 4.1 changes to the UnsafeMutablePointer `deallocate` API. ([#168](https://github.com/mattrubin/OneTimePassword/pull/168)) ## [3.1][] (2018-03-27) @@ -147,8 +148,9 @@ Changes between prerelease versions of OneTimePassword version 2 can be found be ## [1.0.0][] (2014-07-17) -[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1...develop +[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1.1...develop +[3.1.1]: https://github.com/mattrubin/OneTimePassword/compare/3.1...3.1.1 [3.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0.1...3.1 [3.0.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0...3.0.1 [3.0]: https://github.com/mattrubin/OneTimePassword/compare/2.1.1...3.0 From daaacc4c08b3ea4599ef60a45ac845edfad4424a Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sun, 1 Apr 2018 00:26:23 -0400 Subject: [PATCH 11/11] Update the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f72e62..d013d3bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ ## [3.1.1][] (2018-03-31) +- Add support for Swift 4.1. ([#168](https://github.com/mattrubin/OneTimePassword/pull/168)) - Update build and linter settings for Xcode 9.3. ([#167](https://github.com/mattrubin/OneTimePassword/pull/167)) -- Use conditional compilation to handle Swift 4.1 changes to the UnsafeMutablePointer `deallocate` API. ([#168](https://github.com/mattrubin/OneTimePassword/pull/168)) ## [3.1][] (2018-03-27)