plugins { id 'java' id 'java-library' id 'gsl-starplane' version '0.2.3-a20251219' id 'maven-publish' id 'eclipse' } group 'de.geolykt' // Hint: Version is declared in gradle.properties file // The following statement defines that Java 8 should be used (which is galimulator's runtime version), // however if you dare, you can bump the version - just beware that users may lack the knowledge in how to install and run // your mod in that case. targetCompatibility = compileJava.targetCompatibility = sourceCompatibility = compileJava.sourceCompatibility = '1.8' repositories { // stianloader's maven repository, which is the repo where SLAPI and SLL are contianed in (among other stianloader toolchain stuff) maven { name 'stianloader-maven' url 'https://stianloader.org/maven' } maven { name 'fabric-maven' url 'https://maven.fabricmc.net/' } mavenCentral() mavenLocal() } configurations { mappings dependencyModsRuntime { transitive = false } compileOnlyApi.extendsFrom(devRuntime) compileOnlyApi.extendsFrom(galimulatorDependencies) } deployMods { from configurations["dependencyModsRuntime"] remapMods = true } dependencies { // The versions of SLAPI are listed here: https://stianloader.org/maven/de/geolykt/starloader-api/ compileOnlyApi "de.geolykt:starloader-api:2.0.0-a20251219:remapped" // The versions of launcher-micromixin are listed here: https://stianloader.org/maven/org/stianloader/launcher-micromixin/ devRuntime "org.stianloader:launcher-micromixin:4.0.0-a20241104" //devRuntime "org.stianloader:launcher-sponge:4.0.0-a20250819" //devRuntime "org.stianloader:launcher-mixin-fabric:4.0.0-a20250819" // https://stianloader.org/maven/org/stianloader/micromixin-annotations/ compileOnly "org.stianloader:micromixin-annotations:0.7.1-a20241104" /* devRuntime "org.stianloader:launcher-mixin-fabric:4.0.0" devRuntime "com.google.code.gson:gson:2.8.9" devRuntime "com.google.guava:guava:31.1-jre" */ compileOnly "de.geolykt.starloader:starplane-annotations:1.0.0" compileOnlyApi "org.jetbrains:annotations:26.0.2" // Libraries included via the extension.json (downloaded at runtime) compileOnly "org.stianloader:stianloader-concurrent:${stianloaderConcurrentVersion}" compileOnly ("org.danilopianini:java-quadtree:${quadTreeVersion}") { exclude group: 'com.google.guava', module: 'guava' } compileOnly "org.stianloader:stian-knn:${stianKNNVersion}" // Library mods dependencyModsRuntime "de.geolykt:starloader-api:2.0.0-a20251219:remapped" // Mods we also want to test this mod with, but don't actually depend on. // https://stianloader.org/maven/de/geolykt/fast-asynchronous-starlane-triangulator/ dependencyModsRuntime "de.geolykt:fast-asynchronous-starlane-triangulator:1.3.0-a20241109" // This one is there just for the sake of convinience dependencyModsRuntime "de.geolykt:galimulator-profiler:0.2.1-a20251219:remapped" // https://stianloader.org/maven/de/geolykt/star-cell-shading/ dependencyModsRuntime "de.geolykt:star-cell-shading:0.4.1-a20251218" // https://stianloader.org/maven/de/geolykt/s2dmenues/ dependencyModsRuntime "de.geolykt:s2dmenues:0.1.2-a20250823:remapped" // Especially this one has caused bugs in the past mappings "de.geolykt:bstarmap:0.0.1-a20251219@tinyv2.xz" } starplane { withRAS(rootProject.file("src/main/resources/faststar.ras")) mappingsFile("tinyv2", "XZ", configurations["mappings"]) } remapJar { archiveClassifier = 'remapped' fromJar jar dependsOn jar manifest { attributes 'Multi-Release': true } } runMods { from jar systemProperties.put("org.stianloader.sll.log.MIRROR_MAVEN_REQUESTS", true) systemProperties.put("org.stianloader.sll.log.level", "INFO") systemProperties.put("classloader.dump", true) systemProperties.put("org.stianloader.micromixin.debug", false) systemProperties.put("mixin.debug.verbose", true) systemProperties.put("mixin.dumpTargetOnFailure", true) systemProperties.put("mixin.debug", true) maxHeapSize = "16G" // Jitwatch stuff /* jvmArgs "-XX:+UnlockDiagnosticVMOptions" jvmArgs "-Xlog:class+load=info" jvmArgs "-XX:+LogCompilation" //jvmArgs "-XX:+PrintAssembly" jvmArgs "-XX:+DebugNonSafepoints" jvmArgs "-XX:LogFile=faststar-jit.log" // Jvm log files can be HUGE (several hundred megs), so we will overwrite them to not bloat everything up systemProperties.put("de.geolykt.faststar.nukeSMAPs", false) // SMAP genocide, because jitwatch is not a fan of them */ } build { dependsOn remapJar } // Multi-release jar shenanigans sourceSets { java21 { java { compileClasspath += main.compileClasspath compileClasspath += main.output java.setSrcDirs(new java.util.ArrayList()) java.srcDir(getProjectDir().toPath().resolve('src/main/java21')) } } java11 { java { compileClasspath += main.compileClasspath compileClasspath += main.output java.setSrcDirs(new java.util.ArrayList()) java.srcDir(getProjectDir().toPath().resolve('src/main/java11')) } } } compileJava21Java { javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(21) } dependsOn compileJava sourceCompatibility = '21' targetCompatibility = '21' modularity.inferModulePath.set(false) } compileJava11Java { javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(11) } dependsOn compileJava sourceCompatibility = '11' targetCompatibility = '11' modularity.inferModulePath.set(false) } // Actual Multi-release jar generation jar { dependsOn compileJava21Java dependsOn compileJava11Java into('META-INF/versions/21') { from sourceSets.java21.output } into('META-INF/versions/11') { from sourceSets.java11.output } manifest { attributes 'Multi-Release': true } } publishing { publications { plugin(MavenPublication) { publication -> groupId project.group artifactId project.base.archivesName.get() from components['java'] artifact remapJar } } repositories { if (System.getProperty('publishRepo') != null) { maven { url System.getProperty('publishRepo') allowInsecureProtocol = true } } else { mavenLocal() } } } processResources { filesMatching("extension.json") { expand(project.properties) } } genEclipseRuns { propertyExpansionSource = project.file("gradle.properties") } // Unfortunately Eclipse does not have per-sourceset java versions so // of course it will have quite the issues when seeing java 9 classes in an otherwise // java 8 project. In the end I have opted in using the traditional maven style of dealing with the issue: // Ignoring the java 9 source set. eclipse { classpath { file { whenMerged { entries.removeIf { it.path == 'src/main/java21' } entries.removeIf { it.path == 'src/main/java11' } entries.removeIf { it.path == project.file('build/classes/java/main').getAbsolutePath() } entries.removeIf { it.path == project.file('build/classes/java/java21').getAbsolutePath() } entries.removeIf { it.path == project.file('build/classes/java/java11').getAbsolutePath() } } } } }