sbt/sbt-jni
61.4
Adequate · 7 November 2026
893
lines of production code
Scala
primary language
4
measurements over time
What this system is
Features
Add BytecodeUtil for detecting native classes via ASM
A new BytecodeUtil object has been added to the plugin's utility package to scan Java class files for methods annotated with @native. This utility leverages the ASM library (specifically ASM9) to parse bytecode and identify classes containing native implementations, enabling the plugin to accurately locate and process JNI bindings.
plugin/src/main/scala/com/github/sbt/jni/util · high confidence
Add Meson build tool support for JNI projects
The plugin now includes template files for the Meson build system, allowing users to generate and build JNI libraries using Meson in addition to existing tools. New resources include \meson.build\, \meson.options\, and a \CMakeLists.txt\ template, enabling Meson-based project generation within the sbt-jni workflow.
plugin/src/main/resources · high confidence
Add gjavah JNI header generation engine
Introduces the core gjavah library (copied from Glavo/gjavah v0.3.1) into the plugin under the \com.github.sbt.jni.javah\ package. This adds the \JavahTask\ orchestrator and \JNIGenerator\ utility that scan Java classes (via ASM) to produce C header files, including support for module paths, class paths, and multi-release JARs. The change also includes localized help and error messages for English and Simplified Chinese.
plugin/src/main/java · high confidence
Add sbt-jni Cargo (Rust) example project
Added a new example project under the sbt-jni test suite that demonstrates integrating Rust code via Cargo. The example includes Scala classes using NativeLoader to call native methods implemented in Rust, along with corresponding tests to verify the interaction.
plugin/src/sbt-test/sbt-jni/simple-cargo/core · high confidence
Add support for Autotools and Meson native build systems
Users can now build native libraries using Autotools (detected via configure) and Meson (detected via meson.build) in addition to the existing CMake and Cargo support. The plugin introduces a unified BuildTool abstraction with a ConfigureMakeInstall trait to standardize the configure, make, and install workflow for these tools, and registers Meson in the available build tools map.
plugin/src/main/scala/com/github/sbt/jni/build · high confidence
Removals
Removal of legacy JNI library and SBT plugin
The \jni-library\ and \jni-plugin\ modules have been completely removed from the codebase. This deletes the \NativeLoader\ and \Platform\ utilities that previously handled extracting and loading native libraries from JARs, as well as the SBT plugin (\JniPlugin\) that provided tasks for building native code via CMake, generating JNI headers, and bundling native artifacts. Users relying on these components for automatic native library management will no longer have this functionality available.
jni-library, jni-plugin · high confidence
Removed native JNI demo example
The native JNI demonstration code has been removed from the examples directory. This includes the CMake build configuration, the generated JNI header, the SBT plugin definition, and the Scala source file that mapped to the native library. Users can no longer run this specific example that demonstrates integrating Scala with native code via JNI.
examples · high confidence
Behavioural changes
Compatibility layer for SBT 2.x support
The plugin now includes compatibility shims to support SBT 2.x. This introduces Scala 2 and Scala 3 specific implementation files that handle API differences, such as adapting file conversion logic for \HashedVirtualFileRef\ in SBT 2 and providing a no-op \uncached\ method to maintain compatibility with SBT 1.x's lack of build caching. It also adds a \distinctBy\ collection operation for Scala 2 to ensure consistent behavior across versions.
plugin/src/main/scala-2, plugin/src/main/scala-3 · high confidence
Native library loading now uses packaged fallback for Scala 2.11
The core library now supports Scala 2.11 by introducing a new macro-based \@nativeLoader\ annotation in \scala-2\ and a corresponding \NativeLoader\ syntax object. For users, this means native libraries can be loaded via a packaged fallback mechanism that extracts the library to a temporary directory if the standard \System.loadLibrary\ fails, ensuring compatibility with the Scala 2.11 build target.
core · high confidence
Native library loading via macro annotation in test suite
The simple core test module now uses the @nativeLoader macro annotation from com.github.sbt.jni to automatically load the native library, replacing previous manual loading mechanisms. This change is demonstrated in the Library.scala file which defines the native method and the Main.scala and Test.scala files which verify the native call works correctly in both runtime and test contexts.
plugin/src/sbt-test/sbt-jni/simple/core · high confidence
Rename package from ch.jodersky to com.github.sbt
The plugin's Java package namespace has been renamed from ch.jodersky to com.github.sbt. This change updates the package declarations in the source files, such as ClassName and ClassPath, to reflect the new organization. Users relying on the previous package names will need to update their imports or build configurations to use the new com.github.sbt.jni.javah namespace.
repository · high confidence
Restructured native build plugin into modular AutoPlugins
The native build functionality has been refactored from a single monolithic plugin into four distinct, modular AutoPlugins: JniJavah (for JNI header generation), JniLoad (for dependency and macro configuration), JniNative (for native compilation and build tool integration), and JniPackage (for packaging native libraries). This change introduces new settings such as \unmanagedPlatformDependentNativeDirectories\ for finer-grained control over unmanaged native library locations, and \nativeMultipleOutputs\ to support multiple native build outputs. It also standardizes the output directory for generated JNI headers to \target/native/include\ to ensure compatibility across sbt versions, and updates the \sbtJniCoreScope\ to allow switching between Provided and Compile scopes for Scala 3.x compatibility.
plugin/src/main/scala/com/github/sbt/jni/plugins · high confidence
Update scripted test project to Scala 2.13.18 and 2.12.21
The scripted test project for sbt-jni has been updated to use Scala versions 2.13.18 and 2.12.21, with 2.13.18 set as the default. The test configuration now includes compiler options for features and deprecation warnings, and the plugin is loaded via a scripted helper auto-plugin that applies these settings.
plugin/src/sbt-test/sbt-jni/simple/project · high confidence
Updated native build configuration and JNI implementations for multiclasses tests
The native test cases for the \multiclasses\ scenario now use CMake (minimum version 3.12) to build shared libraries instead of previous build methods. The \native1\ library (version 0) implements JNI bindings for the \multiclasses.Adder\ class, including methods for addition and accessing nested class fields, while the \native2\ library (version 1.2.3) implements the \multiclasses.Multiplier\ class. These changes ensure the native code is compiled with the correct include paths and library naming conventions required by sbt-jni.
plugin/src/sbt-test/sbt-jni/multiclasses/native1 · high confidence
Fixes
Fix overloaded native method names with reference type parameters
The native library implementation for the \overloads\ test case now correctly defines the JNI entry points for the overloaded \say\ method. Specifically, the C code implements the distinct signatures required for \say\ when called with a String, a String and int, a String and long, and a String array, ensuring that the native side matches the expected Java method overloads.
plugin/src/sbt-test/sbt-jni/overloads/native · high confidence
Test coverage
1 commit adding/updating tests in plugin; Add native library implementation for JNI testing; Add sbt-jni test case for Meson build support; Add sbt-test scaffolding for simple-cargo integration; Added integration tests for Cargo (Rust) support; Added integration tests for simple and multiclasses scenarios; Added scripted test helper for sbt-jni overloads; Added scripted tests for oneproject and simple-syntax scenarios; Added simple-syntax core test project with Scala 3 native method support; Added test case for Cargo paths with spaces; Added test case for loading multiple native libraries; Added test case for overloaded native methods with ref type parameters; Added tests for overloaded native method name mangling; Support for native library loading via macro annotation in test case.
Dependencies
Updated test project to Scala 3.8.4 and 2.13.18
The simple-syntax scripted test project now targets Scala 3.8.4, 2.13.18, and 2.12.21, with 3.8.4 set as the default version. This update aligns the test environment with the latest Scala releases, ensuring compatibility with recent compiler features and bug fixes.
plugin/src/sbt-test/sbt-jni/simple-syntax/project · high confidence
Upgrade build infrastructure to sbt 1.13 and modernize plugin configuration
The build system has been upgraded from sbt 0.13.9 to sbt 1.13.0, requiring users to ensure their local sbt installation is compatible with the 1.x series. The legacy \project/Build.scala\ file has been removed in favor of the standard sbt 1.x \project/plugins.sbt\ approach, which now explicitly declares dependencies on \sbt-ci-release\ (1.12.1), \sbt-scalafmt\ (2.6.2), and \sbt-updates\ (0.7.0). This change simplifies the build structure and aligns with current sbt conventions.
project · high confidence
Upgrade to Scala 3.8.4, SBT 2, and ASM 9.10.1
The build system has been upgraded to support Scala 3.8.4 (alongside 2.13.18, 2.12.21, and 2.11.12) and SBT 2, with the plugin now cross-building using Scala 3 for SBT 2 compatibility. The ASM dependency is updated to version 9.10.1, and the project structure has been consolidated into a new \build.sbt\ that defines \core\ and \plugin\ modules, replacing the previous \Build.scala\ and demo examples.
(dependencies) · high confidence
Housekeeping
Initial project scaffolding and documentation
The repository is initialized with essential project files, including a comprehensive README detailing the sbt-jni plugin's setup and usage, a CHANGELOG following the Keep a Changelog format, a LICENSE, and a .gitignore. Configuration for code formatting is established via .scalafmt.conf (version 3.11.5, Scala 3 dialect), and .git-blame-ignore-revs is added to ignore automated formatting commits.
(repo-wide) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 63 → 61 (-1.1)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 76 → 76 (+0.0)
- Architecture 100 → 100 (+0.0)
- Maturity 55 → 58 (+3.5)
- Readiness 60 → 66 (+5.9)
- Security 73 → 56 (-17.7)
Resolved (4)
- Inconsistent handling of build configurations. BuildTool has a validate method, but concrete implementations expose release as a property returning a BuildTool. This suggests a builder pattern or configuration override that is not reflected in the base trait. It is unclear how release interacts with validate or getInstance.
- Inconsistent lifecycle/initialization methods. BuildTool defines initTemplate for setup, but concrete implementations define make which returns a BuildTool instance. It is unclear if make is intended to replace initTemplate or if they serve different purposes. The naming make is ambiguous in this context (usually implies building, not initializing templates).
- Inconsistent method signatures for getInstance. BuildTool and Cargo return an Instance object. CMake and Meson do not show a return type (void/unit), suggesting they might be returning BuildTool or Unit instead of Instance, or the signature is incomplete. Additionally, parameter names differ (baseDirectory vs baseDir, buildDirectory vs buildDir, multipleOutputs vs nativeMultipleOutputs).
- Inconsistent return types for detection methods. The trait BuildTool defines detect returning Boolean, but concrete implementations CMake and Meson expose detect without a return type (void/unit in Scala, implying side-effect or void), while Cargo returns Boolean. This breaks the contract of the BuildTool interface.
New (1)
- Dependency hygiene PARTLY measured — sbt declarations read, dependency currency not (Maven Central unreachable)
Changes since last survey
- 4 commits — 4 feature/other, 0 fixes
By area
- (root) — 2 commits
- .github/workflows — 1 commit
- project/build.properties — 1 commit
Notable commits
- change: Bump coursier/cache-action from 8 to 9 (#372)
- change: SBT2 as a primary build tool for the project (#370)
- change: Update sbt to 2.0.12 (#371)
- change: Update sbt version compatibility in README
Architecture
- Unchanged — 0 containers · 2 contexts · 0 edges
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
sbt/sbt-jni was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 7 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 39be19eee67fadf2871e4be17256e24745c02926 — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-c34be012586e.