Skip to content
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

Support Linux by upgrading XcodeProj and Spectre #988

Merged
merged 8 commits into from
Nov 24, 2020

Conversation

elliottwilliams
Copy link
Contributor

Hey there – I've been working upstream changes to XcodeProj and Spectre to get XcodeGen building and running on Linux hosts. Since both projects have made releases, I'm ready to move on to XcodeGen itself!

Linux support is obviously a little esoteric, but I think it's valuable for users that want to integrate XcodeGen into automated systems which are linux-based. For example: at Yelp, we have a ton of Linux CI capacity and lots of infra that makes it easy to run git-based workflows on linux servers, and being able to use XcodeGen from them would simplify things.

This branch passes tests on Ubuntu 18.04 using Docker and the official swift 5.3 image:

docker run -itv $PWD:/code -u $(id -u $USER):$(id -g $USER) swift:5.3 \
swift test --package-path /code --enable-test-discovery

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic, nice work across all 3 repos @elliottwilliams! 👏
Could you please add a changelog entry as well, under Added

@@ -42,7 +42,7 @@ class GlobTests: XCTestCase {
}

private func newTmpDir() -> String {
var tmpDirTmpl = "/tmp/glob-test.XXXXX".cString(using: .utf8)!
var tmpDirTmpl = "/tmp/glob-test.XXXXXX".cString(using: .utf8)!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, what caused this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a weird one! In glibc, mkstemp requires that exactly six characters are X's:

The last six characters of template must be "XXXXXX" and these are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be declared as a character array.

The BSD call only asks for "some number of `Xs' appended to it".

tests += ProjectSpecTests.__allTests()
tests += XcodeGenKitTests.__allTests()

XCTMain(tests)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could potentially replace the contents of this file with

// LinuxMain.swift
fatalError("Run the tests with `swift test --enable-test-discovery`.")

And then delete all the XCTestManifests, as per https://oleb.net/2020/swift-test-discovery/

Sources/Core/Glob.swift Outdated Show resolved Hide resolved
@yonaskolb yonaskolb merged commit 2601d39 into yonaskolb:master Nov 24, 2020
@elliottwilliams
Copy link
Contributor Author

Thanks so much for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants