Skip to content

Propagate build results to dependent projects using artifacts#81

Merged
paxbun merged 22 commits into
gobley:mainfrom
paxbun:feat/jvm-rust-library-as-separate-artifact
Apr 3, 2025
Merged

Propagate build results to dependent projects using artifacts#81
paxbun merged 22 commits into
gobley:mainfrom
paxbun:feat/jvm-rust-library-as-separate-artifact

Conversation

@paxbun
Copy link
Copy Markdown
Member

@paxbun paxbun commented Mar 31, 2025

Changes

  • Added jarJvmRustRuntime* tasks wrapping Rust dynamic libraries into Jar files. Previously, Rust dynamic libraries were packaged into one single Jar file with .class files.
    • This allows building and publishing of dynamic libraries on multiple host machines.
    • The dynamic library JAR files are included in Android debug builds for Compose previews.
  • Added several Gradle configurations for passing the dynamic library Jar files and the UniFFI configuration files to dependent projects.
    • The dependencies configured with these configurations are resolved by the three Gradle plugins.
  • Using configurations and artifacts, removed usages of the deprecated ProjectDependency.dependencyProject API from DependencyUtils.
  • Added Config.crateName and packageRoot, which are intended to be used only on the Gradle side.
  • Added GobleyKotlinSourceSetCollection internally, which provides properties computing sourceSet names and returning those sourceSets, preventing manual branching by plugin IDs.
  • Added PluginUtils.withKotlinPlugin.
  • Renamed the version catalog entry name of androidx.test.
  • Fixed the bug where MergeUniffiConfigTask uses the wrong value for external crate names.
  • Changed the output path of MergeUniffiConfigTask from build/generated/uniffi/uniffi.toml to build/intermediates/merged_uniffi_config/uniffi.toml.

Testing

Added an Android local unit test (not an instrumented test) to :tests:uniffi:coverall-android. Added Cargo packages for :tests:uniffi:coverall-jvm and :tests:uniffi:coverall-android.

Issues Fixed

Fixes: #80, Fixes: #84

@paxbun paxbun added cargo Related to Cargo integration gradle Related to the Gradle plugins enhancement New feature or request labels Mar 31, 2025
paxbun added a commit that referenced this pull request Mar 31, 2025
… on Android 34 or higher (#82)

Made the Android bindings fallback to `UniffiJnaCleaner` when
`AndroidSystemCleaner` is not available even for API level 34 or higher.
This is for Compose preview.

Manually tested with the Android tutorial added by #62. Needs #81 to be
merged. Setting `android.render.sandbox=false` in `bin/idea.properties`
is also required.
@paxbun paxbun force-pushed the feat/jvm-rust-library-as-separate-artifact branch from a074323 to 89418ee Compare April 2, 2025 09:48
@paxbun paxbun changed the title Build Rust shared library for JVM as a separate artifact Propagate build results to dependent projects using artifacts Apr 2, 2025
@paxbun paxbun marked this pull request as ready for review April 2, 2025 16:24
@paxbun paxbun requested a review from SalvatoreT April 2, 2025 16:25
@paxbun paxbun force-pushed the feat/jvm-rust-library-as-separate-artifact branch from bda763b to 5440d1f Compare April 3, 2025 02:13
@paxbun paxbun merged commit 4e3bcd3 into gobley:main Apr 3, 2025
17 of 18 checks passed
@paxbun paxbun deleted the feat/jvm-rust-library-as-separate-artifact branch April 3, 2025 03:29
paxbun added a commit to paxbun/gobley that referenced this pull request Apr 4, 2025
paxbun added a commit to paxbun/gobley that referenced this pull request Apr 4, 2025
paxbun added a commit to paxbun/gobley that referenced this pull request Apr 4, 2025
paxbun added a commit to paxbun/gobley that referenced this pull request Apr 4, 2025
paxbun added a commit that referenced this pull request Apr 4, 2025
…ries (#97)

## Changes

- Added `CargoJvmBuildVariant.{jarTaskProvider, libraryFiles}`. This is
useful for users requiring custom publication logic.
- Added `GradleUtils`. This object contains heuristics to detect
specific IDE use cases.
- Restored the copy task removed by #81, on which the main sourceSet's
`ProcessResource` task was dependent. The dependency is active only when
`GradleUtils. invokedByKotlinJvmBuild()` is true, which means it was
invoked by the run button in IntelliJ/Android Studio.

## Testing

- Tested with the JVM tutorial added by #62. The project was cleaned
before testing.
- Tested with a multi-module project as well.

## Issues Fixed

Fixes: #95
paxbun added a commit to paxbun/gobley that referenced this pull request Apr 5, 2025
paxbun added a commit that referenced this pull request Apr 5, 2025
@paxbun paxbun added the breaking Introduces huge breaking changes label Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces huge breaking changes cargo Related to Cargo integration enhancement New feature or request gradle Related to the Gradle plugins

Projects

None yet

2 participants