Skip to content

Commit 6bcf086

Browse files
authored
Merge pull request #23 from MillerTechnologyPeru/feature/androidswiftui
Get the iOS app building
2 parents 9e34039 + fdaaa46 commit 6bcf086

6 files changed

Lines changed: 220 additions & 68 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# NOTE: every job here fails on a clean checkout until PureSwift/AndroidBluetooth#4 is merged.
2-
# AndroidBluetooth requests the `AndroidManifest` product from `Android`, but it moved to
3-
# `swift-android-native` (PureSwift/Android#40), and SwiftPM validates the whole package graph even
4-
# for dependencies that are conditional on `.android`:
5-
# error: product 'AndroidManifest' required by package 'androidbluetooth' ... not found
6-
# That is a one-line manifest fix upstream, not a problem with this repo.
71
name: CI
82

93
on:
@@ -19,33 +13,34 @@ concurrency:
1913
jobs:
2014
test:
2115
name: Test
22-
runs-on: macos-15
16+
runs-on: macos-26
2317
timeout-minutes: 45
2418
steps:
2519
- uses: actions/checkout@v4
20+
# Pinned, not latest-stable: WasmKit 0.3.x declares swift-tools-version 6.3, so it needs
21+
# Swift 6.3+. Xcode 26.5 (the macos-26 default) ships Swift 6.2.x and fails with
22+
# "package 'wasmkit' is using Swift tools version 6.3.0 but the installed version is 6.2.4".
2623
- uses: maxim-lobanov/setup-xcode@v1
2724
with:
28-
xcode-version: latest-stable
25+
xcode-version: '26.6'
2926
- name: Build
3027
run: swift build --build-tests
3128
- name: Test
3229
run: swift test
3330

3431
ios-archive:
3532
name: iOS Archive
36-
runs-on: macos-15
33+
runs-on: macos-26
3734
timeout-minutes: 60
3835
steps:
3936
- uses: actions/checkout@v4
37+
# Pinned, not latest-stable: WasmKit 0.3.x declares swift-tools-version 6.3, so it needs
38+
# Swift 6.3+. Xcode 26.5 (the macos-26 default) ships Swift 6.2.x and fails with
39+
# "package 'wasmkit' is using Swift tools version 6.3.0 but the installed version is 6.2.4".
4040
- uses: maxim-lobanov/setup-xcode@v1
4141
with:
42-
xcode-version: latest-stable
42+
xcode-version: '26.6'
4343

44-
# WasmKit declares `.treatAllWarnings(as: .error)` for Apple platforms, which conflicts with
45-
# the `-suppress-warnings` Xcode passes to package dependencies:
46-
# error: Conflicting options '-warnings-as-errors' and '-suppress-warnings'
47-
# The setting only reaches package targets from the command line, so it cannot live in the
48-
# xcconfig or the project.
4944
- name: Archive
5045
working-directory: Darwin
5146
run: |
@@ -56,7 +51,6 @@ jobs:
5651
-archivePath "$RUNNER_TEMP/BluetoothExplorer.xcarchive" \
5752
-skipPackagePluginValidation \
5853
-skipMacroValidation \
59-
SWIFT_SUPPRESS_WARNINGS=NO \
6054
CODE_SIGNING_ALLOWED=NO
6155
6256
- name: Verify archive contents
@@ -72,26 +66,3 @@ jobs:
7266
name: ios-archive
7367
path: ${{ runner.temp }}/BluetoothExplorer.xcarchive
7468
retention-days: 14
75-
76-
android-package:
77-
name: Android Swift Package
78-
runs-on: macos-15
79-
timeout-minutes: 60
80-
steps:
81-
- uses: actions/checkout@v4
82-
- uses: maxim-lobanov/setup-xcode@v1
83-
with:
84-
xcode-version: latest-stable
85-
86-
- name: Install Swift Android SDK
87-
run: |
88-
brew install skiptools/skip/skip || (brew update && brew install skiptools/skip/skip)
89-
skip android sdk install --version 6.3.3
90-
91-
# Only the plugin engine is built here. The full app does not yet cross-compile for Android:
92-
# AndroidBluetooth's `@JavaImplementation` macro generates invalid code for its scan callback,
93-
# and WasmKit's SystemExtras target does not compile against the Android sysroot
94-
# (`st_mode` is UInt32 there while swift-system's CInterop.Mode is UInt16). Neither is
95-
# reachable from this target. See Documentation/AndroidSwiftUIMigration.md.
96-
- name: Build plugin engine for Android
97-
run: swift build --swift-sdk swift-6.3.3-RELEASE_android --target BluetoothExplorerPluginEngine

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ playground.xcworkspace
3939
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
4040
# Packages/
4141
# Package.pins
42-
*Package.resolved
42+
# NOTE: Package.resolved is deliberately committed. This is an app, not a library, and several
43+
# dependencies track moving branches (GATT master, AndroidSwiftUI master), so without it every
44+
# clean checkout — including CI — resolves a different graph than the one that was tested.
45+
Darwin/**/Package.resolved
4346
.build/
4447
.swiftpm
4548

Darwin/BluetoothExplorer.xcodeproj/project.pbxproj

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
499CD43A2AC5B799001AE8D8 /* Sources */,
106106
499CD43C2AC5B799001AE8D8 /* Frameworks */,
107107
499CD43E2AC5B799001AE8D8 /* Resources */,
108-
499CD4452AC5B869001AE8D8 /* Run skip gradle */,
109108
499CD44A2AC5B9C6001AE8D8 /* Embed Frameworks */,
110109
);
111110
buildRules = (
@@ -166,25 +165,6 @@
166165
/* End PBXResourcesBuildPhase section */
167166

168167
/* Begin PBXShellScriptBuildPhase section */
169-
499CD4452AC5B869001AE8D8 /* Run skip gradle */ = {
170-
isa = PBXShellScriptBuildPhase;
171-
alwaysOutOfDate = 1;
172-
buildActionMask = 2147483647;
173-
files = (
174-
);
175-
inputFileListPaths = (
176-
);
177-
inputPaths = (
178-
);
179-
name = "Run skip gradle";
180-
outputFileListPaths = (
181-
);
182-
outputPaths = (
183-
);
184-
runOnlyForDeploymentPostprocessing = 0;
185-
shellPath = "/bin/sh -e";
186-
shellScript = "if [ \"${SKIP_ZERO}\" != \"\" ]; then\n echo \"note: skipping skip due to SKIP_ZERO\"\n exit 0\nelif [ \"${ENABLE_PREVIEWS}\" = \"YES\" ]; then\n echo \"note: skipping skip due to ENABLE_PREVIEWS\"\n exit 0\nelif [ \"${ACTION}\" = \"install\" ]; then\n echo \"note: skipping skip due to archive install\"\n exit 0\nelif [ \"${SKIP_ACTION}\" = \"none\" ]; then\n echo \"note: skipping skip due to SKIP_ACTION none\"\n exit 0\nelse\n SKIP_ACTION=\"${SKIP_ACTION:-launch}\"\nfi\nPATH=${BUILD_ROOT}/Release:${BUILD_ROOT}/Debug:${BUILD_ROOT}/../../SourcePackages/artifacts/skip/skip/skip.artifactbundle/macos:${PATH}:${HOMEBREW_PREFIX:-/opt/homebrew}/bin\necho \"note: running gradle build with: $(which skip) gradle -p ${PWD}/../Android ${SKIP_ACTION:-launch}${CONFIGURATION:-Debug}\"\nskip gradle -p ../Android ${SKIP_ACTION:-launch}${CONFIGURATION:-Debug}\n";
187-
};
188168
/* End PBXShellScriptBuildPhase section */
189169

190170
/* Begin PBXSourcesBuildPhase section */

Documentation/AndroidSwiftUIMigration.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,19 @@ device or emulator. Notable limitations, each documented in the source:
8888

8989
## Platform status
9090

91-
- **Apple platforms** — the package resolves and every target builds with no Skip involvement.
91+
- **Apple platforms** — working end to end. A clean checkout resolves, builds, tests and archives
92+
with **no mirrors, no environment variables and no extra xcodebuild flags**, and the app runs in
93+
the simulator: the device list populates from `MockCentral`, and all 13 bundled plugins install
94+
into `Documents/Plugins/` on first launch and appear in the Plugins tab.
95+
96+
Two things were needed to get there beyond removing Skip:
97+
- The `AndroidBluetooth` package dependency is temporarily not declared. SwiftPM validates the
98+
whole graph even for `.android`-conditional dependencies, so its `AndroidManifest` bug broke
99+
Apple builds. Restore it with PureSwift/AndroidBluetooth#4.
100+
- WasmKit is taken from a fork that drops `.treatAllWarnings(as: .error)`. Upstream's setting
101+
collides with the `-suppress-warnings` Xcode passes to package dependencies, which made the app
102+
unbuildable in Xcode; the override only works from the command line, so it could not be fixed
103+
from the xcconfig or project.
92104
- **Android** — the dependency wiring is in place, but the Android app build has not been verified
93105
end to end. It additionally needs the two PureSwift PRs above, and the Kotlin JNI peers under
94106
`Sources/BluetoothExplorer/Skip/` (`ScanCallback.kt`, `BluetoothGattCallback.kt`) rehomed into the

Package.resolved

Lines changed: 176 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,27 @@ let package = Package(
1010
],
1111
dependencies: [
1212
.package(url: "https://github.com/PureSwift/GATT.git", branch: "master"),
13-
.package(url: "https://github.com/PureSwift/AndroidBluetooth.git", branch: "master"),
13+
// AndroidBluetooth is temporarily not declared. It requests the `AndroidManifest` product
14+
// from `Android`, but that product moved to `swift-android-native`
15+
// (PureSwift/Android#40), and SwiftPM validates the whole package graph even for
16+
// dependencies conditional on `.android` — so simply declaring it breaks Apple-platform
17+
// builds. Restore this together with the `AndroidBluetooth` target dependency below once
18+
// PureSwift/AndroidBluetooth#4 is merged. The Swift sources still guard their use of it
19+
// with `#if os(Android)`, so nothing else has to change.
1420
.package(url: "https://github.com/PureSwift/Bluetooth.git", from: "7.2.0"),
1521
// SwiftUI for Android. Apple platforms use the system SwiftUI instead, so this is only
1622
// linked for .android — see the conditional target dependencies below.
1723
.package(url: "https://github.com/PureSwift/AndroidSwiftUI.git", branch: "master"),
18-
.package(url: "https://github.com/swiftwasm/WasmKit.git", .upToNextMinor(from: "0.3.1"))
24+
// Fork of WasmKit 0.3.1 with one change: upstream declares
25+
// `.treatAllWarnings(as: .error)` for Apple platforms, which collides with the
26+
// `-suppress-warnings` Xcode passes to package dependencies and makes the app fail to build
27+
// in Xcode ("Conflicting options '-warnings-as-errors' and '-suppress-warnings'"). That
28+
// setting only reaches package targets from the command line, so it cannot be overridden
29+
// from the xcconfig or the project. Track upstream and drop the fork once it is fixed there.
30+
.package(
31+
url: "https://github.com/MillerTechnologyPeru/WasmKit.git",
32+
revision: "ba06b7c64b5bc692c19c301ba2ef843c8d0f37c2"
33+
)
1934
],
2035
targets: [
2136
.target(
@@ -64,11 +79,6 @@ let package = Package(
6479
package: "GATT",
6580
condition: .when(platforms: [.macOS, .iOS, .macCatalyst, .watchOS, .tvOS, .visionOS])
6681
),
67-
.product(
68-
name: "AndroidBluetooth",
69-
package: "AndroidBluetooth",
70-
condition: .when(platforms: [.android])
71-
),
7282
.product(
7383
name: "AndroidSwiftUI",
7484
package: "AndroidSwiftUI",

0 commit comments

Comments
 (0)