Skip to content

Commit 8e91619

Browse files
Merge pull request #472 from bernardladenthin/claude/hopeful-pascal-9jlbqb
Refactor natives jar distribution and build infrastructure
2 parents 5f836c5 + d36d537 commit 8e91619

227 files changed

Lines changed: 7340 additions & 6826 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2-
# SPDX-FileCopyrightText: 2023-2025 Konstantin Herud
32
#
4-
# SPDX-License-Identifier: MIT
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
54

65
# https://editorconfig.org
76
root = true

‎.gitattributes‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2-
# SPDX-FileCopyrightText: 2023-2025 Konstantin Herud
32
#
4-
# SPDX-License-Identifier: MIT
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
54

65
* text=auto eol=lf
6+
*.gguf binary

‎.github/CODEOWNERS‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2+
#
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
4+
15
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
26
# Default reviewer for all paths.
37
* @bernardladenthin

‎.github/FUNDING.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2-
# SPDX-FileCopyrightText: 2023-2025 Konstantin Herud
32
#
4-
# SPDX-License-Identifier: MIT
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
54

65
# Sponsorship configuration for github.com/bernardladenthin.
76
# Uncomment any line below to advertise a funding channel on the repository.

‎.github/ISSUE_TEMPLATE/config.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2-
# SPDX-FileCopyrightText: 2023-2025 Konstantin Herud
32
#
4-
# SPDX-License-Identifier: MIT
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
54

65
blank_issues_enabled: false
76
contact_links:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2+
#
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
4+
5+
# Builds the parent POM and net.ladenthin:llama -- plus further reactor modules when asked -- as plain
6+
# Java: no tests, no checks, no javadoc or sources jar, no signing. With `install` they land in the
7+
# local Maven repository for a job that builds a module or an artifact on top of them; with `package`
8+
# only in target/. The one place for that skip-flag list, which nine jobs used to repeat.
9+
# Needs the repository checked out and a JDK set up.
10+
name: Build the core classes
11+
description: Build parent + net.ladenthin:llama (and more reactor modules) without tests, checks, javadoc or signing.
12+
inputs:
13+
modules:
14+
description: The reactor modules to build (-pl); their reactor dependencies are built too (-am).
15+
required: false
16+
default: llama
17+
goal:
18+
description: install (into the local Maven repository) or package (target/ only).
19+
required: false
20+
default: install
21+
runs:
22+
using: composite
23+
steps:
24+
- name: mvn -pl ${{ inputs.modules }} -am ${{ inputs.goal }} (no tests, checks or signing)
25+
shell: bash
26+
env:
27+
MODULES: ${{ inputs.modules }}
28+
GOAL: ${{ inputs.goal }}
29+
run: >
30+
mvn -B --no-transfer-progress -pl "$MODULES" -am -DskipTests -Denforcer.skip=true
31+
-Dspotless.check.skip=true -Dspotbugs.skip=true
32+
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dgpg.skip=true "$GOAL"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2+
#
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
4+
5+
# Puts sccache on PATH on a Windows runner, from the release zip (x86_64, or the native
6+
# aarch64-pc-windows-msvc build on windows-11-arm, where it wraps clang-cl). The caller keeps the
7+
# `if:` (USE_CACHE and a Depot token present) and `continue-on-error: true`: a failed install is
8+
# only a slower build, because build.bat probes sccache before trusting it and retries a build that
9+
# fails with it as the launcher once uncached (CLAUDE.md, "sccache on every Windows Ninja job").
10+
# Keep `version` equal to SCCACHE_DL_VERSION in .github/build.sh (the Linux fetch).
11+
name: Install sccache (Windows)
12+
description: Download the sccache release zip matching the runner's architecture and add it to PATH.
13+
inputs:
14+
version:
15+
description: sccache release to install.
16+
required: false
17+
default: '0.18.0'
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Install sccache ${{ inputs.version }}
22+
shell: pwsh
23+
env:
24+
SCCACHE_VERSION: ${{ inputs.version }}
25+
run: |
26+
$arch = if ($env:RUNNER_ARCH -eq 'ARM64') { 'aarch64' } else { 'x86_64' }
27+
$rel = "sccache-v$env:SCCACHE_VERSION-$arch-pc-windows-msvc"
28+
$url = "https://github.com/mozilla/sccache/releases/download/v$env:SCCACHE_VERSION/$rel.zip"
29+
Write-Host "Downloading $url"
30+
Invoke-WebRequest -Uri $url -OutFile "$env:RUNNER_TEMP\sccache.zip"
31+
Expand-Archive -Path "$env:RUNNER_TEMP\sccache.zip" -DestinationPath "$env:RUNNER_TEMP\sccache" -Force
32+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\sccache\$rel"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2+
#
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
4+
5+
# Downloads the Android CPU natives (arm64-v8a for devices, x86_64 for the emulator), stages them where
6+
# llama-android's Gradle build expects them and publishes the CPU AAR to mavenLocal -- what the
7+
# emulator test and the two llmservice jobs consume. Needs the repository checked out, the core jar
8+
# built (build-core, `package`) and Gradle on PATH; the calling job must `need` both Android CPU
9+
# build jobs.
10+
name: Publish the CPU AAR to mavenLocal
11+
description: Download + stage the Android CPU natives (arm64-v8a, x86_64) and publish the llama-android AAR to mavenLocal.
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Download Android CPU natives (arm64)
16+
uses: actions/download-artifact@v8
17+
with:
18+
name: natives-cpu-android-aarch64
19+
path: stage/cpu/
20+
- name: Download Android CPU natives (x86_64)
21+
uses: actions/download-artifact@v8
22+
with:
23+
name: natives-cpu-android-x86-64
24+
path: stage/cpu-x86_64/
25+
- name: Stage natives + publish the CPU AAR to mavenLocal
26+
shell: bash
27+
run: |
28+
mkdir -p llama-android/natives/cpu/arm64-v8a llama-android/natives/cpu/x86_64
29+
cp stage/cpu/Linux-Android/aarch64/cpu/libjllama.so llama-android/natives/cpu/arm64-v8a/
30+
cp stage/cpu-x86_64/Linux-Android/x86_64/cpu/libjllama.so llama-android/natives/cpu/x86_64/
31+
gradle -p llama-android publishLlamaAndroidPublicationToMavenLocal
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
2+
#
3+
# SPDX-License-Identifier: MIT OR Apache-2.0
4+
5+
# Restores the shared GGUF model cache and validates it -- the one place a job gets its models.
6+
# The download-models job is the cache's ONLY writer (actions/cache, same key); every consumer
7+
# uses this restore-only action, so a job running on a cache miss can never re-save an empty or
8+
# partial entry under the immutable key. enableCrossOsArchive matches the writer's entry version,
9+
# so macOS and Windows restore the same ubuntu-built entry (without it the entries are per OS, and
10+
# the unreachable Windows-side one was once found re-saved EMPTY after an eviction). The key is
11+
# the hash of .github/models.csv, so editing the manifest creates a fresh complete entry.
12+
# validate-models.sh then fails a partial or absent restore loudly instead of letting the
13+
# model-backed tests self-skip. Needs the repository checked out.
14+
name: Restore GGUF models
15+
description: Restore the shared GGUF model cache (written by download-models) and validate every model of .github/models.csv.
16+
inputs:
17+
fail-on-cache-miss:
18+
description: Fail at the restore already when the cache entry is missing ('true' in verify-model-cache).
19+
required: false
20+
default: 'false'
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Restore shared GGUF model cache (populated by download-models; no re-download)
25+
uses: actions/cache/restore@v6
26+
with:
27+
path: models/
28+
key: gguf-models-${{ hashFiles('.github/models.csv') }}
29+
enableCrossOsArchive: true
30+
fail-on-cache-miss: ${{ inputs.fail-on-cache-miss }}
31+
- name: Validate model files
32+
shell: bash
33+
run: bash .github/validate-models.sh

‎.github/android-consumer-test/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
33
4-
SPDX-License-Identifier: MIT
4+
SPDX-License-Identifier: MIT OR Apache-2.0
55
-->
66
# llama-android consumer-test fixture (CI only)
77

0 commit comments

Comments
 (0)