diff --git a/ansi/build.gradle b/ansi/build.gradle index f76079fe..5eff0195 100644 --- a/ansi/build.gradle +++ b/ansi/build.gradle @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ + // Plugins plugins { id("java") @@ -23,9 +24,8 @@ plugins { id("maven-publish") } -// Project dependencies +// Dependencies dependencies { - // -> Runtime <- // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -33,36 +33,11 @@ dependencies { // JetBrains Annotations compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - // ANSI support + // Jansi implementation("org.fusesource.jansi:jansi:${dependencyJansi}") // Project implementation(project(":base")) - - // -> Testing <- - // Jetbrains Annotations - testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - - // JUnit - testImplementation(platform("org.junit:junit-bom:${dependencyJunit}")) - testImplementation("org.junit.jupiter:junit-jupiter") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") -} - -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) } // Javadoc configuration @@ -88,26 +63,6 @@ javadoc { } } -// Unit testing configuration -test { - useJUnitPlatform() - - // Pass test configuration to test VMs - Map testConfiguration = new HashMap<>(); - for (String property : project.properties.keySet()) - if (property.startsWith("test.")) - testConfiguration.put(property, project.properties.get(property).toString()) - systemProperties(testConfiguration) - - setMaxParallelForks(project.hasProperty("jobs") ? Integer.parseInt((String) project.property("jobs")) : 8) - setForkEvery(1) - setFailFast(true) - - testLogging { - events("passed", "skipped", "failed") - } -} - // Include javadoc and source jar during publishing java { withJavadocJar() @@ -139,3 +94,19 @@ publishing { } } } + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +} diff --git a/base/build.gradle b/base/build.gradle index 97218ac9..b8bf1d47 100644 --- a/base/build.gradle +++ b/base/build.gradle @@ -26,9 +26,9 @@ plugins { id("maven-publish") } -// Project dependencies +// Dependencies dependencies { - // -> Runtime <- + // -> Runtime // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -39,7 +39,7 @@ dependencies { // Reflections implementation("org.reflections:reflections:${dependencyReflections}") - // -> Testing <- + // -> Testing // Jetbrains Annotations testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") @@ -48,65 +48,10 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - // -> Project <- + // Project testImplementation(project(":testing")) } -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) -} - -// Copy gradle.properties file -// for inclusion in final build -tasks.register("copyGradleProperties") { - doFirst { - File target = file("${project.projectDir}/src/main/resources/sosengine-gradle.properties") - File source = file(project(":").projectDir.getPath() + "/gradle.properties") - target.delete() - Files.copy(source.toPath(), target.toPath()) - } - - outputs.upToDateWhen({ false }) // Force task execution -} -processResources.dependsOn(copyGradleProperties) - -// Git properties configuration -// Allows us to embed git commit information in the engine build -gitProperties { - dotGitDirectory = file("${rootProject.rootDir}/.git") - failOnNoGitDirectory = false // Allow continuing if .git directory is missing for the few who use tarballs - extProperty = "gitProps" - - dateFormat = "yyyy-MM-dd'T'HH:mmZ" - dateFormatTimeZone = "UTC" -} - -tasks.register("writeGitProperties") { // This task's only purpose is to copy the git.properties from our git properties plugin to the resources directory so it's included in the final build - doLast { - File target = file("${project.projectDir}/src/main/resources/sosengine-git.properties") - File source = file("${project.projectDir}/build/resources/main/git.properties") - - target.delete() - source.renameTo(target) - } - - outputs.upToDateWhen({ false }) // Force task execution -} -generateGitProperties.outputs.upToDateWhen({ false }) // Force task execution -processResources.dependsOn(writeGitProperties) // Ensure git.properties file is present - // Javadoc configuration javadoc { outputs.upToDateWhen { false } // Force task execution @@ -181,3 +126,58 @@ publishing { } } } + +// Copy gradle.properties file +// for inclusion in final build +tasks.register("copyGradleProperties") { + doFirst { + File target = file("${project.projectDir}/src/main/resources/sosengine-gradle.properties") + File source = file(project(":").projectDir.getPath() + "/gradle.properties") + target.delete() + Files.copy(source.toPath(), target.toPath()) + } + + outputs.upToDateWhen({ false }) // Force task execution +} +processResources.dependsOn(copyGradleProperties) + +// Git properties configuration +// Allows us to embed git commit information in the engine build +gitProperties { + dotGitDirectory = file("${rootProject.rootDir}/.git") + failOnNoGitDirectory = false // Allow continuing if .git directory is missing for the few who use tarballs + extProperty = "gitProps" + + dateFormat = "yyyy-MM-dd'T'HH:mmZ" + dateFormatTimeZone = "UTC" +} + +tasks.register("writeGitProperties") { // This task's only purpose is to copy the git.properties from our git properties plugin to the resources directory so it's included in the final build + doLast { + File target = file("${project.projectDir}/src/main/resources/sosengine-git.properties") + File source = file("${project.projectDir}/build/resources/main/git.properties") + + target.delete() + source.renameTo(target) + } + + outputs.upToDateWhen({ false }) // Force task execution +} +generateGitProperties.outputs.upToDateWhen({ false }) // Force task execution +processResources.dependsOn(writeGitProperties) // Ensure git.properties file is present + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +} diff --git a/notification/build.gradle b/notification/build.gradle index 8751caf8..255252db 100644 --- a/notification/build.gradle +++ b/notification/build.gradle @@ -26,7 +26,6 @@ plugins { // Dependencies dependencies { - // -> Runtime <- // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -34,26 +33,10 @@ dependencies { // JetBrains Annotations compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - // -> Project <- + // Project implementation(project(":base")) } -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) -} - // Javadoc configuration javadoc { outputs.upToDateWhen { false } // Force task execution @@ -108,3 +91,19 @@ publishing { } } } + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +} diff --git a/slf4j-compat/build.gradle b/slf4j-compat/build.gradle index 25b82c81..5d8cabaa 100644 --- a/slf4j-compat/build.gradle +++ b/slf4j-compat/build.gradle @@ -26,7 +26,6 @@ plugins { // Dependencies dependencies { - // -> Runtime <- // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -37,26 +36,10 @@ dependencies { // SLF4J implementation("org.slf4j:slf4j-api:${dependencySlf4j}") - // -> Project <- + // Project implementation(project(":base")) } -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) -} - // Javadoc configuration javadoc { outputs.upToDateWhen { false } // Force task execution @@ -111,3 +94,19 @@ publishing { } } } + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +} diff --git a/testapp/build.gradle b/testapp/build.gradle index 1b3b7428..0bae25e7 100644 --- a/testapp/build.gradle +++ b/testapp/build.gradle @@ -30,7 +30,6 @@ plugins { // Dependencies dependencies { - // -> Runtime <- // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -38,11 +37,11 @@ dependencies { // JetBrains Annotations compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - // -> Project <- + // Project implementation(project(":base")) + implementation(project(":windowing")) runtimeOnly(project(":ansi")) runtimeOnly(project(":slf4j-compat")) - implementation(project(":windowing")) runtimeOnly(project(":windowing:glfw")) } diff --git a/testing/build.gradle b/testing/build.gradle index 85d5ca74..aec561df 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ + // Plugins plugins { id("java") @@ -23,7 +24,7 @@ plugins { id("maven-publish") } -// Project dependencies +// Dependencies dependencies { // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") @@ -36,26 +37,10 @@ dependencies { implementation(platform("org.junit:junit-bom:${dependencyJunit}")) implementation("org.junit.jupiter:junit-jupiter") - // -> Project <- + // Project implementation(project(":base")) } -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) -} - // Javadoc configuration javadoc { outputs.upToDateWhen { false } // Force task execution @@ -110,3 +95,19 @@ publishing { } } } + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +} diff --git a/windowing/build.gradle b/windowing/build.gradle index f02a5093..255252db 100644 --- a/windowing/build.gradle +++ b/windowing/build.gradle @@ -26,7 +26,6 @@ plugins { // Dependencies dependencies { - // -> Runtime <- // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -34,35 +33,10 @@ dependencies { // JetBrains Annotations compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - // -> Testing <- - // Jetbrains Annotations - testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - - // JUnit - testImplementation(platform("org.junit:junit-bom:${dependencyJunit}")) - testImplementation("org.junit.jupiter:junit-jupiter") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - // -> Project <- + // Project implementation(project(":base")) } -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) -} - // Javadoc configuration javadoc { outputs.upToDateWhen { false } // Force task execution @@ -86,26 +60,6 @@ javadoc { } } -// Unit testing configuration -test { - useJUnitPlatform() - - // Pass test configuration to test VMs - Map testConfiguration = new HashMap<>(); - for (String property : project.properties.keySet()) - if (property.startsWith("test.")) - testConfiguration.put(property, project.properties.get(property).toString()) - systemProperties(testConfiguration) - - setMaxParallelForks(project.hasProperty("jobs") ? Integer.parseInt((String) project.property("jobs")) : 8) - setForkEvery(1) - setFailFast(true) - - testLogging { - events("passed", "skipped", "failed") - } -} - // Include javadoc and source jar during publishing java { withJavadocJar() @@ -137,3 +91,19 @@ publishing { } } } + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +} diff --git a/windowing/glfw/build.gradle b/windowing/glfw/build.gradle index d12f687f..aa4e9617 100644 --- a/windowing/glfw/build.gradle +++ b/windowing/glfw/build.gradle @@ -26,32 +26,8 @@ plugins { id("maven-publish") } -// Determine operating system and architecture -switch (OperatingSystem.current()) { - case OperatingSystem.LINUX: - project.dependencyLwjglNatives = "natives-linux" - def osArch = System.getProperty("os.arch") - if (osArch.startsWith("arm") || osArch.startsWith("aarch64")) - project.dependencyLwjglNatives += osArch.contains("64") || osArch.startsWith("armv8") ? "-arm64" : "-arm32" - else if (osArch.startsWith("ppc")) - project.dependencyLwjglNatives += "-ppc64le" - else if (osArch.startsWith("riscv")) - project.dependencyLwjglNatives += "-riscv64" - break - case OperatingSystem.MAC_OS: - project.dependencyLwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos" - break - case OperatingSystem.WINDOWS: - def osArch = System.getProperty("os.arch") - project.dependencyLwjglNatives = osArch.contains("64") - ? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}" - : "natives-windows-x86" - break -} - // Dependencies dependencies { - // -> Runtime <- // Lombok compileOnly("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") @@ -69,36 +45,11 @@ dependencies { runtimeOnly("org.lwjgl:lwjgl-stb::${dependencyLwjglNatives}") if (project.dependencyLwjglNatives == "natives-macos" || project.dependencyLwjglNatives == "natives-macos-arm64") runtimeOnly("org.lwjgl:lwjgl-vulkan::${dependencyLwjglNatives}") - // -> Testing <- - // Jetbrains Annotations - testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") - - // JUnit - testImplementation(platform("org.junit:junit-bom:${dependencyJunit}")) - testImplementation("org.junit.jupiter:junit-jupiter") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - // -> Project <- + // Project implementation(project(":base")) implementation(project(":windowing")) } -// Fix delombok task -delombok.doFirst { - File target = file("${project.projectDir}/src/main/module-info.java") - File source = file("${project.projectDir}/src/main/java/module-info.java") - - target.delete() - source.renameTo(target) -} -delombok.doLast { - File target = file("${project.projectDir}/src/main/java/module-info.java") - File source = file("${project.projectDir}/src/main/module-info.java") - - target.delete() - source.renameTo(target) -} - // Javadoc configuration javadoc { outputs.upToDateWhen { false } // Force task execution @@ -173,3 +124,40 @@ publishing { } } } + +// Determine operating system and architecture +switch (OperatingSystem.current()) { + case OperatingSystem.LINUX -> { + project.dependencyLwjglNatives = "natives-linux" + def osArch = System.getProperty("os.arch") + if (osArch.startsWith("arm") || osArch.startsWith("aarch64")) + project.dependencyLwjglNatives += osArch.contains("64") || osArch.startsWith("armv8") ? "-arm64" : "-arm32" + else if (osArch.startsWith("ppc")) + project.dependencyLwjglNatives += "-ppc64le" + else if (osArch.startsWith("riscv")) + project.dependencyLwjglNatives += "-riscv64" + } + case OperatingSystem.MAC_OS -> project.dependencyLwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos" + case OperatingSystem.WINDOWS -> { + def osArch = System.getProperty("os.arch") + project.dependencyLwjglNatives = osArch.contains("64") + ? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}" + : "natives-windows-x86" + } +} + +// Fix delombok task +delombok.doFirst { + File target = file("${project.projectDir}/src/main/module-info.java") + File source = file("${project.projectDir}/src/main/java/module-info.java") + + target.delete() + source.renameTo(target) +} +delombok.doLast { + File target = file("${project.projectDir}/src/main/java/module-info.java") + File source = file("${project.projectDir}/src/main/module-info.java") + + target.delete() + source.renameTo(target) +}