buildscript { repositories { jcenter() maven { url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'maven-publish' apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle' import groovy.json.JsonOutput if (project.hasProperty('secretFile')) { loadSecrets(new File((String) findProperty('secretFile'))) } version = "${version}" group = "tschipp.carryon" archivesBaseName = "carryon-${minecraft_version}" sourceCompatibility = targetCompatibility = '1.8' compileJava { sourceCompatibility = targetCompatibility = '1.8' } if (System.getenv('BUILD_NUMBER') != null) { version += "." + System.getenv('BUILD_NUMBER') } minecraft { version = "1.12.2-14.23.5.2847" runDir = "run" mappings = "snapshot_20171003" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } repositories { maven { url 'http://maven.epoxide.org' } maven { url = "https://mrcrayfish.com/maven" } maven { url "https://maven.mcmoddev.com/" } } dependencies { // deobfCompile "net.darkhax.gamestages:GameStages-1.12.2:2.0.91" compile "com.mrcrayfish:obfuscate:0.2.6-1.12.2" compile "net.ilexiconn:llibrary:1.7.9-1.12.2:dev" } 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