ActuallyAdditions/build.gradle

176 lines
5.4 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
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-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')
}
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-06 00:10:42 +01:00
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}"
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
}
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
2024-03-07 01:24:42 +01:00
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) {
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
}