Skip to content
Closed
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
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ jobs:
run: gradle test
working-directory: ./java

- name: Publish Java release
run: gradle publish
working-directory: ./java
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Release fs-storage NDK binaries
- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Add Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

- name: Build fs-storage
run: cargo ndk -o ./target/release/fs-storage/jniLibs --target aarch64-linux-android --target armv7-linux-androideabi --target i686-linux-android --target x86_64-linux-android build -p fs-storage --release

- name: Upload fs-storage
uses: actions/upload-artifact@v4
with:
name: fs-storage
path: ./target/release/fs-storage/jniLibs

windows:
name: Test on Windows
runs-on: windows-latest
Expand Down
47 changes: 30 additions & 17 deletions java/lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
plugins {
// Apply the java-library plugin for API and implementation separation.
`java-library`
`maven-publish` // Apply the maven-publish plugin before java-library for publishing to GitHub Packages.
`java-library` // Apply the java-library plugin for API and implementation separation.
}

group = "dev.arkbuilders"
version = "1.0-SNAPSHOT"

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
mavenCentral() // Use Maven Central for resolving dependencies.
}

dependencies {
// Use JUnit Jupiter for testing.
testImplementation(libs.junit.jupiter)

testImplementation(libs.junit.jupiter) // Use JUnit Jupiter for testing.
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

// This dependency is exported to consumers, that is to say found on their compile classpath.
api(libs.commons.math3)

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation(libs.guava)
api(libs.commons.math3) // This dependency is exported to consumers, that is to say found on their compile classpath.
implementation(libs.guava) // This dependency is used internally, and not exposed to consumers on their own compile classpath.
}

// Apply a specific Java toolchain to ease working on different environments.
Expand All @@ -29,14 +25,31 @@ java {
}

tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
// Set the JVM argument for the java.library.path (To import rust compiled library)
val rustLibPath = projectDir.resolve("../../target/release").absolutePath
val rustLibPath = projectDir.resolve("../../target/release").absolutePath // Set the JVM argument for the java.library.path (To import rust compiled library)
useJUnitPlatform() // Use JUnit Platform for unit tests.
jvmArgs = listOf("-Djava.library.path=$rustLibPath")
}

tasks.named<Javadoc>("javadoc") {
options.encoding = "UTF-8"
options.memberLevel = JavadocMemberLevel.PUBLIC
}

publishing {
// Define a Maven publication for the 'maven' repository
publications {
create<MavenPublication>("Maven") {
from(components["java"])
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ARK-Builders/ark-core")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}