diff --git a/java/build.gradle.kts b/java/build.gradle.kts index 0f8e05278..0c9b73082 100644 --- a/java/build.gradle.kts +++ b/java/build.gradle.kts @@ -1,90 +1,30 @@ plugins { - id("java") + java } -repositories{ - mavenCentral() - google() - maven { url = uri("https://jogamp.org/deployment/maven") } -} - -sourceSets{ - main{ - java{ - srcDirs("src") - exclude("processing/mode/java/preproc/**") - } - } - test{ - java{ - srcDirs("test") - } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) } } -dependencies{ - implementation(project(":app")) - implementation(project(":core")) - implementation(project(":java:preprocessor")) - - implementation(libs.eclipseJDT) - implementation(libs.eclipseJDTCompiler) - implementation(libs.classpathExplorer) - implementation(libs.netbeansSwing) - implementation(libs.ant) - implementation(libs.lsp4j) - implementation(libs.jsoup) - implementation(libs.antlr) +val coreJar = file("../../../core/library/core.jar") - testImplementation(libs.junit) - testImplementation(libs.mockito) +dependencies { + implementation(files(coreJar)) } -tasks.compileJava{ - options.encoding = "UTF-8" -} - -// LEGACY TASKS -// Most of these are shims to be compatible with the old build system -// They should be removed in the future, as we work towards making things more Gradle-native -tasks.register("extraResources"){ - dependsOn(":java:copyCore") - from(".") - include("keywords.txt") - include("theme/**/*") - include("application/**/*") - into( layout.buildDirectory.dir("resources-bundled/common/modes/java")) -} -tasks.register("copyCore"){ - val coreProject = project(":core") - dependsOn(coreProject.tasks.jar) - from(coreProject.tasks.jar) { - include("core*.jar") - } - rename("core.+\\.jar", "core.jar") - into(coreProject.layout.projectDirectory.dir("library")) -} - -val libraries = arrayOf("dxf","io","net","pdf","serial","svg") -libraries.forEach { library -> - tasks.register("library-$library-extraResources"){ - val build = project(":java:libraries:$library").tasks.named("build") - build.configure { - dependsOn(":java:copyCore") +tasks.register("checkCore") { + doFirst { + if (!coreJar.exists()) { + throw GradleException("Missing core.jar at $coreJar. Please build the core module first.") } - dependsOn(build) - from("libraries/$library") - include("*.properties") - include("library/**/*") - include("examples/**/*") - into( layout.buildDirectory.dir("resources-bundled/common/modes/java/libraries/$library")) } - tasks.named("extraResources"){ dependsOn("library-$library-extraResources") } } -tasks.jar { dependsOn("extraResources") } -tasks.processResources{ finalizedBy("extraResources") } -tasks.compileTestJava{ finalizedBy("extraResources") } -tasks.test { - useJUnit() -} \ No newline at end of file +tasks.register("dxfJar") { + dependsOn("checkCore", "classes") + archiveBaseName.set("dxf") + destinationDirectory.set(file("library")) + from(sourceSets.main.get().output) +} diff --git a/java/libraries/dxf/build.gradle.kts b/java/libraries/dxf/build.gradle.kts index a176f03df..cae77739a 100644 --- a/java/libraries/dxf/build.gradle.kts +++ b/java/libraries/dxf/build.gradle.kts @@ -1 +1,32 @@ -ant.importBuild("build.xml") \ No newline at end of file +plugins { + java +} + + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + +val coreJar = file("../../../core/library/core.jar") + +dependencies { + implementation(files(coreJar)) +} + +tasks.register("checkCore") { + doFirst { + if (!coreJar.exists()) { + throw GradleException("Missing core.jar at $coreJar. Please build the core module first.") + } + } +} + +tasks.register("dxfJar") { + dependsOn("checkCore", "classes") + archiveBaseName.set("dxf") + destinationDirectory.set(file("library")) + from(sourceSets.main.get().output) +} + diff --git a/java/libraries/dxf/build/tmp/dxfJar/MANIFEST.MF b/java/libraries/dxf/build/tmp/dxfJar/MANIFEST.MF new file mode 100644 index 000000000..59499bce4 --- /dev/null +++ b/java/libraries/dxf/build/tmp/dxfJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/settings.gradle.kts b/settings.gradle.kts index 4bdcd880e..51f58546e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,17 @@ +pluginManagement { + plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0") + } + repositories { + gradlePluginPortal() + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + +rootProject.name = "processing" rootProject.name = "processing" include( "core",