Lazily configure MDK tasks, improve IDE support (#9592)
This commit is contained in:
parent
773c579dab
commit
9b6e4991b6
1 changed files with 27 additions and 26 deletions
43
build.gradle
43
build.gradle
|
@ -182,47 +182,48 @@ dependencies {
|
||||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
|
tasks.named('processResources', ProcessResources).configure {
|
||||||
def replaceProperties = [
|
var replaceProperties = [
|
||||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||||
loader_version_range: loader_version_range,
|
loader_version_range: loader_version_range,
|
||||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||||
mod_authors: mod_authors, mod_description: mod_description
|
mod_authors: mod_authors, mod_description: mod_description,
|
||||||
]
|
]
|
||||||
processResources {
|
|
||||||
inputs.properties replaceProperties
|
inputs.properties replaceProperties
|
||||||
replaceProperties.put 'project', project
|
|
||||||
|
|
||||||
filesMatching(resourceTargets) {
|
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||||
expand replaceProperties
|
expand replaceProperties + [project: project]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example for how to get properties into the manifest for reading at runtime.
|
// Example for how to get properties into the manifest for reading at runtime.
|
||||||
jar {
|
tasks.named('jar', Jar).configure {
|
||||||
manifest {
|
manifest {
|
||||||
attributes([
|
attributes([
|
||||||
"Specification-Title" : mod_id,
|
'Specification-Title' : mod_id,
|
||||||
"Specification-Vendor" : mod_authors,
|
'Specification-Vendor' : mod_authors,
|
||||||
"Specification-Version" : "1", // We are version 1 of ourselves
|
'Specification-Version' : '1', // We are version 1 of ourselves
|
||||||
"Implementation-Title" : project.name,
|
'Implementation-Title' : project.name,
|
||||||
"Implementation-Version" : project.jar.archiveVersion,
|
'Implementation-Version' : project.jar.archiveVersion,
|
||||||
"Implementation-Vendor" : mod_authors,
|
'Implementation-Vendor' : mod_authors,
|
||||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is the preferred method to reobfuscate your jar file
|
||||||
|
finalizedBy 'reobfJar'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example configuration to allow publishing using the maven-publish plugin
|
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
|
||||||
// This is the preferred method to reobfuscate your jar file
|
// tasks.named('publish').configure {
|
||||||
jar.finalizedBy('reobfJar')
|
// dependsOn 'reobfJar'
|
||||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
|
// }
|
||||||
// publish.dependsOn('reobfJar')
|
|
||||||
|
|
||||||
|
// Example configuration to allow publishing using the maven-publish plugin
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
register('mavenJava', MavenPublication) {
|
||||||
artifact jar
|
artifact jar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue