Skip to content

Support Xcode 8 and Swift 2.3#179

Merged
AliSoftware merged 8 commits intomasterfrom
xcode8-swift2.3
Nov 6, 2016
Merged

Support Xcode 8 and Swift 2.3#179
AliSoftware merged 8 commits intomasterfrom
xcode8-swift2.3

Conversation

@ikesyo
Copy link
Copy Markdown
Collaborator

@ikesyo ikesyo commented Sep 27, 2016

Supersedes #171, #176 and #178. This preserves Xcode 7.3 support.

CocoaPods 1.1.0.rc.2 is required.

@ikesyo ikesyo changed the title Support Xcode 8 and Swift 2.3 [WIP] Support Xcode 8 and Swift 2.3 Sep 27, 2016
…compatible with Swift 2.3

- Commander 0.5.0 is for Swift 3
- PathKit 0.7.0 is for Swift 3
- Stencil 0.6.0 is for Swift 3
@ikesyo ikesyo changed the title [WIP] Support Xcode 8 and Swift 2.3 Support Xcode 8 and Swift 2.3 Sep 27, 2016
This was referenced Sep 27, 2016
@AliSoftware
Copy link
Copy Markdown
Collaborator

Thanks for the PR.

Don't forget to add s CHANGELOG entry; it would be nice to mention the original author of the related PR that made the effort on the 2.3 port as well in that entry

@ikesyo
Copy link
Copy Markdown
Collaborator Author

ikesyo commented Sep 27, 2016

Updated!

@dzenbot
Copy link
Copy Markdown

dzenbot commented Oct 1, 2016

Yay I made it to the changelog! 💪 Thanks!

Copy link
Copy Markdown

@dzenbot dzenbot left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

hey @ikesyo, I tried to compile this on Xcode 8, I saw some issues with dependencies - is this PR supposed to get swiftgen all the way up to Xcode 8 support, or should updating the dependencies be another pull request?

@ikesyo
Copy link
Copy Markdown
Collaborator Author

ikesyo commented Oct 4, 2016

@AndrewSB This should be fine on Xcode 8 with Swift 2.3: https://travis-ci.org/AliSoftware/SwiftGen/jobs/163091175. I'm not sure what the issues you are facing are.

@dzenbot
Copy link
Copy Markdown

dzenbot commented Oct 4, 2016

Xcode 8 sometimes pops up with its migration tool if it's set to Swift 2.3, wanting to update to Swift 3.0. Maybe that's what you mean @AndrewSB ?

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

@dzenbot I do see that popup, but I'm having errors past that. Something related to if let syntax in GenumKit, and missing SWIFT_VERSION flags in the cocoapods frameworks:

screen shot 2016-10-03 at 8 11 38 pm

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

Let me submit a PR with the changes that I needed to get swiftgen to build, so we can talk about if they're needed or not 👍

@dzenbot
Copy link
Copy Markdown

dzenbot commented Oct 4, 2016

Interesting. For the frameworks needing the SWIFT_VERSION flag, I realized that Cocoapods isn't helping with that sometimes, so I fixed it this way on my project:
https://github.com/dzenbot/Iconic/blob/bc1ced02c4b2294040379ba908dffcec2e825396/Samples/Podfile#L26-#L32

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

(submitted #179)

Yeah! It is super weird. Strange that someone hasn't contributed that change to Cocoapods 🤔

@dzenbot
Copy link
Copy Markdown

dzenbot commented Oct 4, 2016

You mean #182 ?

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

I do, thanks @dzenbot #selfretaincycle 😛

@ikesyo
Copy link
Copy Markdown
Collaborator Author

ikesyo commented Oct 4, 2016

@AndrewSB You need CocoaPods 1.1.0.rc.2 to use Xcode 8. This pull request ran pod update with the version.

@ikesyo
Copy link
Copy Markdown
Collaborator Author

ikesyo commented Oct 4, 2016

Interesting. For the frameworks needing the SWIFT_VERSION flag, I realized that Cocoapods isn't helping with that sometimes, so I fixed it this way on my project

@dzenbot CocoaPods 1.1.0 (currently rc.2) now handles the setting correctly.

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

ahh, I see! I'll update to their release candidate then. Thank you for your work @ikesyo 😃

@dzenbot
Copy link
Copy Markdown

dzenbot commented Oct 4, 2016

Good to know @ikesyo!

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

Apologies on dragging this out, but I'm still having issues building this branch:

== Building Binary ==

set -o pipefail && xcrun -sdk macosx swiftc -O -o build/Release/swiftgen -F build/Release/PathKit -F build/Release/Stencil -F build/Release/Commander -F build/Release/GenumKit/ -framework PathKit -framework Stencil -framework Commander -framework GenumKit swiftgen-cli/*.swift | xcpretty -c
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected ':' following argumant label and parameter name
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected type
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected ',' separator
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
                                                                     ,
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected type
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected ',' separator
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
                                                                     ,
swiftgen-cli/ArgumentsUtils.swift:7:8: error: module compiled with Swift 2.3 cannot be imported in Swift 3.0: /Users/asb/Developer/SwiftGen/build/Release/Commander/Commander.framework/Modules/Commander.swiftmodule/x86_64.swiftmodule
import Commander
       ^
rake aborted!
Command failed with status (1): [set -o pipefail && xcrun -sdk macosx swift...]
/Users/asb/Developer/SwiftGen/Rakefile:24:in `xcpretty'
/Users/asb/Developer/SwiftGen/Rakefile:64:in `block in <top (required)>'
Tasks: TOP => install => install:light => build
(See full trace by running task with --trace)

Everything compiles, but the Rakefile fails after that, whilst building the swiftgen binary. Any idea what that could be?

@kgrigsby59
Copy link
Copy Markdown
Contributor

@AndrewSB You could run it as TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 rake install but a better solution would be to specify a toolchain in the xcrun command in the rakefile.

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Oct 4, 2016

that was perfect, thanks @kgrigsby59

On Tue, Oct 4, 2016 at 11:51 AM kgrigsby59 notifications@github.com wrote:

@AndrewSB https://github.com/AndrewSB You could run it as TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3
rake install but a better solution would be to specify a toolchain in the
xcrun command in the rakefile.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#179 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADo1dNjlRqTR3arq9UNxMnJ_oH2oqFzBks5qwp_rgaJpZM4KHP-o
.

@AndrewSB
Copy link
Copy Markdown
Contributor

@AliSoftware this looks good to go, can it be merged in?

@AliSoftware
Copy link
Copy Markdown
Collaborator

👍
Le sam. 29 oct. 2016 à 22:35, Andrew Breckenridge notifications@github.com
a écrit :

@AliSoftware https://github.com/AliSoftware this looks good to go, can
it be merged in?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#179 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANMGWBBKpJLO6woHi3CNuJPeXOObxmrks5q464GgaJpZM4KHP-o
.

@AliSoftware
Copy link
Copy Markdown
Collaborator

The only thing that prevents me to merge that is having some time to do an official release (I keep this PR open to remind me of doing a homebrew release once I've got enough time). That shouldn't take that long but I've been traveling lately and didn't use my Mac much so will need some time off to catch up on all those pending PRs on my various OSS work soon, sorry for the delay!

@plivesey
Copy link
Copy Markdown

plivesey commented Nov 4, 2016

@ikesyo I'm not sure if it's something to do with my personal machine, but rake install doesn't seem to work for me on this branch:

== Building Binary ==

xcrun -sdk macosx swiftc -O -o build/Release/swiftgen -F build/Release/PathKit -F build/Release/Stencil -F build/Release/Commander -F build/Release/GenumKit/ -framework PathKit -framework Stencil -framework Commander -framework GenumKit swiftgen-cli/*.swift
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected ':' following argumant label and parameter name
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected type
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected ',' separator
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
                                                                     ,
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected type
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
swiftgen-cli/ArgumentsUtils.swift:12:71: error: expected ',' separator
func checkPath(type: String, assertion: Path -> Bool) -> (Path throws -> Path) {
                                                                      ^
                                                                     ,
swiftgen-cli/ArgumentsUtils.swift:7:8: error: module compiled with Swift 2.3 cannot be imported in Swift 3.0.1: /Users/plivesey/Repo/temp/SwiftGen/build/Release/Commander/Commander.framework/Modules/Commander.swiftmodule/x86_64.swiftmodule
import Commander
       ^
rake aborted!
Command failed with status (1): [xcrun -sdk macosx swiftc -O -o build/Relea...]
/Users/plivesey/Repo/temp/SwiftGen/Rakefile:26:in `xcpretty'
/Users/plivesey/Repo/temp/SwiftGen/Rakefile:64:in `block in <top (required)>'
Tasks: TOP => install => install:light => build
(See full trace by running task with --trace)

It seems like swiftc is running with Swift 3, but everything is compile with Swift 2.3. My guess is we need to add a flag to:

xcpretty %Q(xcrun -sdk macosx swiftc -O -o #{BUILD_DIR}/#{BIN_NAME} #{search_paths}/ #{frameworks} swiftgen-cli/*.swift)

which includes the swift version. I can't work out how to do this though...

Thoughts? Or is this working for you?

@plivesey
Copy link
Copy Markdown

plivesey commented Nov 4, 2016

Looks like it gets further here if you change to:

xcpretty %Q(TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 xcrun -sdk macosx swiftc -O -o #{BUILD_DIR}/#{BIN_NAME} #{search_paths}/ #{frameworks} swiftgen-cli/*.swift)

But then fails later when it does other toolchain stuff...which I don't understand :/

@ikesyo
Copy link
Copy Markdown
Collaborator Author

ikesyo commented Nov 5, 2016

@plivesey Did you see #179 (comment)? Specifying a toolchain explicitly in Rakefile makes it difficult to support both Xcode 7.3 and Xcode 8.

That would be fine if dropping Xcode 7.3 support is okay.

@AliSoftware AliSoftware merged commit 2393e98 into master Nov 6, 2016
@dzenbot
Copy link
Copy Markdown

dzenbot commented Nov 6, 2016

🎉 💯

@AliSoftware AliSoftware deleted the xcode8-swift2.3 branch November 6, 2016 17:18
@AliSoftware
Copy link
Copy Markdown
Collaborator

Finally, I've found some time to merge this!

@plivesey @ikesyo @AndrewSB I've fixed the Rakefile in aa6ed1d so that now it:

  • auto-selects the latest Xcode 8 found in your machine… even if it's not your default Xcode (using DEVELOPER_DIR=… instead of forcing you to xcode-select -s)
  • raises if no Xcode 8 is found on your machine at all
  • forces TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 too

So now SwiftGen is officially Swift 2.3 (and thus only supporting Xcode 8)! 🎉

Next step: Swift 3.0 conversion… but that's for another day!

@zmwangx
Copy link
Copy Markdown

zmwangx commented Nov 6, 2016

@AliSoftware Would you consider putting out a patch release for Homebrew? Thanks.

@AliSoftware
Copy link
Copy Markdown
Collaborator

@zmwangx That's the plan 👍

@zmwangx
Copy link
Copy Markdown

zmwangx commented Nov 6, 2016

Cool, thanks.

@AndrewSB
Copy link
Copy Markdown
Contributor

AndrewSB commented Nov 6, 2016

🎉🎉🎉 thanks @AliSoftware!

@AliSoftware
Copy link
Copy Markdown
Collaborator

3.0.1 should already be available thru CocoaPods.
Pull Request for the Homebrew release has been open, waiting for the Homebrew crew to merge.

@plivesey
Copy link
Copy Markdown

plivesey commented Nov 7, 2016

Thanks @AliSoftware and @ikesyo :). I couldn't work this all out on my own, but working after rebasing. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants