mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-26 15:06:42 +01:00
JarJar Artifact Jar
- Use JarJar - Include Flywheel automatically - Include Registrate instead of shading it - Refactor Maven coordinate scheme - Artifact ID: "Create" -> "create-{minecraft_version}" - Artifact Version: "{mod_version}.{patch}-{build_number}" - Exclude datagen cache from built jars - Include LICENSE file in build jars - Sync mods.toml version with gradle.properties version - Use more modern publication code - Update Gradle: 7.4.1 -> 7.4.2
This commit is contained in:
parent
0161b876fa
commit
4c45333687
4 changed files with 59 additions and 53 deletions
103
build.gradle
103
build.gradle
|
@ -12,8 +12,8 @@ buildscript {
|
||||||
classpath "org.parchmentmc:librarian:${librarian_version}"
|
classpath "org.parchmentmc:librarian:${librarian_version}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.github.johnrengelman.shadow' version "${shadow_version}"
|
|
||||||
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
|
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
|
||||||
}
|
}
|
||||||
apply plugin: 'net.minecraftforge.gradle'
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
|
@ -22,17 +22,18 @@ apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'org.spongepowered.mixin'
|
apply plugin: 'org.spongepowered.mixin'
|
||||||
|
|
||||||
|
jarJar.enable()
|
||||||
|
|
||||||
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false');
|
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false');
|
||||||
// jozu: I use a gradle workspace with both projects.
|
// jozu: I use a gradle workspace with both projects.
|
||||||
// The project is named Flywheel-Forge, but sub-projects are named by folder.
|
// The project is named Flywheel-Forge, but sub-projects are named by folder.
|
||||||
boolean inWorkspace = findProject(':Flywheel') != null
|
boolean inWorkspace = findProject(':Flywheel') != null
|
||||||
|
|
||||||
ext.buildNumber = System.getenv('BUILD_NUMBER')
|
ext.buildNumber = System.getenv('BUILD_NUMBER')
|
||||||
if (buildNumber == null) buildNumber = 'custom'
|
|
||||||
|
|
||||||
version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildNumber.equals('custom') ? "+${buildNumber}" : '')
|
|
||||||
group = 'com.simibubi.create'
|
group = 'com.simibubi.create'
|
||||||
archivesBaseName = 'create'
|
archivesBaseName = "create-${artifact_minecraft_version}"
|
||||||
|
version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
|
||||||
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
|
@ -92,18 +93,6 @@ minecraft {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
|
||||||
options.compilerArgs = ['-Xdiags:verbose']
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.main.resources {
|
|
||||||
srcDir 'src/generated/resources'
|
|
||||||
}
|
|
||||||
|
|
||||||
mixin {
|
|
||||||
add sourceSets.main, 'create.refmap.json'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
// Location of the maven that hosts JEI files (and TiC)
|
// Location of the maven that hosts JEI files (and TiC)
|
||||||
|
@ -141,16 +130,17 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
|
||||||
shade
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||||
|
|
||||||
def registrate = "com.tterrag.registrate:Registrate:${registrate_version}"
|
jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: '[MC1.18.2-1.1.3]') {
|
||||||
implementation fg.deobf(registrate)
|
jarJar.pin(it, project.registrate_version)
|
||||||
shade registrate
|
}
|
||||||
|
jarJar(group: 'com.jozufozu.flywheel', name: 'Flywheel-Forge', version: '[1.18-0.6.4,1.18-0.6.5)') {
|
||||||
|
jarJar.pin(it, project.flywheel_version)
|
||||||
|
}
|
||||||
|
|
||||||
|
implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
|
||||||
|
|
||||||
if (inWorkspace) {
|
if (inWorkspace) {
|
||||||
implementation project(':Flywheel')
|
implementation project(':Flywheel')
|
||||||
|
@ -179,6 +169,31 @@ dependencies {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property 'version', mod_version
|
||||||
|
|
||||||
|
filesMatching('META-INF/mods.toml') {
|
||||||
|
expand 'version': mod_version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.main.resources {
|
||||||
|
srcDir 'src/generated/resources'
|
||||||
|
exclude '.cache/'
|
||||||
|
}
|
||||||
|
|
||||||
|
mixin {
|
||||||
|
add sourceSets.main, 'create.refmap.json'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.compilerArgs = ['-Xdiags:verbose']
|
||||||
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
classifier = 'slim'
|
classifier = 'slim'
|
||||||
manifest {
|
manifest {
|
||||||
|
@ -187,7 +202,7 @@ jar {
|
||||||
'Specification-Vendor': 'simibubi',
|
'Specification-Vendor': 'simibubi',
|
||||||
'Specification-Version': '1',
|
'Specification-Version': '1',
|
||||||
'Implementation-Title': project.name,
|
'Implementation-Title': project.name,
|
||||||
'Implementation-Version': "${version}",
|
'Implementation-Version': project.jar.archiveVersion,
|
||||||
'Implementation-Vendor': 'simibubi',
|
'Implementation-Vendor': 'simibubi',
|
||||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||||
'MixinConfigs': 'create.mixins.json'
|
'MixinConfigs': 'create.mixins.json'
|
||||||
|
@ -195,40 +210,30 @@ jar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
java {
|
||||||
classifier = ''
|
withSourcesJar()
|
||||||
configurations = [project.configurations.shade]
|
withJavadocJar()
|
||||||
relocate 'com.tterrag.registrate', 'com.simibubi.create.repack.registrate'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reobf {
|
void addLicense(jarTask) {
|
||||||
shadowJar {}
|
jarTask.from('LICENSE') {
|
||||||
|
rename { "${it}_${project.archivesBaseName}" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jar.finalizedBy('reobfJar')
|
||||||
|
tasks.jarJar.finalizedBy('reobfJarJar')
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
addLicense(jar)
|
||||||
from sourceSets.main.allSource
|
addLicense(tasks.jarJar)
|
||||||
archiveBaseName.set(project.archivesBaseName)
|
|
||||||
archiveVersion.set("${project.version}")
|
|
||||||
archiveClassifier.set('sources')
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
from javadoc.destinationDir
|
|
||||||
archiveClassifier.set('javadoc')
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives jar, shadowJar, sourcesJar, javadocJar
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
tasks.publish.dependsOn 'build'
|
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
artifact shadowJar
|
artifactId = archivesBaseName
|
||||||
artifact sourcesJar
|
|
||||||
artifact javadocJar
|
from components.java
|
||||||
|
jarJar.component(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@ org.gradle.jvmargs = -Xmx3G
|
||||||
org.gradle.daemon = false
|
org.gradle.daemon = false
|
||||||
|
|
||||||
# mod version info
|
# mod version info
|
||||||
mod_version = 0.5.0c
|
mod_version = 0.5.0.c
|
||||||
|
artifact_minecraft_version = 1.18.2
|
||||||
|
|
||||||
minecraft_version = 1.18.2
|
minecraft_version = 1.18.2
|
||||||
forge_version = 40.1.60
|
forge_version = 40.1.60
|
||||||
|
|
||||||
|
@ -13,7 +15,6 @@ forgegradle_version = 5.1.+
|
||||||
mixingradle_version = 0.7-SNAPSHOT
|
mixingradle_version = 0.7-SNAPSHOT
|
||||||
mixin_version = 0.8.5
|
mixin_version = 0.8.5
|
||||||
librarian_version = 1.+
|
librarian_version = 1.+
|
||||||
shadow_version = 7.1.0
|
|
||||||
cursegradle_version = 1.4.0
|
cursegradle_version = 1.4.0
|
||||||
parchment_version = 2022.07.10
|
parchment_version = 2022.07.10
|
||||||
|
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -5,7 +5,7 @@ license="MIT"
|
||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId="create"
|
modId="create"
|
||||||
version="0.5.0c"
|
version="${version}"
|
||||||
displayName="Create"
|
displayName="Create"
|
||||||
#updateJSONURL=""
|
#updateJSONURL=""
|
||||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
|
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
|
||||||
|
|
Loading…
Reference in a new issue