Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .cargo/config.toml

This file was deleted.

185 changes: 185 additions & 0 deletions .github/workflows/build-natives.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Build Native Libraries

on:
workflow_call:

# Native binaries are a pure function of the C/C++/ObjC sources. Each platform
# job caches its output tree keyed on a hash of every src/**/native/** file
# (plus this workflow). On a cache hit the compile steps are skipped and the
# job only verifies + re-uploads the artifact for downstream consumers.
#
# Platforms: Linux (WebKit2GTK) + macOS (WKWebView) + Windows (WebView2).
#
# Bump the `natives-v1` prefix to force a full rebuild.

jobs:
linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x64
- os: ubuntu-24.04-arm
arch: aarch64
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Restore native output cache
id: natives-cache
uses: actions/cache@v4
with:
path: 'webview-compose/src/jvmMain/resources/nucleus/native/linux-*'
key: natives-v1-linux-${{ matrix.arch }}-${{ hashFiles('webview-compose/src/jvmMain/native/**', '.github/workflows/build-natives.yaml') }}

- name: Setup JDK 21
if: steps.natives-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: Install build dependencies
if: steps.natives-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libgtk-3-dev \
libcairo2-dev \
libsoup-3.0-dev \
libwebkit2gtk-4.1-dev || \
sudo apt-get install -y \
build-essential \
pkg-config \
libgtk-3-dev \
libcairo2-dev \
libsoup-3.0-dev \
libwebkit2gtk-4.0-dev

- name: Build compose WebView Linux native library
if: steps.natives-cache.outputs.cache-hit != 'true'
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
run: bash webview-compose/src/jvmMain/native/linux/build.sh

- name: Verify Linux natives
run: |
f="webview-compose/src/jvmMain/resources/nucleus/native/linux-${{ matrix.arch }}/libcompose_webview_linux.so"
if [ -f "$f" ]; then
echo "OK: $f ($(wc -c < "$f") bytes)"
file "$f" || true
else
echo "MISSING: $f" >&2
find webview-compose/src/jvmMain/resources/nucleus/native -type f 2>/dev/null || true
exit 1
fi

- name: Upload Linux natives
uses: actions/upload-artifact@v4
with:
name: natives-linux-${{ matrix.arch }}
path: 'webview-compose/src/jvmMain/resources/nucleus/native/linux-*/'
retention-days: 1

macos:
runs-on: macos-14
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Restore native output cache
id: natives-cache
uses: actions/cache@v4
with:
path: 'webview-compose/src/jvmMain/resources/nucleus/native/darwin-*'
key: natives-v1-macos-${{ hashFiles('webview-compose/src/jvmMain/native/**', '.github/workflows/build-natives.yaml') }}

- name: Setup JDK 21
if: steps.natives-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: Build compose WebView macOS native library
if: steps.natives-cache.outputs.cache-hit != 'true'
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
run: bash webview-compose/src/jvmMain/native/macos/build.sh

- name: Verify macOS natives
run: |
MISSING=0
for arch in aarch64 x64; do
f="webview-compose/src/jvmMain/resources/nucleus/native/darwin-${arch}/libcompose_webview_macos.dylib"
if [ -f "$f" ]; then
echo "OK: $f ($(wc -c < "$f") bytes)"
file "$f" || true
else
echo "MISSING: $f" >&2
MISSING=1
fi
done
if [ "$MISSING" = "1" ]; then
find webview-compose/src/jvmMain/resources/nucleus/native -type f 2>/dev/null || true
exit 1
fi

- name: Upload macOS natives
uses: actions/upload-artifact@v4
with:
name: natives-macos
path: 'webview-compose/src/jvmMain/resources/nucleus/native/darwin-*/'
retention-days: 1

windows:
runs-on: windows-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Restore native output cache
id: natives-cache
uses: actions/cache@v4
with:
path: 'webview-compose/src/jvmMain/resources/nucleus/native/win32-*'
key: natives-v1-windows-x64-${{ hashFiles('webview-compose/src/jvmMain/native/**', '.github/workflows/build-natives.yaml') }}

- name: Setup JDK 21
if: steps.natives-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: Build compose WebView Windows native library
if: steps.natives-cache.outputs.cache-hit != 'true'
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
shell: cmd
run: webview-compose\src\jvmMain\native\windows\build.bat

- name: Verify Windows natives
shell: bash
run: |
f="webview-compose/src/jvmMain/resources/nucleus/native/win32-x64/compose_webview_windows.dll"
loader="webview-compose/src/jvmMain/resources/nucleus/native/win32-x64/WebView2Loader.dll"
if [ -f "$f" ] && [ -f "$loader" ]; then
echo "OK: $f ($(wc -c < "$f") bytes)"
echo "OK: $loader ($(wc -c < "$loader") bytes)"
else
echo "MISSING: $f and/or $loader" >&2
find webview-compose/src/jvmMain/resources/nucleus/native -type f 2>/dev/null || true
exit 1
fi

- name: Upload Windows natives
uses: actions/upload-artifact@v4
with:
name: natives-windows-x64
path: 'webview-compose/src/jvmMain/resources/nucleus/native/win32-*/'
retention-days: 1
Loading
Loading