240 lines
6.5 KiB
Groovy
240 lines
6.5 KiB
Groovy
buildscript {
|
|
repositories {
|
|
maven { url = 'https://maven.minecraftforge.net' }
|
|
maven { url = 'https://maven.parchmentmc.org' }
|
|
jcenter()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
|
classpath 'org.parchmentmc:librarian:1.+'
|
|
}
|
|
}
|
|
apply plugin: 'net.minecraftforge.gradle'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'org.parchmentmc.librarian.forgegradle'
|
|
|
|
|
|
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle'
|
|
apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle'
|
|
|
|
//import net.minecraftforge.gradle.common.task.SignJar
|
|
|
|
if (project.hasProperty('secretFile')) {
|
|
loadSecrets(new File((String) findProperty('secretFile')))
|
|
}
|
|
|
|
version = "${version}"
|
|
group = "tschipp.carryon"
|
|
archivesBaseName = "carryon-${minecraft_version}"
|
|
|
|
|
|
if (System.getenv('BUILD_NUMBER') != null) {
|
|
version += "." + System.getenv('BUILD_NUMBER')
|
|
}
|
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
|
|
|
minecraft {
|
|
mappings channel: 'parchment', version: "${mappings_version}"
|
|
|
|
runs {
|
|
client {
|
|
workingDirectory project.file('run')
|
|
|
|
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
|
|
|
|
mods {
|
|
carryon {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
server {
|
|
workingDirectory project.file('run')
|
|
|
|
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
|
|
|
|
mods {
|
|
carryon {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
data {
|
|
workingDirectory project.file('run')
|
|
|
|
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
args '--mod', 'carryon', '--all', '--output', file('src/generated/resources/')
|
|
|
|
mods {
|
|
carryon {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
url "https://maven.blamejared.com/"
|
|
}
|
|
|
|
maven {
|
|
url "https://maven.mcmoddev.com/"
|
|
}
|
|
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
|
|
maven {
|
|
url "https://www.cursemaven.com"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
|
|
|
implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.18.2:8.1.3")
|
|
implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.18.2:13.2.53")
|
|
//implementation fg.deobf("curse.maven:obfuscate-289380:3169370")
|
|
|
|
fileTree("libs").matching {
|
|
include "*.jar"
|
|
}.each {
|
|
String filename = it.getName();
|
|
filename = filename.substring(0, filename.length() - 4);
|
|
int lastDash = filename.lastIndexOf("-");
|
|
filename = filename.substring(0, lastDash) + ":" + filename.substring(lastDash+1, filename.length());
|
|
implementation fg.deobf("blank:${filename}")
|
|
}
|
|
|
|
}
|
|
|
|
// Example for how to get properties into the manifest for reading by the runtime..
|
|
jar {
|
|
manifest {
|
|
attributes([
|
|
"Specification-Title": "carryon",
|
|
"Specification-Vendor": "Carry On",
|
|
"Specification-Version": "1", // We are version 1 of ourselves
|
|
"Implementation-Title": project.name,
|
|
"Implementation-Version": "${version}",
|
|
"Implementation-Vendor" :"Carry On",
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
|
])
|
|
}
|
|
}
|
|
|
|
jar.finalizedBy('reobfJar')
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
description = 'Creates a JAR containing the source code.'
|
|
from sourceSets.main.allSource
|
|
classifier = 'sources'
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
description = 'Creates a JAR containing the JavaDocs.'
|
|
from javadoc.destinationDir
|
|
classifier = 'javadoc'
|
|
}
|
|
|
|
task deobfJar(type: Jar) {
|
|
description = 'Creates a JAR containing the non-obfuscated compiled code.'
|
|
from sourceSets.main.output
|
|
classifier = "deobf"
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
archives deobfJar
|
|
}
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
groupId project.group
|
|
artifactId project.archivesBaseName
|
|
version project.version
|
|
from components.java
|
|
|
|
// Allows the maven pom file to be modified.
|
|
pom.withXml {
|
|
|
|
// Go through all the dependencies.
|
|
asNode().dependencies.dependency.each { dep ->
|
|
|
|
println 'Surpressing artifact ' + dep.artifactId.last().value().last() + ' from maven dependencies.'
|
|
assert dep.parent().remove(dep)
|
|
}
|
|
}
|
|
|
|
artifact sourcesJar {
|
|
|
|
classifier 'sources'
|
|
}
|
|
artifact javadocJar {
|
|
|
|
classifier 'javadoc'
|
|
}
|
|
artifact deobfJar {
|
|
|
|
classifier 'deobf'
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url "file://" + System.getenv("local_maven")
|
|
}
|
|
}
|
|
}
|
|
|
|
//task signJar(type: SignJar, dependsOn: jar) {
|
|
// Skips if the keyStore property is missing.
|
|
// onlyIf {
|
|
// project.hasProperty('modkeyStore')
|
|
// }
|
|
|
|
// findProperty allows us to reference the property without it existing.
|
|
// Using project.propName would cause the script to fail validation if
|
|
// the property did not exist.
|
|
// keyStore = project.findProperty('modkeyStore')
|
|
// alias = project.findProperty('modkeyStoreAlias')
|
|
// storePass = project.findProperty('modkeyStorePass')
|
|
// keyPass = project.findProperty('modkeyStoreKeyPass')
|
|
// inputFile = jar.archivePath
|
|
// outputFile = jar.archivePath
|
|
//}
|
|
|
|
// Runs this task automatically when build is ran.
|
|
//build.dependsOn signJar |