Skip to content

cmd/gomobile: support macOS and Catalyst #65

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

Closed
wants to merge 24 commits into from

Conversation

ydnar
Copy link
Contributor

@ydnar ydnar commented Apr 13, 2021

Add support for macOS (non-Catalyst) and Catalyst targets.

The compiled library is packaged into a "fat" XCFramework file (as
opposed to a Framework), which includes binaries for iOS, macOS,
MacCatalyst (iOS on macOS), and iOS Simulator targets, for amd64 and
arm64 architectures.

The generated XCFramework file is suitable for distribution as a binary
Swift Package Manager package:
https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages

This change is based on earlier work:
#45
#63

Fixes golang/go#36856

@google-cla
Copy link

google-cla bot commented Apr 13, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Apr 13, 2021
@ydnar
Copy link
Contributor Author

ydnar commented Apr 13, 2021

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Apr 13, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@dpwiese
Copy link

dpwiese commented Apr 16, 2021

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Apr 16, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@waylybaye
Copy link

@googlebot I consent.

@google-cla google-cla bot added cla: yes and removed cla: no labels Apr 17, 2021
@gopherbot
Copy link
Contributor

This PR (HEAD: fb6ffaf) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/mobile/+/310949 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://golang.org/doc/contribute.html#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@nadimkobeissi
Copy link

This is a pretty exciting and important PR, any idea when it will get merged? Thank you for your contributions.

@imWildCat
Copy link

cc @hyangah

@ydnar ydnar changed the title Catalyst + macOS support mobile: support macOS and Catalyst May 24, 2021
@nadimkobeissi
Copy link

Bump :-)

@deepumukundan
Copy link

Thanks for the contributions. Seems like gopherbot has not assigned any reviewers here and no activity is seen at https://go-review.googlesource.com/c/mobile/+/310949. I know gomobile is experimental and all, but still this is a pretty important change (With Catalyst and SPM being around for 2+ years for public) and no way for us to bump up the priority for someone from google to take a look at. 😿 . Will pinging @gopherbot in the thread help? Just trying out here.

@nadimkobeissi
Copy link

cc. @hajimehoshi maybe?

@ydnar
Copy link
Contributor Author

ydnar commented Jul 8, 2021

cc. @hajimehoshi maybe?

Happy to work with whomever wants to review this. I’d love to see this merged. 👍

@gopherbot
Copy link
Contributor

Message from Hajime Hoshi:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Hajime Hoshi:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

dpwiese and others added 6 commits July 8, 2021 10:00
create one framework for all targets: ios, simulator and catalyst, every
framework contains at least one arch library, and combine all framework
into one xcframework
Adds macosx on amd64 and arm64 targets to the fat xcframework.

This enables the generated xcframework to be used as a binary dependency in Swift Package Manager:

https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages

and used or tested using the SwiftPM command-line tools on macOS, e.g. 'swift test'
@ydnar ydnar force-pushed the support-catalyst branch from fb6ffaf to b678ba0 Compare July 8, 2021 17:02
@gopherbot
Copy link
Contributor

This PR (HEAD: b678ba0) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/mobile/+/310949 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Hajime Hoshi:

Patch Set 16:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 221210c) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/mobile/+/310949 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Hajime Hoshi:

Patch Set 17: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 17:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Randy Reddig:

Patch Set 16:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 17: TryBot-Result+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Hajime Hoshi:

Patch Set 17: Code-Review+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Hyang-Ah Hana Kim:

Patch Set 17:

(6 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 623f8f3) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/mobile/+/310949 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Randy Reddig:

Patch Set 17:

(7 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Hyang-Ah Hana Kim:

Patch Set 18: Run-TryBot+1 Code-Review+2 Trust+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 18:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 18: TryBot-Result+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Randy Reddig:

Patch Set 18:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/310949.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Jul 10, 2021
Add support for macOS (non-Catalyst) and Catalyst targets.

The compiled library is packaged into a "fat" XCFramework file (as
opposed to a Framework), which includes binaries for iOS, macOS,
MacCatalyst (iOS on macOS), and iOS Simulator targets, for amd64 and
arm64 architectures.

The generated XCFramework file is suitable for distribution as a binary
Swift Package Manager package:
https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages

This change is based on earlier work:
#45
#63

Fixes golang/go#36856

Change-Id: Iabe535183c7215c68838d6c8f31618d8bceefdcf
GitHub-Last-Rev: 623f8f3
GitHub-Pull-Request: #65
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/310949
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Hajime Hoshi <[email protected]>
Trust: Hyang-Ah Hana Kim <[email protected]>
Trust: Hajime Hoshi <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: Go Bot <[email protected]>
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/310949 has been merged.

@gopherbot gopherbot closed this Jul 10, 2021
@nadimkobeissi
Copy link

Thank you so much!

gopherbot pushed a commit that referenced this pull request Sep 17, 2021
This is is a follow-up from my previous PR (#65). It makes gomobile
aware of GOOS=ios and adds support for specifying specific Apple
platforms, instead of overloading the "ios" platform.

Supported platforms: ios, iossimulator, macos, and maccatalyst

These can now be specified the -target argument to gomobile, e.g.:
gomobile build -target=ios,iossimulator,macos,maccatalyst

It preserves the current behavior of -target=ios, which will build for
ios and iossimulator on supported architectures (arm64 and amd64).

It adds platform-specific build tags so Go code can discriminate between
different Apple platforms like maccatalyst (UIKit on macOS).

This PR also fixes a number of broken tests.

TODO: cgo has a bug where c-archive builds targeting Catalyst will fail
unless -tags=ios is supplied. See https://golang.org/issues/47228

Fixes https://golang.org/issues/47212
Updates https://golang.org/issues/47228

Change-Id: Ib1a2f5302c5edd0704c13ffbe8f4061211f50d4e
GitHub-Last-Rev: 01ab28e
GitHub-Pull-Request: #70
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/334689
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Trust: Hyang-Ah Hana Kim <[email protected]>
Trust: Hajime Hoshi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x/mobile: enable building frameworks for Catalyst
8 participants