ActuallyAdditions/build.gradle
2024-03-03 01:20:53 +01:00

175 lines
4.6 KiB
Groovy

plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}
version = "$mod_version"
group = "de.ellpeck.actuallyadditions"
base {
archivesName = "ActuallyAdditions-$game_version"
}
if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'parchment', version: "${parchment_version}-${game_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property("minecraft.api.auth.host", "https://0.0.0.0")
property("minecraft.api.account.host", "https://0.0.0.0")
property("minecraft.api.session.host", "https://0.0.0.0")
property("minecraft.api.services.host", "https://0.0.0.0")
mods {
actuallyadditions {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
mods {
actuallyadditions {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
actuallyadditions {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven {
url = "https://maven.blamejared.com"
}
maven {
url = "https://www.cursemaven.com"
}
}
dependencies {
minecraft "net.minecraftforge:forge:${game_version}-${forge_version}"
compileOnly fg.deobf("mezz.jei:jei-${game_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${game_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${game_version}-forge:${jei_version}")
runtimeOnly fg.deobf("curse.maven:the-one-probe-245211:4629624")
runtimeOnly fg.deobf("curse.maven:mekanism-268560:5125665")
}
// 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 deobfJar(type: Jar) {
from sourceSets.main.output
from sourceSets.main.java
archiveClassifier.set('dev')
}
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 deobfJar, sourcesJar, apiJar, javadocJar
}
publishing {
tasks.publish.dependsOn build
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = base.archivesName.get()
version = version
from components.java
artifact deobfJar
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
}