mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 20:45:59 +01:00
ec685ebdc0
- Move loom.runs into subprojects closure - Move common code sharing into subprojects closure - Apply java plugin - Fix runs not being generated by moving generatePackageInfos to the bottom
179 lines
5.2 KiB
Groovy
179 lines
5.2 KiB
Groovy
plugins {
|
|
id 'eclipse'
|
|
id 'idea'
|
|
// make sure gradle loads the same arch plugin across all subprojects
|
|
id 'dev.architectury.loom' apply false
|
|
}
|
|
|
|
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
|
|
|
subprojects {
|
|
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false');
|
|
|
|
ext.buildNumber = System.getenv('BUILD_NUMBER')
|
|
|
|
group = 'com.jozufozu.flywheel'
|
|
version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
|
|
|
|
apply plugin: "java"
|
|
apply plugin: "maven-publish"
|
|
apply plugin: "dev.architectury.loom"
|
|
|
|
loom {
|
|
silentMojangMappingsLicense()
|
|
}
|
|
|
|
if (it != project(':common')) {
|
|
loom {
|
|
runs {
|
|
client {
|
|
ideConfigGenerated true
|
|
property 'flw.dumpShaderSource', 'true'
|
|
property 'flw.debugMemorySafety', 'true'
|
|
programArgs '--width', '1280', '--height', '720'
|
|
}
|
|
|
|
server {
|
|
ideConfigGenerated true
|
|
programArgs '--nogui'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks {
|
|
// make builds reproducible
|
|
withType(AbstractArchiveTask).configureEach {
|
|
preserveFileTimestamps = false
|
|
reproducibleFileOrder = true
|
|
}
|
|
|
|
// module metadata is often broken on multi-platform projects
|
|
withType(GenerateModuleMetadata).configureEach {
|
|
enabled = false
|
|
}
|
|
}
|
|
|
|
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]
|
|
}
|
|
}
|
|
|
|
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")
|
|
})
|
|
}
|
|
|
|
java {
|
|
JavaVersion javaVersion = JavaVersion.toVersion(java_version)
|
|
sourceCompatibility = javaVersion
|
|
targetCompatibility = javaVersion
|
|
|
|
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
|
|
|
|
withSourcesJar()
|
|
withJavadocJar()
|
|
}
|
|
|
|
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')
|
|
}
|
|
|
|
apply from: rootProject.file('gradle/package-infos.gradle')
|
|
|
|
ideaSyncTask.finalizedBy(generatePackageInfos)
|
|
}
|
|
|
|
void addLicense(jarTask) {
|
|
jarTask.from('LICENSE.md') {
|
|
rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$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' : jarTask.archiveBaseName,
|
|
'Implementation-Version' : jarTask.archiveVersion,
|
|
// 'Implementation-Vendor': 'flywheel authors',
|
|
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
])
|
|
}
|
|
}
|
|
|
|
idea {
|
|
// Tell IDEA to always download sources/javadoc artifacts from maven.
|
|
module {
|
|
downloadJavadoc = true
|
|
downloadSources = true
|
|
}
|
|
}
|