Initial build script for creating a portals-dev build of Capacitor that

is aligned with mainline Capacitor versions. Initial build is manual.
This commit is contained in:
Steven Sherry 2022-04-14 10:40:34 -05:00
commit 98d4ab80ec
No known key found for this signature in database
GPG key ID: 6C07B855139186A2
3 changed files with 130 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
capacitor-checkout
*.zip
.swiftpm

30
Package.swift Normal file
View file

@ -0,0 +1,30 @@
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "capacitor-swift-pm",
products: [
.library(
name: "Capacitor",
targets: ["Capacitor"]
),
.library(
name: "Cordova",
targets: ["Cordova"]
),
],
dependencies: [],
targets: [
.binaryTarget(
name: "Capacitor",
url: "https://github.com/ionic-team/capacitor-swift-pm/releases/download/3.4.3/Capacitor.xcframework.zip",
checksum: "c54a0c7ddb7a887fdb741c933596bc6eb18741f1b17a404f2acc18e78a1094a1"
),
.binaryTarget(
name: "Cordova",
url: "https://github.com/ionic-team/capacitor-swift-pm/releases/download/3.4.3/CapacitorCordova.xcframework.zip",
checksum: "903aae3aa3b36a6c294ab87732aa43ce76fe47dfa3c08b5c958749fa5c706032"
)
]
)

96
build-cap Executable file
View file

@ -0,0 +1,96 @@
#!/bin/bash -eoux pipefail
portals_dev_release_commit() {
git log --oneline | grep -B 1 "Release $1" | head -n1 | sed 's/ /\n/g' | head -n1 | xargs git checkout
}
build_capacitor_simulator() {
xcodebuild archive \
-scheme Capacitor \
-workspace Capacitor.xcworkspace \
-destination "generic/platform=iOS Simulator" \
-archivePath ./Build/iOS-Simulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
}
build_capacitor_ios() {
xcodebuild archive \
-scheme Capacitor \
-workspace Capacitor.xcworkspace \
-destination "generic/platform=iOS" \
-archivePath ./Build/iOS \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
}
create_xcframeworks() {
build_capacitor_simulator
build_capacitor_ios
xcodebuild -create-xcframework \
-framework ./Build/iOS-Simulator.xcarchive/Products/Library/Frameworks/Capacitor.framework \
-framework ./Build/iOS.xcarchive/Products/Library/Frameworks/Capacitor.framework \
-output Capacitor.xcframework
xcodebuild -create-xcframework \
-framework ./Build/iOS-Simulator.xcarchive/Products/Library/Frameworks/Cordova.framework \
-framework ./Build/iOS.xcarchive/Products/Library/Frameworks/Cordova.framework \
-output Cordova.xcframework
zip -r Capacitor.xcframework.zip Capacitor.xcframework
zip -r Cordova.xcframework.zip Cordova.xcframework
}
write_package_file() {
cat << EOF > Package.swift
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "capacitor-swift-pm",
products: [
.library(
name: "Capacitor",
targets: ["Capacitor"]
),
.library(
name: "Cordova",
targets: ["Cordova"]
),
],
dependencies: [],
targets: [
.binaryTarget(
name: "Capacitor",
url: "$1",
checksum: "$2"
),
.binaryTarget(
name: "Cordova",
url: "$3",
checksum: "$4"
)
]
)
EOF
}
git clone https://github.com/ionic-team/capacitor capacitor-checkout
cd capacitor-checkout/ios/Capacitor
git checkout portals-dev
#portals_dev_release_commit $1
create_xcframeworks
cap_url="https://github.com/ionic-team/capacitor-swift-pm/releases/download/$1/Capacitor.xcframework.zip"
cap_sha=$(sha256sum Capacitor.xcframework.zip | sed 's/ /\n/g' | head -n1 | xargs echo -n)
cap_cordova_url="https://github.com/ionic-team/capacitor-swift-pm/releases/download/$1/CapacitorCordova.xcframework.zip"
cap_cordova_sha=$(sha256sum Cordova.xcframework.zip | sed 's/ /\n/g' | head -n1 | xargs echo -n)
cd ../../../
write_package_file $cap_url $cap_sha $cap_cordova_url $cap_cordova_sha