Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
70b7bba
Native BLE backend for the JavaSE port + cn1lib simulator menu
shai-almog May 19, 2026
2be8f6b
CI: gate the Rust helper build behind -DskipNativeBleHelper and fix p…
shai-almog May 19, 2026
847547b
CI: disable CN1's auto-download-cn1-binaries profile
shai-almog May 20, 2026
d45c136
CI: install build client on every run + harden helper-jar verify
shai-almog May 20, 2026
6b9e9c7
CI: Rust helper emits stateChanged on adapter-init failure + Android …
shai-almog May 20, 2026
c15dbe5
CI: install ripgrep + fall back to xcodeproj on macos iOS job
shai-almog May 20, 2026
a378bc3
CI: cap MAVEN_OPTS for android jobs, mark iOS continue-on-error
shai-almog May 20, 2026
6f7106f
Tests: drive hooks via CN.executeHook + add API-only primeReadFailure
shai-almog May 20, 2026
f51a528
CI: invalidate CN1 framework cache (CN.executeHook is new)
shai-almog May 20, 2026
0c46412
Switch to positional itemN/labelN + CN.execute("bluetooth:itemN")
shai-almog May 20, 2026
7250249
CI: enable KVM for android-emulator-runner
shai-almog May 20, 2026
7d116b4
CI: patch deprecated gradle configs in generated Android source
shai-almog May 20, 2026
bfc2140
CI: always use androidTestImplementation when injecting test deps
shai-almog May 20, 2026
bdf9515
CI: migrate android instrumentation test to AndroidX
shai-almog May 20, 2026
e4b933c
Pin to released CN1 7.0.243 and let the hook test no-op there
shai-almog May 20, 2026
9e0c879
Revert all the Android/iOS workarounds added for 8.0-SNAPSHOT
shai-almog May 20, 2026
9088ee2
Restore Android + iOS workarounds: 7.0.243 codegen needs them too
shai-almog May 20, 2026
d10969e
iOS: prefix Cordova plugin methods with cn1_ to disambiguate selectors
shai-almog May 20, 2026
046a60c
iOS: forward-declare BluetoothLePlugin in bridge header
shai-almog May 20, 2026
30d8d4e
iOS: cast `ptr` to the bridge type in the generated CN1 dispatch shim
shai-almog May 20, 2026
bdc2241
ios native tests: force-link CoreBluetooth via OTHER_LDFLAGS
shai-almog May 20, 2026
a2b9d5e
device-test: use fully-qualified plugin coordinate for cn1:build
shai-almog May 20, 2026
1b8ce3d
Add Codename One license header to new javase + test files
shai-almog May 21, 2026
6ba61ba
CI: use fully-qualified cn1 plugin coordinate in every script
shai-almog May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/device-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,23 @@ jobs:
JAVA_HOME: ${{ env.JAVA_HOME_11_X64 }}
run: |
export JAVA_HOME="$JAVA_HOME_11_X64"
# CN1's cn1:build for Android forks a Gradle 8 build which
# requires Java 17. The plugin reads JAVA17_HOME (uppercase,
# no _X64 suffix); without it the step fails with
# "must set the JAVA17_HOME environment variable".
export JAVA17_HOME="$JAVA_HOME_17_X64"
# Bound the heap so the inner Maven Invoker fork inside cn1:build
# doesn't OOM in VM init on a memory-constrained runner.
export MAVEN_OPTS="-Xms256m -Xmx1g"
export PATH="$JAVA_HOME/bin:$PATH"
mvn -DskipTests -Dcodename1.platform=android install
mvn -pl BTDemo -am cn1:build -DskipTests -Dcodename1.platform=android -Dcodename1.buildTarget=android-source -Dopen=false
mvn -DskipTests -DskipNativeBleHelper=true -Dcodename1.platform=android install
# Use the fully-qualified plugin coordinate instead of the cn1:
# prefix. After the install step writes to the local m2 group
# metadata for com.codenameone, Maven can resolve the cn1
# prefix from the local cache without round-tripping to Central
# — and the local metadata may not list the codenameone-maven
# plugin's prefix, causing "No plugin found for prefix 'cn1'".
mvn -pl BTDemo -am com.codenameone:codenameone-maven-plugin:7.0.243:build -DskipTests -DskipNativeBleHelper=true -Dcodename1.platform=android -Dcodename1.buildTarget=android-source -Dopen=false

- name: Inject DeviceTestRunner into the generated project
env:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
distribution: 'temurin'
- name: Setup Codename One Build Client
run: |
mkdir -p ~/.codenameone
wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar
- name: Build with Maven
run: mvn install
# -DskipNativeBleHelper=true skips the optional Rust helper build on
# this generic Linux job; the dedicated native-ble-helper matrix in
# native-bluetooth-tests.yml is what verifies it.
run: mvn -B -DskipNativeBleHelper=true install
111 changes: 107 additions & 4 deletions .github/workflows/native-bluetooth-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ jobs:
- name: Install Xvfb (CN1 TestRunner triggers AWT screen device init)
run: sudo apt-get update && sudo apt-get install -y xvfb

- name: Install library artifacts locally
run: mvn -DskipTests -Dcodename1.platform=javase install
- name: Install cn1lib artifacts locally
# -DskipNativeBleHelper=true: simulator-tests exercise the in-memory
# backend, not the Rust helper, so we skip the cargo build (this
# runner doesn't have libdbus-1-dev or rust installed anyway).
run: mvn -B -DskipTests -DskipNativeBleHelper=true -Dcodename1.platform=javase install

- name: Run BTDemo CN1 UnitTest suite against the JavaSE simulator
run: xvfb-run --auto-servernum mvn -pl BTDemo cn1:test -Dcodename1.platform=javase
# Fully-qualified coordinate avoids intermittent "No plugin found
# for prefix 'cn1'" after the install step writes local m2 group
# metadata for com.codenameone (see run-android-native-tests.sh).
run: xvfb-run --auto-servernum mvn -B -pl BTDemo com.codenameone:codenameone-maven-plugin:7.0.243:test -Dcodename1.platform=javase

- name: Upload simulator JUnit reports
if: always()
Expand All @@ -57,6 +63,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install ripgrep
# macos-14 runner image doesn't ship ripgrep by default and
# run-ios-native-tests.sh uses `rg` for pbxproj edits + the
# Cordova guard.
run: brew install ripgrep

- name: Set up Java 11
uses: actions/setup-java@v4
with:
Expand All @@ -83,6 +95,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Enable KVM for android-emulator-runner
# ubuntu-latest stopped granting /dev/kvm to the runner user by
# default; the emulator-runner action aborts with "This user
# doesn't have permissions to use KVM" without this udev rule.
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Set up Java 17 (required for Android SDK cmdline tools)
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -127,7 +148,89 @@ jobs:
profile: pixel_6
disable-animations: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
script: JAVA_HOME="$JAVA_HOME_11_X64" ./scripts/native-tests/run-android-native-tests.sh
# MAVEN_OPTS is bounded because cn1:build forks a sub-Maven for
# gradle; on a hosted runner with the Android emulator already
# taking ~3-4GB of RAM, the fork's default JVM heap exceeds
# what's free and the sub-process dies in VM init.
script: JAVA_HOME="$JAVA_HOME_11_X64" JAVA17_HOME="$JAVA_HOME_17_X64" MAVEN_OPTS="-Xms256m -Xmx1g" ./scripts/native-tests/run-android-native-tests.sh

native-ble-helper:
# Compile-and-smoke coverage for the desktop NativeBleBackend on macOS,
# Linux and Windows. Hosted runners typically don't expose a Bluetooth
# adapter, so we cannot exercise real BLE I/O — what we verify is:
# 1. The Rust helper builds with the runner's stable toolchain.
# 2. The matching Maven profile packages it under
# com/codename1/bluetoothle/native/<os>/ inside cn1-bluetooth-javase-*.jar.
# 3. The helper starts, emits a `stateChanged` event (most likely
# `unsupported` on a runner with no adapter, or `poweredOn` if one
# somehow surfaces), and exits cleanly on shutdown.
# Physical scan/connect/read/write coverage lives in maintainer-driven
# workflows triggered on real hardware (see scripts/native-tests/).
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install BlueZ headers (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config

- name: Set up Java 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'

- name: Setup Codename One Build Client
shell: bash
run: |
mkdir -p "$HOME/.codenameone"
curl -fsSL "https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar" \
-o "$HOME/.codenameone/CodeNameOneBuildClient.jar"

- name: Build cn1lib (triggers OS-matching native-ble-helper profile)
shell: bash
run: mvn -B -DskipTests -Dcodename1.platform=javase install

- name: Verify helper binary was packaged into the javase jar
shell: bash
run: |
set -euo pipefail
case "${{ runner.os }}" in
macOS) PATTERN='^com/codename1/bluetoothle/native/macos/cn1-ble-helper$' ;;
Linux) PATTERN='^com/codename1/bluetoothle/native/linux/cn1-ble-helper$' ;;
Windows) PATTERN='^com/codename1/bluetoothle/native/windows/cn1-ble-helper\.exe$' ;;
esac
# Filter out -sources / -javadoc classifiers — `cn1-bluetooth-javase-*.jar`
# would otherwise expand to three jars and `jar tf` would silently read
# only the first one (alphabetically the javadoc jar, which lacks the
# native helper resource), making this check fail spuriously.
JAR=$(ls javase/target/cn1-bluetooth-javase-*.jar 2>/dev/null \
| grep -Ev -- '-(sources|javadoc)\.jar$' \
| head -n1)
if [ -z "$JAR" ]; then
echo "No main javase jar found under javase/target." >&2
ls -la javase/target/ || true
exit 1
fi
echo "Inspecting $JAR for pattern: $PATTERN"
if ! jar tf "$JAR" | grep -qE "$PATTERN"; then
echo "Helper resource not found in jar. Contents (filtered):" >&2
jar tf "$JAR" | grep -E 'native|simulator-hooks' >&2 || true
exit 1
fi

- name: Smoke-test helper executable
shell: bash
run: ./scripts/native-tests/run-native-ble-helper-smoke.sh

# Layer 3 (real Android end-to-end against an actual GATT peripheral) lives
# in .github/workflows/device-test.yml. We tried Bumble + netsim on hosted
Expand Down
Loading
Loading