CarryOn/build.gradle
2023-04-25 22:25:40 +02:00

209 lines
5.9 KiB
Groovy

buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'maven-publish'
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle'
if (project.hasProperty('secretFile')) {
loadSecrets(new File((String) findProperty('secretFile')))
}
version = "${project.version}"
group = "tschipp.carryon"
archivesBaseName = "carryon-${minecraft_version}"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
//mappings channel: 'snapshot', version: '20171003-1.12'
mappings channel: 'snapshot', version: '20171003-1.12'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
}
server {
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
}
}
}
repositories {
maven { url 'http://maven.epoxide.org' }
maven { url = "https://mrcrayfish.com/maven" }
maven {
url "https://maven.mcmoddev.com/"
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
compile "com.mrcrayfish:obfuscate:0.2.6-1.12.2"
compile "net.ilexiconn:llibrary:1.7.9-1.12.2:dev"
}
jar {
manifest {
attributes([
"Specification-Title": "examplemod",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
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")
}
}
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft_version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft_version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
//task signJar(type: SignJar, dependsOn: reobfJar) {
//
// // 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