mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 12:34:11 +01:00
60 lines
1.7 KiB
Groovy
60 lines
1.7 KiB
Groovy
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false')
|
|
String buildNumber = System.getenv('BUILD_NUMBER')
|
|
|
|
group = 'com.jozufozu.flywheel'
|
|
version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
|
|
|
|
base {
|
|
archivesName = "flywheel-${name}-${artifact_minecraft_version}"
|
|
}
|
|
|
|
java {
|
|
JavaVersion javaVersion = JavaVersion.toVersion(java_version)
|
|
sourceCompatibility = javaVersion
|
|
targetCompatibility = javaVersion
|
|
|
|
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
|
|
|
|
withSourcesJar()
|
|
withJavadocJar()
|
|
}
|
|
|
|
// make builds reproducible
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
|
preserveFileTimestamps = false
|
|
reproducibleFileOrder = true
|
|
}
|
|
|
|
// module metadata is often broken on multi-platform projects
|
|
tasks.withType(GenerateModuleMetadata).configureEach {
|
|
enabled = false
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile ->
|
|
javaCompile.options.encoding = 'UTF-8'
|
|
javaCompile.options.release = Integer.parseInt(java_version)
|
|
javaCompile.options.compilerArgs = ['-Xdiags:verbose']
|
|
}
|
|
|
|
tasks.named('jar', Jar).configure { Jar jar ->
|
|
archiveClassifier = ''
|
|
addLicense(jar)
|
|
}
|
|
|
|
tasks.named('sourcesJar', Jar).configure { Jar jar ->
|
|
addLicense(jar)
|
|
}
|
|
|
|
tasks.named('javadoc', Javadoc).configure { Javadoc javadoc ->
|
|
javadoc.source sourceSets.main.allJava
|
|
// prevent java 8's strict doclint for javadocs from failing builds
|
|
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
|
javadoc.options.encoding = 'UTF-8'
|
|
}
|
|
|
|
static void addLicense(Jar jarTask) {
|
|
jarTask.from('LICENSE.md') {
|
|
rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$2'
|
|
}
|
|
}
|