Flywheel/forge/build.gradle
2024-05-17 08:43:56 -07:00

172 lines
4.5 KiB
Groovy

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'
}
maven {
url 'https://www.cursemaven.com'
content {
includeGroup "curse.maven"
}
}
maven {
name 'tterrag maven'
url 'https://maven.tterrag.com/'
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
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')
modCompileOnly "maven.modrinth:embeddium:$embeddium_version"
modCompileOnly "maven.modrinth:oculus:$oculus_version"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
}
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"),
])
}
}
apply from: rootProject.file('gradle/package-infos.gradle')
publishing {
publications {
register('mavenJava', MavenPublication) {
from(components["java"])
artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}"
}
}
repositories {
maven {
url "file://${rootProject.projectDir}/mcmodsrepo"
}
if (project.hasProperty('mavendir')) {
maven { url rootProject.file(property('mavendir')) }
}
}
}