-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift package manager support #73
Changes from 9 commits
2aeddbd
05bf725
e3b4aef
1d402a4
6648316
08669fd
e95a58e
2ff5967
54d8d41
13118e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
language: objective-c # lol | ||
osx_image: xcode9.2 | ||
language: objective-c | ||
osx_image: xcode9.3 | ||
xcode_project: DVR.xcodeproj | ||
|
||
script: xcodebuild -scheme "$TRAVIS_XCODE_SCHEME" -sdk "$TRAVIS_XCODE_SDK" -destination "$DESTINATION" test | ||
|
||
matrix: | ||
include: | ||
- xcode_scheme: DVR-iOS | ||
xcode_sdk: iphonesimulator | ||
env: | ||
- DESTINATION="OS=10.1,name=iPhone 7 Plus" | ||
- DESTINATION="iOS Simulator,OS=11.3,name=iPhone X" | ||
- xcode_scheme: DVR-macOS | ||
xcode_sdk: macosx | ||
env: | ||
- DESTINATION="arch=x86_64" | ||
- DESTINATION="OS X" | ||
- env: | ||
- SWIFT_BUILD=true | ||
|
||
script: | ||
- ./Scripts/travis-build-test.sh | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// swift-tools-version:4.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "DVR", | ||
products: [ | ||
.library( | ||
name: "DVR", | ||
targets: ["DVR"]) | ||
], | ||
targets: [ | ||
.target(name: "DVR"), | ||
.testTarget( | ||
name: "DVRTests", | ||
dependencies: ["DVR"]) | ||
] | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
set -x -o pipefail | ||
|
||
if [[ "$SWIFT_BUILD" == "true" ]]; then | ||
swift build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes exactly 👌 |
||
exit 0 | ||
fi | ||
|
||
# -jobs -- specify the number of concurrent jobs | ||
# `sysctl -n hw.ncpu` -- fetch number of 'logical' cores in macOS machine | ||
xcodebuild -jobs `sysctl -n hw.ncpu` test -project DVR.xcodeproj -scheme ${TRAVIS_XCODE_SCHEME} -sdk ${TRAVIS_XCODE_SDK} \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this script taken from the Travis macOS config script? Is there a way we could shell out to that instead (so that we don't need to duplicate the code)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, I'm not sure I understand. This is not a duplicate exactly of the script that was inlined int eh travis.yml previously. It's standard
The travis yml is calling this script, as opposed to inlining the Am I understanding correctly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, my question was more around "is there a version of this command that comes in the Travis container that we can use instead of rewriting it ourselves?" That is, we can supply these Travis-specific env vars in the .travis.yml, and Travis will generate an I don't think this should be a major blocker, but if we can figure out how to use the Travis env vars to generate an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That said, I can't seem to find any documentation about this in the Travis docs. We can skip over this for now, unless you want to do any more digging or reverse engineering 😛 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh I see @eliperkins . I'm not too sure to be honest. I just googled around for a bundled build.sh for mac builds on travis but didn't find anything myself (it was a quick google to fair). I'm not sure how different it is to delegate to a bash script, as you could see before my change the The build is passing again, and I reverted the one env variable for the platform specification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good with me! Let's keep this as it is in this PR. My main concern here was duplicating the usage of the Travis-specific variables. If Travis is going to dictate the API for variables like Given that we can't seem to find how they use these variables beyond what we see in the output, I think it's fine to just roll our own. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool. i can investigate more as well and try to de-dup in my follow-up which i'm interested in #80 always happy to improve CI setup |
||
-destination "platform=${DESTINATION}" ONLY_ACTIVE_ARCH=YES CODE_SIGNING_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import Foundation | ||
|
||
final class SessionDownloadTask: URLSessionDownloadTask { | ||
|
||
// MARK: - Types | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import Foundation | ||
|
||
final class SessionUploadTask: URLSessionUploadTask { | ||
|
||
// MARK: - Types | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,8 +86,7 @@ class SessionUploadTests: XCTestCase { | |
} | ||
|
||
private func writeDataToFile(_ data: Data, fileName: String) -> URL { | ||
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] | ||
let documentsURL = URL(fileURLWithPath: documentsPath, isDirectory: true) | ||
let documentsURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this should throw instead of crashing... Not a blocker for this PR! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, i just figured since it's in the testing suite it didn't matter too much. if you think it's ok for now, i'll leave it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this is totally fine! Either way, the test suite would crash anyway. |
||
let url = documentsURL.appendingPathComponent(fileName + ".tmp") | ||
|
||
try? data.write(to: url, options: [.atomic]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this need to change? I think we want to prefer attribute-based selection of destinations, rather than names (which Travis could change from underneath us at any time).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try reverting this change and see how it goes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it turns out that both the platform and the architecture must be specified. the final command (with env variables filled in) is:
I'm hoping Apple doesn't change the operating system name that often :-D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I think
"platform=macOS,arch=x86_64"
is much better thanOS X
.(especially when we need to do
"platform=macOS,arch=arm64"
down the line 😉 )