Skip to content

Commit

Permalink
SPM package for iOS core & Test Tools
Browse files Browse the repository at this point in the history
  • Loading branch information
breautek committed Dec 19, 2024
1 parent 7a6df85 commit c1ed79f
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 95 deletions.
1 change: 1 addition & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/Pods
/third_party
!/third_party/README
Package.swift
21 changes: 0 additions & 21 deletions ios/BTFuse.podspec.template

This file was deleted.

2 changes: 1 addition & 1 deletion ios/BTFuse/BTFuse.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
LastUpgradeCheck = 1510;
TargetAttributes = {
94A886B52A714F6D0098530D = {
LastSwiftMigration = 1600;
LastSwiftMigration = 1620;
};
94B7A9CB2AC89E39003D294D = {
CreatedOnToolsVersion = 15.0;
Expand Down
21 changes: 0 additions & 21 deletions ios/BTFuseTestTools.podspec.template

This file was deleted.

44 changes: 44 additions & 0 deletions ios/Package.template.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// swift-tools-version:6.0

import PackageDescription

/*
Copyright 2025 Breautek

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

let package = Package(
name: "BTFuse",
platforms: [.iOS(.v15)],
products: [
.library(name: "BTFuse", targets: ["BTFuse"]),
.library(name: "BTFuseTestTools", targets: ["BTFuseTestTools"])
],
targets: [
.binaryTarget(
name: "BTFuse",
url: "https://github.com/btfuse/fuse/releases/tag/ios/core/$VERSION$/BTFuse.xcframework.zip",
checksum: "$CORE_CHECKSUM$"
),
.binaryTarget(
name: "BTFuseTestTools",
url: "https://github.com/btfuse/fuse/releases/tag/ios/core/$VERSION$/BTFuseTestTools.xcframework.zip",
checksum: "$TESTTOOLS_CHECKSUM$"
),
.target(
name: "BTFuseTestTools",
dependencies: ["BTFuse"]
)
]
)
37 changes: 20 additions & 17 deletions ios/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ if [ "$CI" != "true" ]; then
fi
fi

DIST_DIR="dist/ios/core"

echo "Building Fuse iOS Framework $(cat ./VERSION)..."

rm -rf dist
mkdir -p dist
rm -rf $DIST_DIR
mkdir -p $DIST_DIR

echo "Cleaning the workspace..."
# Clean the build
Expand Down Expand Up @@ -90,24 +92,24 @@ else
assertLastCall
fi

cp -r $iosBuild/BTFuse.framework.dSYM ./dist/
cp -r $iosTestToolsBuild/BTFuseTestTools.framework.dSYM ./dist
cp -r $iosBuild/BTFuse.framework.dSYM $DIST_DIR
cp -r $iosTestToolsBuild/BTFuseTestTools.framework.dSYM $DIST_DIR

echo "Packing XCFramework..."
xcodebuild -create-xcframework \
-framework $iosBuild/BTFuse.framework \
-debug-symbols $iosBuild/BTFuse.framework.dSYM \
-framework $simBuild/BTFuse.framework \
-output dist/BTFuse.xcframework
-output $DIST_DIR/BTFuse.xcframework
assertLastCall
xcodebuild -create-xcframework \
-framework $iosTestToolsBuild/BTFuseTestTools.framework \
-debug-symbols $iosTestToolsBuild/BTFuseTestTools.framework.dSYM \
-framework $simTestToolsBuild/BTFuseTestTools.framework \
-output dist/BTFuseTestTools.xcframework
-output $DIST_DIR/BTFuseTestTools.xcframework
assertLastCall

spushd dist
spushd $DIST_DIR
zip -r BTFuse.xcframework.zip BTFuse.xcframework > /dev/null
zip -r BTFuse.framework.dSYM.zip BTFuse.framework.dSYM > /dev/null
zip -r BTFuseTestTools.xcframework.zip BTFuseTestTools.xcframework > /dev/null
Expand All @@ -119,17 +121,18 @@ spushd dist
spopd

VERSION=$(cat ./VERSION)
FUSE_CHECKSUM=$(cat ./dist/BTFuse.xcframework.zip.sha1.txt)
TESTTOOLS_CHECKSUM=$(cat ./dist/BTFuseTestTools.xcframework.zip.sha1.txt)
FUSE_CHECKSUM=$(cat $DIST_DIR/BTFuse.xcframework.zip.sha1.txt)
TESTTOOLS_CHECKSUM=$(cat $DIST_DIR/BTFuseTestTools.xcframework.zip.sha1.txt)

btfusePodSpecTemplate=$(<BTFuse.podspec.template)
btfuseTestToolsPodSpecTemplate=$(<BTFuseTestTools.podspec.template)
btfuseSPMTemplate=$(<Package.template.swift)
# btfuseTestToolsPodSpecTemplate=$(<BTFuseTestTools.podspec.template)

btfusePodSpecTemplate=${btfusePodSpecTemplate//\$VERSION\$/$VERSION}
btfusePodSpecTemplate=${btfusePodSpecTemplate//\$CHECKSUM\$/$FUSE_CHECKSUM}
btfuseTestToolsPodSpecTemplate=${btfuseTestToolsPodSpecTemplate//\$VERSION\$/$VERSION}
btfuseTestToolsPodSpecTemplate=${btfuseTestToolsPodSpecTemplate//\$CHECKSUM\$/$TESTTOOLS_CHECKSUM}
btfuseSPMTemplate=${btfuseSPMTemplate//\$VERSION\$/$VERSION}
btfuseSPMTemplate=${btfuseSPMTemplate//\$CORE_CHECKSUM\$/$FUSE_CHECKSUM}
btfuseSPMTemplate=${btfuseSPMTemplate//\$TESTTOOLS_CHECKSUM\$/$TESTTOOLS_CHECKSUM}
# btfuseTestToolsPodSpecTemplate=${btfuseTestToolsPodSpecTemplate//\$VERSION\$/$VERSION}
# btfuseTestToolsPodSpecTemplate=${btfuseTestToolsPodSpecTemplate//\$CHECKSUM\$/$TESTTOOLS_CHECKSUM}

# Write the final result to BTFuse.podspec
echo "$btfusePodSpecTemplate" > BTFuse.podspec
echo "$btfuseTestToolsPodSpecTemplate" > BTFuseTestTools.podspec
echo "$btfuseSPMTemplate" > $DIST_DIR/Package.swift
# echo "$btfuseTestToolsPodSpecTemplate" > BTFuseTestTools.podspec
42 changes: 33 additions & 9 deletions ios/makeRelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,39 @@ git push
git tag -a ios/core/$VERSION -m "iOS Release: $VERSION"
git push --tags

DIST_DIR="dist/ios/core"

gh release create ios/core/$VERSION \
./dist/BTFuse.xcframework.zip \
./dist/BTFuse.xcframework.zip.sha1.txt \
./dist/BTFuse.framework.dSYM.zip \
./dist/BTFuse.framework.dSYM.zip.sha1.txt \
./dist/BTFuseTestTools.xcframework.zip \
./dist/BTFuseTestTools.xcframework.zip.sha1.txt \
./dist/BTFuseTestTools.framework.dSYM.zip \
./dist/BTFuseTestTools.framework.dSYM.zip.sha1.txt \
$DIST_DIR/BTFuse.xcframework.zip \
$DIST_DIR/BTFuse.xcframework.zip.sha1.txt \
$DIST_DIR/BTFuse.framework.dSYM.zip \
$DIST_DIR/BTFuse.framework.dSYM.zip.sha1.txt \
$DIST_DIR/BTFuseTestTools.xcframework.zip \
$DIST_DIR/BTFuseTestTools.xcframework.zip.sha1.txt \
$DIST_DIR/BTFuseTestTools.framework.dSYM.zip \
$DIST_DIR/BTFuseTestTools.framework.dSYM.zip.sha1.txt \
--verify-tag --generate-notes

./podPublish.sh
assertLastCall

spushd $DIST_DIR
rm -rf btfuse-core-spm

git clone --depth 1 [email protected]:btfuse/btfuse-core-spm.git
assertLastCall

cp ./Package.swift btfuse-core-spm/Package.swift
assertLastCall

spushd btfuse-core-spm
git add Package.swift
git commit -m "Release: $VERSION"
assertLastCall
git tag -a $VERSION -m "Release: $VERSION"
assertLastCall
git push
assertLastCall
git push --tags
assertLastCall
spopd
spopd
26 changes: 0 additions & 26 deletions ios/podPublish.sh

This file was deleted.

0 comments on commit c1ed79f

Please sign in to comment.