plugins { id 'java-library' id 'eclipse' id 'idea' id 'maven-publish' id 'net.neoforged.gradle.userdev' version '7.0.165' } 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(21) 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' } // Sets up a dependency configuration called 'localRuntime'. // This configuration should be used instead of 'runtimeOnly' to declare // a dependency that will be present for runtime testing but that is // "optional", meaning it will not be pulled by dependents of this mod. configurations { runtimeClasspath.extendsFrom localRuntime } repositories { maven { url = "https://maven.blamejared.com" } maven { url "https://cursemaven.com" content { includeGroup "curse.maven" } } maven { url = 'https://maven.octo-studios.com/releases' } } dependencies { implementation "net.neoforged:neoforge:${neo_version}" compileOnly "mezz.jei:jei-${jei_minecraft}-common-api:${jei_version}" compileOnly "mezz.jei:jei-${jei_minecraft}-neoforge-api:${jei_version}" localRuntime "mezz.jei:jei-${jei_minecraft}-neoforge:${jei_version}" compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}" localRuntime "vazkii.patchouli:Patchouli:${patchouli_version}" compileOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}" localRuntime "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}" localRuntime "curse.maven:jade-324717:5803666" localRuntime "curse.maven:mekanism-268560:5680395" implementation "top.theillusivec4.curios:curios-neoforge:${curios_version}" } 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 } 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") } } } // IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. idea { module { downloadSources = true downloadJavadoc = true } }