Skip to content
Draft
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
22 changes: 22 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ concurrency:
cancel-in-progress: true

jobs:
teavm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Generate JBang cache key
id: cache-key
shell: bash
run: |
echo "cache_key=jbang-$(date +%F)" >> $GITHUB_OUTPUT
- name: Use cache
uses: actions/cache@v4
with:
path: ~/.jbang
key: ${{ steps.cache-key.outputs.cache_key }}
restore-keys:
jbang-
- name: Setup JBang
uses: jbangdev/setup-jbang@main
- run: ./gradlew :jabkit:buildWasmGC

conditions:
runs-on: ubuntu-latest
outputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jvmDependencyConflicts.patch {
}
}

// This sets the java module names for the jar files.
// Required for a deterministic and clean module-aware build.
// Especially needed for jpackage.
extraJavaModuleInfo {
failOnAutomaticModules = true
failOnModifiedDerivedModuleNames = true
Expand Down Expand Up @@ -643,4 +646,62 @@ extraJavaModuleInfo {
module("org.openjdk.jmh:jmh-generator-bytecode", "jmh.generator.bytecode")
module("org.openjdk.jmh:jmh-generator-reflection", "jmh.generator.reflection")
module("org.apache.commons:commons-math3", "commons.math3")

// region TeaVM
module("org.teavm:teavm-core", "teavm.core") {
exports("org.teavm.vm.spi") // ensures org.teavm.vm.spi is visible
}
module("org.teavm:teavm-classlib", "teavm.classlib") {
requireAllDefinedDependencies()
requires("teavm.core")
}
module("org.teavm:teavm-interop", "teavm.interop")
module("org.teavm:teavm-platform", "teavm.platform") {
// requireAllDefinedDependencies()
requires("teavm.core")
}
module("org.teavm:teavm-jso", "org.teavm.jso")
module("org.teavm:teavm-jso-apis", "org.teavm.jso.apis")

module("org.teavm:teavm-jso-impl", "teavm.jso.impl") {
requireAllDefinedDependencies()
requires("teavm.core")
}
module("org.teavm:teavm-relocated-libs-rhino", "teavm.relocated.libs.rhino")

module("org.teavm:teavm-metaprogramming-impl", "teavm.metaprogramming.impl") {
requireAllDefinedDependencies()
requires("teavm.core")
}
module("org.teavm:teavm-metaprogramming-api", "teavm.metaprogramming.api")
module("org.teavm:teavm-relocated-libs-commons-io", "teavm.relocated.libs.commons.io")
module("org.teavm:teavm-relocated-libs-asm", "teavm.relocated.libs.asm") {
// preserveExisting() // Does not work, because "Package org.objectweb.asm.signature not found in module" (the package moved org.objectweb to org.teavm)
patchRealModule()
exportAllPackages()
}
module("org.teavm:teavm-relocated-libs-asm-analysis", "teavm.relocated.libs.asm.analysis") {
patchRealModule()
exportAllPackages()
}
module("org.teavm:teavm-relocated-libs-asm-commons", "teavm.relocated.libs.asm.commons") {
patchRealModule()
exportAllPackages()
}
module("org.teavm:teavm-relocated-libs-asm-tree", "teavm.relocated.libs.asm.tree") {
patchRealModule()
exportAllPackages()
}
module("org.teavm:teavm-relocated-libs-asm-util", "teavm.relocated.libs.asm.util") {
patchRealModule()
exportAllPackages()
}
module("org.teavm:teavm-relocated-libs-hppc", "teavm.relocated.libs.asm.hppc") {
patchRealModule()
exportAllPackages()
}

module("com.jcraft:jzlib", "jzlib")
module("joda-time:joda-time", "org.joda.time")
// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ javaModulePackaging {
architecture = MachineArchitecture.X86_64
packageTypes = listOf("app-image", "msi")
}
// TeaVM Platforms: https://github.com/konsoletyper/teavm/blob/master/interop/core/src/main/java/org/teavm/interop/Platforms.java
target("webassembly") {
operatingSystem = OperatingSystemFamily.LINUX
architecture = MachineArchitecture.X86_64
packageTypes = listOf("")
}
}
37 changes: 37 additions & 0 deletions jabkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
plugins {
id("org.jabref.gradle.module")
id("application")
id("org.teavm") version "0.12.3"
}

import org.gradle.nativeplatform.OperatingSystemFamily
import org.gradle.nativeplatform.MachineArchitecture

group = "org.jabref.jabkit"
version = project.findProperty("projVersion") ?: "100.0.0"


dependencies {
implementation(teavm.libs.jsoApis)

implementation(project(":jablib"))

// FIXME: Injector needs to be removed, no JavaFX dependencies, etc.
Expand Down Expand Up @@ -50,6 +56,9 @@ dependencies {
testImplementation(project(":test-support"))
testImplementation("org.mockito:mockito-core")
testImplementation("net.bytebuddy:byte-buddy")

// TeaVM
testImplementation("org.teavm:teavm-core")
}

javaModuleTesting.whitebox(testing.suites["test"]) {
Expand Down Expand Up @@ -94,3 +103,31 @@ javaModulePackaging {
packageTypes = listOf("app-image")
}
}

teavm {
all {
mainClass.set("org.jabref.JabKit")
}
js {
addedToWebApp = true

// this is also optional, default value is <project name>.js
targetFileName = "example.js"
}
wasmGC {
addedToWebApp = true
}
}

configurations.testImplementation {
exclude(group = "org.teavm", module = "teavm-junit")
}

// Hint by @jjohannes
configurations.teavmClasspath {
attributes {
// TeaVM Platforms: https://github.com/konsoletyper/teavm/blob/master/interop/core/src/main/java/org/teavm/interop/Platforms.java
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named<OperatingSystemFamily>(OperatingSystemFamily.LINUX))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named<MachineArchitecture>(MachineArchitecture.X86_64))
}
}
1 change: 1 addition & 0 deletions versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ dependencies.constraints {
api("org.postgresql:postgresql:42.7.7")
api("org.slf4j:jul-to-slf4j:2.0.17")
api("org.slf4j:slf4j-api:2.0.17")
api("org.teavm:teavm-core:0.12.3")
api("org.testfx:testfx-core:4.0.18")
api("org.testfx:testfx-junit5:4.0.18")
api("org.tinylog:slf4j-tinylog:2.7.0")
Expand Down
Loading