ActuallyAdditions/build.gradle

174 lines
5 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-03-04 20:21:48 +01:00
id 'net.neoforged.gradle.userdev' version '7.0.96'
2014-11-07 14:19:05 +01:00
}
2016-05-19 20:05:12 +02:00
2021-02-26 22:15:48 +01:00
version = "$mod_version"
2015-12-30 22:02:15 +01:00
group = "de.ellpeck.actuallyadditions"
2024-03-03 01:20:53 +01:00
base {
archivesName = "ActuallyAdditions-$game_version"
}
2014-11-07 14:19:05 +01:00
2020-11-07 14:38:30 +01:00
if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
2016-07-31 16:30:37 +02:00
}
2024-03-04 20:21:48 +01:00
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
2024-03-02 21:23:08 +01:00
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
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')
}
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
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 ->
// Recommended logging data for a userdev environment
systemProperty 'forge.logging.markers', 'REGISTRIES'
2021-02-26 22:15:48 +01:00
2024-03-04 20:21:48 +01:00
// Recommended logging level for the console
systemProperty 'forge.logging.console.level', 'debug'
2021-02-26 22:15:48 +01:00
2024-03-04 20:21:48 +01:00
//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.
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' }
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"
}
}
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-03-04 20:21:48 +01:00
compileOnly "mezz.jei:jei-${game_version}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${game_version}-neoforge-api:${jei_version}"
2024-03-03 01:20:53 +01:00
2024-03-04 20:21:48 +01:00
runtimeOnly "mezz.jei:jei-${game_version}-neoforge:${jei_version}"
2024-03-04 20:21:48 +01:00
runtimeOnly "curse.maven:the-one-probe-245211:5084077"
runtimeOnly "curse.maven:mekanism-268560:5155329"
2014-11-07 14:19:05 +01:00
}
2021-02-26 22:15:48 +01:00
// not sure if this is still needed
2021-11-21 21:34:08 +01:00
//processResources {
// inputs.property('version', project.version)
//
// from(sourceSets.main.resources.srcDirs) {
// include 'META-INF/mods.toml'
// expand 'version': project.version
// }
//
// from(sourceSets.main.resources.srcDirs) {
// exclude 'META-INF/mods.toml'
// }
//}
2015-01-05 22:50:20 +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,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
}
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
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}