ActuallyAdditions/build.gradle

189 lines
6 KiB
Groovy
Raw Normal View History

2024-03-03 01:20:53 +01:00
plugins {
2024-03-04 20:21:48 +01:00
id 'java-library'
2024-03-03 01:20:53 +01:00
id 'eclipse'
id 'idea'
id 'maven-publish'
2024-10-14 19:56:18 +02:00
id 'net.neoforged.gradle.userdev' version '7.0.165'
2014-11-07 14:19:05 +01:00
}
2016-05-19 20:05:12 +02:00
2024-03-07 01:24:42 +01:00
def buildSuffix = System.getenv('BUILD_NUMBER') ? "-b${System.getenv('BUILD_NUMBER')}" : ""
version = "$mod_version+mc${game_version}${buildSuffix}"
2015-12-30 22:02:15 +01:00
group = "de.ellpeck.actuallyadditions"
2024-03-03 01:20:53 +01:00
base {
2024-03-07 01:24:42 +01:00
archivesName = "ActuallyAdditions"
2016-07-31 16:30:37 +02:00
}
2024-07-08 13:17:57 +02:00
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
2021-02-26 22:15:48 +01:00
2024-03-04 20:21:48 +01:00
if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
}
2021-02-26 22:15:48 +01:00
2024-03-04 20:21:48 +01:00
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")
2021-02-26 22:15:48 +01:00
}
2024-03-04 20:21:48 +01:00
modSource project.sourceSets.main
}
2024-03-04 20:21:48 +01:00
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
2024-03-13 22:35:11 +01:00
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
}
client2 {
configure ("client")
programArguments.addAll '--username', 'Dev2'
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
2024-03-04 20:21:48 +01:00
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()
2021-02-26 22:15:48 +01:00
}
2014-11-07 14:19:05 +01:00
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
2024-08-11 20:30:35 +02:00
// 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
}
2015-04-26 20:07:57 +02:00
repositories {
2016-01-16 20:06:25 +01:00
maven {
2024-03-03 01:20:53 +01:00
url = "https://maven.blamejared.com"
2020-11-20 18:55:16 +01:00
}
maven {
2024-03-04 20:21:48 +01:00
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven { url = 'https://maven.octo-studios.com/releases' }
2015-04-26 20:07:57 +02:00
}
dependencies {
2024-03-04 20:21:48 +01:00
implementation "net.neoforged:neoforge:${neo_version}"
2021-02-26 22:15:48 +01:00
2024-08-11 20:30:35 +02:00
compileOnly "mezz.jei:jei-${jei_minecraft}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${jei_minecraft}-neoforge-api:${jei_version}"
2024-03-03 01:20:53 +01:00
2024-08-11 20:30:35 +02:00
localRuntime "mezz.jei:jei-${jei_minecraft}-neoforge:${jei_version}"
2024-03-06 00:10:42 +01:00
compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}"
2024-10-14 19:56:18 +02:00
localRuntime "vazkii.patchouli:Patchouli:${patchouli_version}"
2024-03-06 00:10:42 +01:00
compileOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}"
2024-10-14 19:56:18 +02:00
localRuntime "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}"
2024-03-06 00:10:42 +01:00
2024-10-14 19:56:18 +02:00
localRuntime "curse.maven:jade-324717:5803666"
localRuntime "curse.maven:mekanism-268560:5680395"
2024-10-24 23:06:42 +02:00
// Immersive Engineering, mainly for compat datagen
2024-10-25 00:35:33 +02:00
localRuntime "curse.maven:ie-231951:5828000"
compileOnly "curse.maven:ie-231951:5828000"
localRuntime "blusunrize.immersiveengineering:ImmersiveEngineering:1.21.1-12.0.0-182.77:datagen"
compileOnly "blusunrize.immersiveengineering:ImmersiveEngineering:1.21.1-12.0.0-182.77:datagen"
localRuntime "blusunrize.immersiveengineering:ImmersiveEngineering:1.21.1-12.0.0-182.77:api"
compileOnly "blusunrize.immersiveengineering:ImmersiveEngineering:1.21.1-12.0.0-182.77:api"
2024-10-24 23:06:42 +02:00
implementation "top.theillusivec4.curios:curios-neoforge:${curios_version}"
2014-11-07 14:19:05 +01:00
}
2020-11-20 18:55:16 +01:00
jar {
2021-02-26 22:15:48 +01:00
group = 'artifact'
manifest {
attributes(["Specification-Title" : "Actually Additions",
2021-02-26 22:15:48 +01:00
"Specification-Version" : "1",
"Implementation-Title" : project.archivesBaseName,
"Implementation-Version" : project.version,
2024-03-07 01:24:42 +01:00
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Modloader": "Neoforge",
"Modloader-Version": project.neo_version,
])
2021-02-26 22:15:48 +01:00
}
2020-11-20 18:55:16 +01:00
2021-02-26 22:15:48 +01:00
from sourceSets.main.output
2020-11-20 18:55:16 +01:00
}
2016-05-19 20:05:12 +02:00
task apiJar(type: Jar) {
2020-11-20 18:46:34 +01:00
from sourceSets.main.output
from sourceSets.main.java
2024-03-03 01:20:53 +01:00
archiveClassifier.set('api')
2020-11-20 18:46:34 +01:00
include 'de/ellpeck/actuallyadditions/api/**'
2016-07-31 16:30:37 +02:00
}
javadoc {
include 'de/ellpeck/actuallyadditions/api/**'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from 'build/docs/javadoc'
2024-03-03 01:20:53 +01:00
archiveClassifier.set('javadoc')
2016-07-31 16:30:37 +02:00
}
2020-11-20 18:46:34 +01:00
task sourcesJar(type: Jar) {
from sourceSets.main.java
2024-03-03 01:20:53 +01:00
archiveClassifier.set('sources')
2020-11-20 18:46:34 +01:00
}
2020-11-21 19:08:07 +01:00
artifacts {
2024-03-04 20:21:48 +01:00
archives sourcesJar, apiJar, javadocJar
2020-11-21 19:08:07 +01:00
}
2016-07-31 16:30:37 +02:00
publishing {
2020-11-21 19:08:07 +01:00
tasks.publish.dependsOn build
2016-07-31 16:30:37 +02:00
publications {
mavenJava(MavenPublication) {
2020-11-21 19:08:07 +01:00
groupId = group
2024-03-03 01:20:53 +01:00
artifactId = base.archivesName.get()
2020-11-21 19:08:07 +01:00
version = version
from components.java
artifact sourcesJar
2020-11-20 19:02:53 +01:00
artifact apiJar
artifact javadocJar
2020-11-21 19:08:07 +01:00
pom.withXml {
def node = asNode()
if (node.dependencies.size() > 0)
node.remove(node.dependencies)
}
2016-07-31 16:30:37 +02:00
}
}
repositories {
maven {
2020-10-07 21:25:00 +02:00
url "file://" + System.getenv("local_maven")
2016-07-31 16:30:37 +02:00
}
}
2021-02-26 22:15:48 +01:00
}
2024-03-03 01:20:53 +01:00
2024-07-08 13:17:57 +02:00
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
2024-03-03 01:20:53 +01:00
}