Skip to content

Commit

Permalink
Merge pull request #186 from square/dfed--swift-package-manager-fix
Browse files Browse the repository at this point in the history
Allow Valet's Package.swift to build on all platforms
  • Loading branch information
dfed authored Sep 30, 2019
2 parents 0e3d9a9 + 30dd9e2 commit bb7745c
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 368 deletions.
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ script:
- ./Scripts/ci.sh
matrix:
include:
- osx_image: xcode11
env: ACTION="swift-package";SDK="iphonesimulator";DESTINATION="platform=iOS Simulator,OS=13.0,name=iPad Pro (12.9-inch) (3rd generation)"
- osx_image: xcode11
env: ACTION="swift-package";SDK="appletvsimulator13.0";DESTINATION="platform=tvOS Simulator,name=Apple TV"
- osx_image: xcode11
env: ACTION="swift-package";SDK="macosx10.15";DESTINATION="platform=OS X"
- osx_image: xcode11
env: ACTION="swift-package";SDK="watchos6.0";DESTINATION=""
- osx_image: xcode11
env: ACTION="xcode";SCHEME="Valet iOS";SDK="iphonesimulator";DESTINATION="platform=iOS Simulator,OS=13.0,name=iPad Pro (12.9-inch) (3rd generation)";XCODE_ACTION="build test"
- osx_image: xcode11
env: ACTION="xcode";SCHEME="Valet tvOS";SDK="appletvsimulator13.0";DESTINATION="platform=tvOS Simulator,name=Apple TV";XCODE_ACTION="build test"
- osx_image: xcode11
env: ACTION="xcode";SCHEME="Valet Mac";SDK="macosx10.15";DESTINATION="platform=OS X";XCODE_ACTION="build test"
- osx_image: xcode11
env: ACTION="xcode";SCHEME="Valet watchOS";SDK="watchos6.0";DESTINATION="";XCODE_ACTION="build"
- osx_image: xcode11
env: ACTION="carthage"

- osx_image: xcode10.2
env: ACTION="xcode";SCHEME="Valet iOS";SDK="iphonesimulator";DESTINATION="platform=iOS Simulator,OS=12.2,name=iPhone X";XCODE_ACTION="build test"
- osx_image: xcode10.2
Expand Down
9 changes: 1 addition & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ let package = Package(
.target(
name: "Valet",
dependencies: []),
.target(
name: "LegacyValet",
dependencies: [],
publicHeadersPath: "Public"),
.testTarget(
name: "ValetTests",
dependencies: ["Valet"])
],
swiftLanguageVersions: [.v4, .v4_2, .v5]
)
let version = Version(3, 2, 5)
let version = Version(3, 2, 7)
9 changes: 9 additions & 0 deletions Scripts/ci.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/bash -l
set -ex

if [ $ACTION == "swift-package" ]; then
swift package generate-xcodeproj --output generated/
if [ -n "$DESTINATION" ]; then
xcodebuild -project generated/Valet.xcodeproj -scheme "Valet-Package" -sdk $SDK -destination "$DESTINATION" -configuration Release -PBXBuildsContinueAfterErrors=0 build
else
xcodebuild -project generated/Valet.xcodeproj -scheme "Valet-Package" -sdk $SDK -configuration Release -PBXBuildsContinueAfterErrors=0 build
fi
fi

if [ $ACTION == "xcode" ]; then
if [ -n "$DESTINATION" ]; then
xcodebuild -UseModernBuildSystem=NO -project Valet.xcodeproj -scheme "$SCHEME" -sdk $SDK -destination "$DESTINATION" -configuration Debug -PBXBuildsContinueAfterErrors=0 $XCODE_ACTION
Expand Down
4 changes: 4 additions & 0 deletions Sources/Valet/SinglePromptSecureEnclaveValet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// limitations under the License.
//

#if os(iOS) || os(macOS)

import LocalAuthentication
import Foundation

Expand Down Expand Up @@ -312,3 +314,5 @@ extension SinglePromptSecureEnclaveValet {
}
}
}

#endif
11 changes: 9 additions & 2 deletions Tests/ValetIntegrationTests/ValetIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ func testEnvironmentIsSigned() -> Bool {

return false
}

return true

if let simulatorVersionInfo = ProcessInfo.processInfo.environment["SIMULATOR_VERSION_INFO"],
simulatorVersionInfo.contains("iOS 13") || simulatorVersionInfo.contains("tvOS 13")
{
// Xcode 11's simulator does not support code-signing.
return false
} else {
return true
}
}


Expand Down
4 changes: 4 additions & 0 deletions Tests/ValetTests/SinglePromptSecureEnclaveTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// limitations under the License.
//

#if os(iOS) || os(macOS)

import Foundation
@testable import Valet
import XCTest
Expand Down Expand Up @@ -66,3 +68,5 @@ class SinglePromptSecureEnclaveTests: XCTestCase
XCTAssertTrue(valet === equivalentValet)
}
}

#endif
Loading

0 comments on commit bb7745c

Please sign in to comment.