Compare commits

..

No commits in common. "ai/forgejo-capacitor-8-5-2" and "3.6.0" have entirely different histories.

11 changed files with 94 additions and 208 deletions

View file

@ -1,59 +0,0 @@
name: Build and Release
on:
workflow_call:
inputs:
release-version:
required: true
type: string
draft-flag:
type: string
default: " "
secrets:
XCFRAMEWORK_SIGNING_TOKEN:
required: true
jobs:
build:
runs-on: macos-15
timeout-minutes: 30
steps:
- name: Validate release version
run: |
version="${{ inputs.release-version }}"
major="${version%%.*}"
if [[ ! "$major" =~ ^[0-9]+$ ]] || (( major < 6 || major > 8 )); then
echo "::error::Capacitor $version is not supported by this repository. Starting with Capacitor 9 (see https://github.com/ionic-team/capacitor/pull/8588 PR), the iOS platform is a source-first Swift package built directly from the ionic-team/capacitor repository, so SPM distribution no longer happens here. This repository only releases major versions 6, 7, and 8."
exit 1
fi
- run: |
if [[ "${{ inputs.release-version }}" =~ ^[67]\. ]]; then
sudo xcode-select --switch /Applications/Xcode_16.2.app
else
sudo xcode-select --switch /Applications/Xcode_26.0.app
fi
- uses: actions/checkout@v7
- name: Install dependencies
run: brew install ghr
- name: Check Simulators
run: xcrun simctl list > /dev/null
- name: Install Simulators
run: xcodebuild -downloadPlatform iOS
- name: Build Capacitor and Cordova
run: ./build-cap ${{ inputs.release-version }}
- name: Sign Capacitor xcframework
uses: ionic-team/sign-xcframework@main
with:
cert-token: ${{ secrets.XCFRAMEWORK_SIGNING_TOKEN }}
xcframework-path: Capacitor.xcframework
- name: Sign Cordova xcframework
uses: ionic-team/sign-xcframework@main
with:
cert-token: ${{ secrets.XCFRAMEWORK_SIGNING_TOKEN }}
xcframework-path: Cordova.xcframework
- name: Package Capacitor and Cordova
run: ./package-cap ${{ inputs.release-version }}
- name: Push manifest update
uses: EndBug/add-and-commit@v9
- name: Create Release
run: ghr -token ${{ secrets.GITHUB_TOKEN }} -name ${{ inputs.release-version }} ${{ inputs.draft-flag }} -replace ${{ inputs.release-version }} frameworks

View file

@ -1,21 +0,0 @@
name: Dispatch Release
on:
workflow_dispatch:
inputs:
release-version:
description: The version to release
required: true
type: string
draft-flag:
description: "Create a Draft Release or Immediately Release"
type: string
default: " "
jobs:
create-release:
uses: ./.github/workflows/build-and-release.yaml
with:
release-version: ${{ inputs.release-version }}
draft-flag: ${{ inputs.draft-flag }}
secrets: inherit

View file

@ -1,22 +0,0 @@
name: Pre-Release
on:
push:
branches:
- "release/**"
jobs:
release-version:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.step1.outputs.release_version }}
steps:
- id: step1
run: echo "release_version=${GITHUB_REF#refs/*/*/}" >> $GITHUB_OUTPUT
create-pre-release:
needs: release-version
uses: ./.github/workflows/build-and-release.yaml
with:
release-version: ${{ needs.release-version.outputs.release-version }}
draft-flag: -draft
secrets: inherit

4
.gitignore vendored
View file

@ -1,6 +1,4 @@
capacitor-checkout capacitor-checkout
*.xcframework
*.zip *.zip
.swiftpm .swiftpm
frameworks
.build

View file

@ -1,4 +0,0 @@
Capacitor/Cordova 8.5.2, unchanged binary artifacts and upstream checksums.
Imported once from Ionic; future builds use only git.kico-dev.de.
Original upstream revision: 0b6882e9a3288342aacf36348e5a94e4f1dd7b13.
Licence and notices are retained from upstream. MeeNow pins this commit.

View file

@ -12,19 +12,19 @@ let package = Package(
.library( .library(
name: "Cordova", name: "Cordova",
targets: ["Cordova"] targets: ["Cordova"]
) ),
], ],
dependencies: [], dependencies: [],
targets: [ targets: [
.binaryTarget( .binaryTarget(
name: "Capacitor", name: "Capacitor",
url: "https://git.kico-dev.de/martin/capacitor-swift-pm/raw/commit/916218efd53e6e646c36bbfd71e8f06c1b643fbf/artifacts/Capacitor.xcframework.zip", url: "https://github.com/ionic-team/capacitor-swift-pm/releases/download/3.6.0/Capacitor.xcframework.zip",
checksum: "134c65a8bd30bfaa8ccb158d78142fa7231bf3f472e4a5d808c5fbed90fd4c75" checksum: "311a29907502e995fad871428f4889f8c156c43566dc6d616f02d94cdd944197"
), ),
.binaryTarget( .binaryTarget(
name: "Cordova", name: "Cordova",
url: "https://git.kico-dev.de/martin/capacitor-swift-pm/raw/commit/916218efd53e6e646c36bbfd71e8f06c1b643fbf/artifacts/Cordova.xcframework.zip", url: "https://github.com/ionic-team/capacitor-swift-pm/releases/download/3.6.0/Cordova.xcframework.zip",
checksum: "57ff2c8f1e5dcd8d4379ac3cccde1407d81ccd575347dc2aff4f72272b8794a1" checksum: "9f562768d83888219ed90840f0d9c0f4e47105d3c45382257339282e8a4ebf9c"
) )
] ]
) )

View file

@ -1,5 +1,3 @@
# Swift Package Manager Support for Capacitor # Experimental Swift Package Manager Support for Capacitor
This repo is for hosting binary xcframework releases of Capacitor and CapacitorCordova for SPM support. This repo is for hosting binary xcframework releases of Capacitor and CapacitorCordova for experimental SPM support.
Only applies to Capacitor major versions 6, 7, and 8. Starting with Capacitor 9, the iOS platform is a source-first Swift package built directly from the [ionic-team/capacitor](https://github.com/ionic-team/capacitor) repository.

Binary file not shown.

Binary file not shown.

View file

@ -1,54 +1,90 @@
#!/usr/bin/env bash -eoux pipefail #!/bin/bash -eoux pipefail
build_simulator() { build_capacitor_simulator() {
local SCHEME=$1
xcodebuild archive \ xcodebuild archive \
-scheme $SCHEME \ -scheme Capacitor \
-workspace Capacitor.xcworkspace \ -workspace Capacitor.xcworkspace \
-destination "generic/platform=iOS Simulator" \ -destination "generic/platform=iOS Simulator" \
-archivePath ./Build/iOS-Simulator \
-configuration Debug \ -configuration Debug \
-archivePath ./Build/$SCHEME-iOS-Simulator \
SKIP_INSTALL=NO \ SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES
DEBUG_INFORMATION_FORMAT="dwarf-with-dsym"
} }
build_ios() { build_capacitor_ios() {
local SCHEME=$1
xcodebuild archive \ xcodebuild archive \
-scheme $SCHEME \ -scheme Capacitor \
-workspace Capacitor.xcworkspace \ -workspace Capacitor.xcworkspace \
-destination "generic/platform=iOS" \ -destination "generic/platform=iOS" \
-archivePath ./Build/$SCHEME-iOS \ -archivePath ./Build/iOS \
SKIP_INSTALL=NO \ SKIP_INSTALL=NO \
SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO \ SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO \
DEBUG_INFORMATION_FORMAT="dwarf-with-dsym" \ DEBUG_INFORMATION_FORMAT="dwarf-with-dsym" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES BUILD_LIBRARY_FOR_DISTRIBUTION=YES
} }
cap_bcsymbol() {
echo -n $(dwarfdump -u $PWD/Build/iOS.xcarchive/Products/Library/Frameworks/Capacitor.framework/Capacitor | grep -Ewo '[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}')
}
cordova_bcsymbol() {
echo -n $(dwarfdump -u $PWD/Build/iOS.xcarchive/Products/Library/Frameworks/Cordova.framework/Cordova | grep -Ewo '[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}')
}
create_xcframeworks() { create_xcframeworks() {
build_simulator Capacitor build_capacitor_simulator
build_simulator Cordova build_capacitor_ios
build_ios Capacitor rm -rf ./Build/iOS-Simulator.xcarchive/Products/Library/Frameworks/Capacitor.framework/Frameworks
build_ios Cordova rm -rf ./Build/iOS.xcarchive/Products/Library/Frameworks/Capacitor.framework/Frameworks
rm -rf ./Build/Capacitor-iOS-Simulator.xcarchive/Products/Library/Frameworks/Capacitor.framework/Frameworks
rm -rf ./Build/Capacitor-iOS.xcarchive/Products/Library/Frameworks/Capacitor.framework/Frameworks
xcodebuild -create-xcframework \ xcodebuild -create-xcframework \
-framework ./Build/Capacitor-iOS-Simulator.xcarchive/Products/Library/Frameworks/Capacitor.framework \ -framework ./Build/iOS-Simulator.xcarchive/Products/Library/Frameworks/Capacitor.framework \
-debug-symbols $PWD/Build/Capacitor-iOS-Simulator.xcarchive/dSYMs/Capacitor.framework.dSYM \ -framework ./Build/iOS.xcarchive/Products/Library/Frameworks/Capacitor.framework \
-framework ./Build/Capacitor-iOS.xcarchive/Products/Library/Frameworks/Capacitor.framework \ -debug-symbols $PWD/Build/iOS.xcarchive/dSYMs/Capacitor.framework.dSYM \
-debug-symbols $PWD/Build/Capacitor-iOS.xcarchive/dSYMs/Capacitor.framework.dSYM \ -debug-symbols $PWD/Build/iOS.xcarchive/BCSymbolMaps/$(cap_bcsymbol).bcsymbolmap \
-output Capacitor.xcframework -output Capacitor.xcframework
xcodebuild -create-xcframework \ xcodebuild -create-xcframework \
-framework ./Build/Cordova-iOS-Simulator.xcarchive/Products/Library/Frameworks/Cordova.framework \ -framework ./Build/iOS-Simulator.xcarchive/Products/Library/Frameworks/Cordova.framework \
-debug-symbols $PWD/Build/Cordova-iOS-Simulator.xcarchive/dSYMs/Cordova.framework.dSYM \ -framework ./Build/iOS.xcarchive/Products/Library/Frameworks/Cordova.framework \
-framework ./Build/Cordova-iOS.xcarchive/Products/Library/Frameworks/Cordova.framework \ -debug-symbols $PWD/Build/iOS.xcarchive/dSYMs/Cordova.framework.dSYM \
-debug-symbols $PWD/Build/Cordova-iOS.xcarchive/dSYMs/Cordova.framework.dSYM \ -debug-symbols $PWD/Build/iOS.xcarchive/BCSymbolMaps/$(cordova_bcsymbol).bcsymbolmap \
-output Cordova.xcframework -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", "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 git clone https://github.com/ionic-team/capacitor capacitor-checkout
@ -57,5 +93,12 @@ git checkout $1
create_xcframeworks create_xcframeworks
mv Capacitor.xcframework ../../../ cap_url="https://github.com/ionic-team/capacitor-swift-pm/releases/download/$1/Capacitor.xcframework.zip"
mv Cordova.xcframework ../../../ cap_sha=$(shasum -a 256 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/Cordova.xcframework.zip"
cap_cordova_sha=$(shasum -a 256 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

View file

@ -1,47 +0,0 @@
#!/usr/bin/env bash -eoux pipefail
mkdir frameworks
zip -r frameworks/Capacitor.xcframework.zip Capacitor.xcframework
zip -r frameworks/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
}
cap_url="https://github.com/ionic-team/capacitor-swift-pm/releases/download/$1/Capacitor.xcframework.zip"
cap_sha=$(shasum -a 256 frameworks/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/Cordova.xcframework.zip"
cap_cordova_sha=$(shasum -a 256 frameworks/Cordova.xcframework.zip | sed 's/ /\n/g' | head -n1 | xargs echo -n)
write_package_file $cap_url $cap_sha $cap_cordova_url $cap_cordova_sha