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

Update release packaging for Xcode 15/visionOS #8309

Merged
merged 9 commits into from
Jul 25, 2023
Merged

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Jul 18, 2023

Most of this is cleanup of old legacy cruft that hasn't been needed for years.

Rather than a separate target, this switches to using a different configuration for the static framework build. This eliminates most of the duplication and hacks involved.

There's now just a single release package rather than separate objc and swift ones. As we no longer have to deal with the backwards-compatiblity issues from bitcode, only the obj-c framework built with the most recent version of Xcode is included rather than one per Xcode version as is done with Swift. The root directory contains the dynamic xcframework that most people should be using, and the static xcframework is in the static subdirectory. The static framework now could contain slices for all platforms rather than just iOS, but in practice that was a bit over 2 GB, so it continues to only include iOS to make the download a reasonable size.

RLMPlatform.h was made obsolete by XCFrameworks. Prior to those you had to manually link the correct Framework for your platform, and picking the wrong one resulted in linker errors that users didn't understand. Thankfully, that's no longer applicable.

The actual release publishing is now in a Jenkins declarative pipeline rather than being scattered over a bunch of different Jenkins jobs. A bunch of the incidental logic is now in build.sh rather than being tied specifically to Jenkins, which hopefully will help with migrating away from it.

REALM_SWIFT_VERSION was a legacy of the Swift 1/2/3 migration period where each version of the Swift compiler supported several different language versions and specifically selecting both the Xcode and Swift versions was required. Swift 4 moved away from that, and it now just complicated the logic.

Carthage has now had support for XCFrameworks for a few years and no one should be using the old fat frameworks any more, so stop publishing them.

Historically we didn't enable LTO because it made the build dramatically slower for tiny benefits, but the (relatively) new ThinLTO mostly eliminates the speed hit and meaningfully reduces the size of the binaries.

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved

REALM_HIDE_SYMBOLS = NO;
REALM_OTHER_LDFLAGS_NO = ;
REALM_OTHER_LDFLAGS_YES = -Xlinker -unexported_symbols_list -Xlinker Configuration/Realm/PrivateSymbols.txt;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the need to use a file for the xlinker settings instead of declaring it here?, or this the way to do it?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just incredibly unwieldily to pass multiple exclusions on the command line. This currently doesn't add the flag to the cocoapods build, but if we add that then it's nice to not have to duplicate it for that.

@@ -5,6 +5,8 @@ x.y.z Release notes (yyyy-MM-dd)
release package. visionOS currently requires installing Realm via either
Swift Package Manager or by using a XCFramework as CocoaPods and Carthage do
not yet support it.
* Zips compatible with SPM's `.binaryTarget()` are now published as part of the
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this related to this feature request?, can we link it?

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -19,7 +19,7 @@ target:
- swiftpm-thread
- ios-xcode-spm
- ios-static
- ios-dynamic
Copy link
Contributor

Choose a reason for hiding this comment

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

On the commit , it is mentioned that removing the static target and adding the configuration added some problems, what are this problems, how did you solve them?

Copy link
Member Author

Choose a reason for hiding this comment

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

It complicates the test build a bit to work with both static and dynamic linking, but it ended up being pretty minor.

Jenkinsfile.publish Outdated Show resolved Hide resolved
@@ -0,0 +1,177 @@
def carthageXcodeVersion = '14.3.1'
Copy link
Contributor

Choose a reason for hiding this comment

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

This file will replace Jenkinsfile.releasability when this merged on the cocoa-pipeline? Or it is just another pipeline to publish?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a second pipeline which publishes the things built by the first one. This one is run by the new manually-triggered Publish Cocoa Release job which will replace the cocoa-release job.

Realm.xcodeproj/xcshareddata/xcschemes/Realm.xcscheme Outdated Show resolved Hide resolved
build.sh Show resolved Hide resolved
Copy link
Contributor

@dianaafanador3 dianaafanador3 left a comment

Choose a reason for hiding this comment

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

Pretty good job, moving release pipelines from the Jenkins file to build.sh. This will make the migration to Xcode cloud easier.
Some minor comments and some questions

Rather than a separate target, this switches to using a different configuration
for the static framework build. This eliminates most of the duplication and
hacks involved, while unsurprisingly introducing a few new and different problems.

There's now just a single release package rather than separate objc and swift
ones. As we no longer have to deal with the backwards-compatiblity issues from
bitcode, only the obj-c framework built with the most recent version of Xcode
is included rather than one per Xcode version as is done with Swift. The root
directory contains the dynamic xcframework that most people should be using,
and the static xcframework is in the `static` subdirectory. The static
framework now contains slices for all platforms rather than just iOS.
This was intended to catch places where users were trying to use a framework
for the wrong platform, and XCFrameworks should render this obsolete as they no
longer have to manually link the correct platform.
Carthage has had xcframework support for about two years now and the legacy fat
frameworks are pretty severely broken so no one should be using them any more.
This was a legacy of the Swift 1/2/3 migrations where the compiler supported
two different versions of Swift by shipping two different copies of the
frontend built in different modes and we actually built for different Swift
versions. These days we just build once with each Swift compiler version and
don't care about the Swift version, so this logic just complicated things.
@tgoyne tgoyne merged commit 00bd811 into master Jul 25, 2023
@tgoyne tgoyne deleted the tg/xcode-15-packaging branch July 25, 2023 15:20
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants