mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-16 13:03:12 +01:00
173 lines
5 KiB
Groovy
173 lines
5 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id 'eclipse'
|
|
id 'idea'
|
|
id 'maven-publish'
|
|
id 'net.neoforged.gradle.userdev' version '7.0.96'
|
|
}
|
|
|
|
version = "$mod_version"
|
|
group = "de.ellpeck.actuallyadditions"
|
|
base {
|
|
archivesName = "ActuallyAdditions-$game_version"
|
|
}
|
|
|
|
if (System.getenv('BUILD_NUMBER') != null) {
|
|
version += "." + System.getenv('BUILD_NUMBER')
|
|
}
|
|
|
|
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
|
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')
|
|
}
|
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
|
|
|
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'
|
|
|
|
// Recommended logging level for the console
|
|
systemProperty 'forge.logging.console.level', 'debug'
|
|
|
|
//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"
|
|
}
|
|
|
|
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}"
|
|
|
|
runtimeOnly "curse.maven:the-one-probe-245211:5084077"
|
|
runtimeOnly "curse.maven:mekanism-268560:5155329"
|
|
}
|
|
|
|
// not sure if this is still needed
|
|
//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'
|
|
// }
|
|
//}
|
|
|
|
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")],)
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
|
}
|