plugins { id 'java-library' id 'eclipse' id 'idea' id 'maven-publish' id 'net.neoforged.gradle.userdev' version '7.0.96' } def buildSuffix = System.getenv('BUILD_NUMBER') ? "-b${System.getenv('BUILD_NUMBER')}" : "" version = "$mod_version+mc${game_version}${buildSuffix}" group = "de.ellpeck.actuallyadditions" base { archivesName = "ActuallyAdditions" } java.toolchain.languageVersion = JavaLanguageVersion.of(17) if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') } runs { // applies to all the run configs below configureEach { net.neoforged.gradle.dsl.common.runs.run.Run run -> //Limit ram usage for the dev environment to 4GB jvmArgument '-Xmx4G' if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) { run.jvmArgument("-XX:+AllowEnhancedClassRedefinition") } modSource project.sourceSets.main } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions" } client2 { configure ("client") programArguments.addAll '--username', 'Dev2' // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions" } server { systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions" programArgument '--nogui' } data { // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it // workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. programArguments.addAll '--mod', "actuallyadditions", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { maven { url = "https://maven.blamejared.com" } maven { url "https://cursemaven.com" content { includeGroup "curse.maven" } } } dependencies { implementation "net.neoforged:neoforge:${neo_version}" compileOnly "mezz.jei:jei-${game_version}-common-api:${jei_version}" compileOnly "mezz.jei:jei-${game_version}-neoforge-api:${jei_version}" runtimeOnly "mezz.jei:jei-${game_version}-neoforge:${jei_version}" compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}" runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}" compileOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}" runtimeOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}" runtimeOnly "curse.maven:jade-324717:5109393" runtimeOnly "curse.maven:mekanism-268560:5155329" } jar { group = 'artifact' manifest { attributes(["Specification-Title" : "Actually Additions", "Specification-Version" : "1", "Implementation-Title" : project.archivesBaseName, "Implementation-Version" : project.version, "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "Modloader": "Neoforge", "Modloader-Version": project.neo_version, ]) } from sourceSets.main.output } processResources { inputs.property('version', project.version) inputs.property('neo_version_range', project.neo_version_range) inputs.property('loader', project.loader) inputs.property('minecraft_version_range', project.minecraft_version_range) filesMatching(['META-INF/mods.toml']) { expand 'version': project.version, 'neo_version_range': project.neo_version_range, 'loader': project.loader, 'minecraft_version_range': project.minecraft_version_range } } task apiJar(type: Jar) { from sourceSets.main.output from sourceSets.main.java archiveClassifier.set('api') include 'de/ellpeck/actuallyadditions/api/**' } javadoc { include 'de/ellpeck/actuallyadditions/api/**' } task javadocJar(type: Jar, dependsOn: javadoc) { from 'build/docs/javadoc' archiveClassifier.set('javadoc') } task sourcesJar(type: Jar) { from sourceSets.main.java archiveClassifier.set('sources') } artifacts { archives sourcesJar, apiJar, javadocJar } publishing { tasks.publish.dependsOn build publications { mavenJava(MavenPublication) { groupId = group artifactId = base.archivesName.get() version = version from components.java artifact sourcesJar artifact apiJar artifact javadocJar pom.withXml { def node = asNode() if (node.dependencies.size() > 0) node.remove(node.dependencies) } } } repositories { maven { url "file://" + System.getenv("local_maven") } } } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation }