Flywheel/forge/build.gradle

150 lines
4.0 KiB
Groovy
Raw Normal View History

2024-04-17 21:05:04 +02:00
plugins {
id 'maven-publish'
id 'dev.architectury.loom'
}
evaluationDependsOn(':common')
base {
archivesName = "flywheel-${project.name}-${artifact_minecraft_version}"
}
loom {
runs {
configureEach {
property 'forge.logging.markers', ''
property 'forge.logging.console.level', 'debug'
}
client {
ideConfigGenerated true
property 'flw.dumpShaderSource', 'true'
property 'flw.debugMemorySafety', 'true'
programArgs '--width', '1280', '--height', '720'
}
server {
ideConfigGenerated true
programArgs '--nogui'
}
}
}
repositories {
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org'
}
mavenCentral()
}
dependencies {
minecraft "com.mojang:minecraft:$minecraft_version"
mappings(loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip")
})
forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly project(path: ':common', configuration: 'namedElements')
}
java {
JavaVersion javaVersion = JavaVersion.toVersion(java_version)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
withSourcesJar()
withJavadocJar()
}
processResources.configure {
from(project(':common').sourceSets.main.resources)
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
forge_version : forge_version,
forge_version_range : forge_version_range,
loader_version_range : loader_version_range,
mod_version : mod_version
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) {
expand replaceProperties + [project: project]
}
}
tasks.withType(JavaCompile).configureEach {
source(project(':common').sourceSets.main.allSource)
options.encoding = 'UTF-8'
options.release = Integer.parseInt(java_version)
options.compilerArgs = ['-Xdiags:verbose']
}
jar.configure {
archiveClassifier = ''
addManifest(it)
addLicense(it)
}
sourcesJar.configure {
from(project(':common').sourceSets.main.allSource)
addManifest(it)
addLicense(it)
}
javadoc.configure {
source(project(':common').sourceSets.main.allJava)
// prevent java 8's strict doclint for javadocs from failing builds
options.addStringOption('Xdoclint:none', '-quiet')
}
test.configure {
useJUnitPlatform()
}
void addLicense(jarTask) {
jarTask.from('LICENSE.md') {
rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2'
}
}
void addManifest(jarTask) {
jarTask.manifest {
attributes([
'Specification-Title' : 'flywheel',
// 'Specification-Vendor': 'flywheel authors',
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.jar.archiveBaseName,
'Implementation-Version' : project.jar.archiveVersion,
// 'Implementation-Vendor': 'flywheel authors',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}
}
2024-04-17 21:21:28 +02:00
apply from: rootProject.file('gradle/package-infos.gradle')
2024-04-17 21:05:04 +02:00
publishing {
publications {
register('mavenJava', MavenPublication) {
from(components["java"])
artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}"
}
}
repositories {
maven {
2024-04-17 21:21:28 +02:00
url "file://${rootProject.projectDir}/mcmodsrepo"
2024-04-17 21:05:04 +02:00
}
if (project.hasProperty('mavendir')) {
maven { url rootProject.file(property('mavendir')) }
}
}
}