From 647f4559d224c8265091098daa4100a805408f2b Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sun, 28 May 2023 17:46:53 -0400 Subject: [PATCH 1/8] Update scripts to add arm64 to Mac builds The two are combined into a fat library via lipo --- scripts/make-swiftgodot-framework | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/make-swiftgodot-framework b/scripts/make-swiftgodot-framework index 079658860..43d01c15d 100755 --- a/scripts/make-swiftgodot-framework +++ b/scripts/make-swiftgodot-framework @@ -22,9 +22,15 @@ esac rm -rf $2 bdMac=$1/Build/Products/Debug/ +bdMacArm="$(echo "$1" | rev | cut -c2- | rev)_arm/Build/Products/Debug/" bdiOS=$1/Build/Products/Debug-iphoneos/ -xcodebuild -create-xcframework -framework $bdMac/PackageFrameworks/SwiftGodot.framework -framework $bdiOS/PackageFrameworks/SwiftGodot.framework -output $2 -fd=$2//macos-x86_64/SwiftGodot.framework +mkdir universal +echo $bdMacArm +cp -rf $bdMac/PackageFrameworks/SwiftGodot.framework universal/ +lipo -create -output ./universal/SwiftGodot.framework/SwiftGodot $bdMac/PackageFrameworks/SwiftGodot.framework/SwiftGodot $bdMacArm/PackageFrameworks/SwiftGodot.framework/SwiftGodot +xcodebuild -create-xcframework -framework ./universal/SwiftGodot.framework -framework $bdiOS/PackageFrameworks/SwiftGodot.framework -output $2 +rm -rf ./universal +fd=$2//macos-arm64_x86_64/SwiftGodot.framework (cd $fd; mkdir -p Versions/Current/Headers; ln -sf Versions/Current/Headers .) (cd $fd; mkdir -p Versions/Current/Modules; ln -sf Versions/Current/Modules .) rsync -a $bdMac/SwiftGodot.swiftmodule $fd/Versions/Current/Modules/ From d9cdaba044c1f9c145d97c8882fc8c20a86f0718 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sun, 28 May 2023 17:54:21 -0400 Subject: [PATCH 2/8] Add missing part of release This got swallowed when I rebased from upstream, whoops --- scripts/release | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/release b/scripts/release index 1e83c2b32..b59366204 100644 --- a/scripts/release +++ b/scripts/release @@ -42,6 +42,7 @@ echo DerivedData: $derivedData echo ArchiveData: $archivePath xcodebuild -scheme SwiftGodot -destination platform=generic/macOS,arch=x86_64 -derivedDataPath $derivedData -archivePath $archivePath >& $dir/x86_64.log +xcodebuild -scheme SwiftGodot -destination platform=generic/macOS,arch=arm64 -derivedDataPath "${derivedData}_arm" -archivePath $archivePath >& $dir/arm64.log xcodebuild -scheme SwiftGodot -destination generic/platform=iOS -derivedDataPath $derivedData -archivePath $archivePath >& $dir/arm64.log sh scripts/make-swiftgodot-framework $dir/derived/ $outputDir/SwiftGodot.xcframework From 60798c59f531f4f48ec69774d078b85124af026d Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sun, 28 May 2023 18:04:30 -0400 Subject: [PATCH 3/8] Support SWIFT_GODOT_NODEPLOY If the environment variable SWIFT_GODOT_NODEPLOY is found, the GitHub deployment steps are skipped. This helps ensure that local builds do not trigger releases in GitHub. --- scripts/release | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/release b/scripts/release index b59366204..0bca9e24b 100644 --- a/scripts/release +++ b/scripts/release @@ -49,6 +49,11 @@ sh scripts/make-swiftgodot-framework $dir/derived/ $outputDir/SwiftGodot.xcframe (cd $outputDir; zip --symlinks -ru SwiftGodot.xcframework.zip SwiftGodot.xcframework) csum=`swift package compute-checksum $outputDir/SwiftGodot.xcframework.zip` +if [ -z "$SWIFT_GODOT_NODEPLOY" ]; then + echo "Skipping deployment stage." + return +fi + gh release create $tag $outputDir/SwiftGodot.xcframework.zip -R migueldeicaza/SwiftGodot -F $2 cat > ../SwiftGodotBinary/Package.swift < Date: Sun, 28 May 2023 18:12:54 -0400 Subject: [PATCH 4/8] Move where deployment stops --- scripts/release | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/release b/scripts/release index 0bca9e24b..ba053fae5 100644 --- a/scripts/release +++ b/scripts/release @@ -12,9 +12,12 @@ if test ! -e scripts/make-swiftgodot-framework; then echo expected this to run from the SwiftGodot directory exit 1 fi -if test ! -e ../SwiftGodotBinary; then - echo expected to have a peer directory SwiftGodotBinary to publish results - exit 1 + +if [ -z "$SWIFT_GODOT_NODEPLOY" ]; then + if test ! -e ../SwiftGodotBinary; then + echo expected to have a peer directory SwiftGodotBinary to publish results + exit 1 + fi fi case $1 in @@ -46,14 +49,14 @@ xcodebuild -scheme SwiftGodot -destination platform=generic/macOS,arch=arm64 -de xcodebuild -scheme SwiftGodot -destination generic/platform=iOS -derivedDataPath $derivedData -archivePath $archivePath >& $dir/arm64.log sh scripts/make-swiftgodot-framework $dir/derived/ $outputDir/SwiftGodot.xcframework -(cd $outputDir; zip --symlinks -ru SwiftGodot.xcframework.zip SwiftGodot.xcframework) -csum=`swift package compute-checksum $outputDir/SwiftGodot.xcframework.zip` - if [ -z "$SWIFT_GODOT_NODEPLOY" ]; then echo "Skipping deployment stage." return fi +(cd $outputDir; zip --symlinks -ru SwiftGodot.xcframework.zip SwiftGodot.xcframework) +csum=`swift package compute-checksum $outputDir/SwiftGodot.xcframework.zip` + gh release create $tag $outputDir/SwiftGodot.xcframework.zip -R migueldeicaza/SwiftGodot -F $2 cat > ../SwiftGodotBinary/Package.swift < Date: Sun, 28 May 2023 18:16:09 -0400 Subject: [PATCH 5/8] Don't tag if SWIFT_GODOT_NODEPLOY --- scripts/release | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/release b/scripts/release index ba053fae5..c69542224 100644 --- a/scripts/release +++ b/scripts/release @@ -18,19 +18,19 @@ if [ -z "$SWIFT_GODOT_NODEPLOY" ]; then echo expected to have a peer directory SwiftGodotBinary to publish results exit 1 fi -fi -case $1 in - v*) - echo Tagging with $1 - git tag $1 - tag=$1 - ;; - *) - echo "version to tag should be vXXX" - exit 1 - ;; -esac + case $1 in + v*) + echo Tagging with $1 + git tag $1 + tag=$1 + ;; + *) + echo "version to tag should be vXXX" + exit 1 + ;; + esac +fi outputDir=$HOME/sg-builds dir=$outputDir/$$-build From 47cbfdcdac5f0beba4424ec706757212246dd00c Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sun, 28 May 2023 18:21:09 -0400 Subject: [PATCH 6/8] Replace return with exit --- scripts/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release b/scripts/release index c69542224..5aaadcc48 100644 --- a/scripts/release +++ b/scripts/release @@ -51,7 +51,7 @@ sh scripts/make-swiftgodot-framework $dir/derived/ $outputDir/SwiftGodot.xcframe if [ -z "$SWIFT_GODOT_NODEPLOY" ]; then echo "Skipping deployment stage." - return + exit fi (cd $outputDir; zip --symlinks -ru SwiftGodot.xcframework.zip SwiftGodot.xcframework) From 2f14b5b5c733e665b537ce587a5e2b0b04b26271 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sun, 28 May 2023 18:27:48 -0400 Subject: [PATCH 7/8] Invert condition --- scripts/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release b/scripts/release index 5aaadcc48..6a90b0a88 100644 --- a/scripts/release +++ b/scripts/release @@ -49,7 +49,7 @@ xcodebuild -scheme SwiftGodot -destination platform=generic/macOS,arch=arm64 -de xcodebuild -scheme SwiftGodot -destination generic/platform=iOS -derivedDataPath $derivedData -archivePath $archivePath >& $dir/arm64.log sh scripts/make-swiftgodot-framework $dir/derived/ $outputDir/SwiftGodot.xcframework -if [ -z "$SWIFT_GODOT_NODEPLOY" ]; then +if [ ! -z "$SWIFT_GODOT_NODEPLOY" ]; then echo "Skipping deployment stage." exit fi From 527e752d43d1df653229487c827327dca925d7af Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sun, 28 May 2023 19:56:27 -0400 Subject: [PATCH 8/8] Copy in arm64 module content --- scripts/make-swiftgodot-framework | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/make-swiftgodot-framework b/scripts/make-swiftgodot-framework index 43d01c15d..2f10c7027 100755 --- a/scripts/make-swiftgodot-framework +++ b/scripts/make-swiftgodot-framework @@ -26,7 +26,7 @@ bdMacArm="$(echo "$1" | rev | cut -c2- | rev)_arm/Build/Products/Debug/" bdiOS=$1/Build/Products/Debug-iphoneos/ mkdir universal echo $bdMacArm -cp -rf $bdMac/PackageFrameworks/SwiftGodot.framework universal/ +cp -rf $bdMacArm/PackageFrameworks/SwiftGodot.framework universal/ lipo -create -output ./universal/SwiftGodot.framework/SwiftGodot $bdMac/PackageFrameworks/SwiftGodot.framework/SwiftGodot $bdMacArm/PackageFrameworks/SwiftGodot.framework/SwiftGodot xcodebuild -create-xcframework -framework ./universal/SwiftGodot.framework -framework $bdiOS/PackageFrameworks/SwiftGodot.framework -output $2 rm -rf ./universal @@ -34,6 +34,7 @@ fd=$2//macos-arm64_x86_64/SwiftGodot.framework (cd $fd; mkdir -p Versions/Current/Headers; ln -sf Versions/Current/Headers .) (cd $fd; mkdir -p Versions/Current/Modules; ln -sf Versions/Current/Modules .) rsync -a $bdMac/SwiftGodot.swiftmodule $fd/Versions/Current/Modules/ +rsync -a $bdMacArm/SwiftGodot.swiftmodule $fd/Versions/Current/Modules/ cat > $fd/Modules/module.modulemap << EOF framework module SwiftGodot {