From 04608157204485f98b1e20b928799e7bc395b9df Mon Sep 17 00:00:00 2001 From: Chicken-Bomes Date: Tue, 29 Apr 2014 10:53:49 +1000 Subject: [PATCH] Build script cleanup --- build/build.gradle | 109 ++++++++++----------------------------------- 1 file changed, 24 insertions(+), 85 deletions(-) diff --git a/build/build.gradle b/build/build.gradle index 3f0b8cc..e3acf7b 100644 --- a/build/build.gradle +++ b/build/build.gradle @@ -1,4 +1,3 @@ -// This sets us up for building a forge project - you need all of these buildscript { repositories { mavenCentral() @@ -16,12 +15,9 @@ buildscript { } } -// Apply the forge plugin - this adds all the magic for automatically obfuscating, deobfuscating etc apply plugin: 'forge' -// This is our group group = "codechicken" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -// This is our actual project within the group. archivesBaseName = "CodeChickenCore" // Define properties file @@ -45,17 +41,6 @@ minecraft { version = config.mc_version + "-" + config.forge_version } -// this sets our output jar to have a 'tag' of 'universal' on it -// It also adds the minecraft version in a custom version name -// The result is files named ---universal.jar -jar { - classifier = 'universal' - version = "${project.minecraft.version}-${project.version}" - manifest { - attributes 'FMLCorePlugin': 'codechicken.core.launch.CodeChickenCorePlugin' - } - -} sourceSets { main { def root = project.projectDir.parentFile @@ -67,16 +52,16 @@ sourceSets { } } } + processResources { //redo task if any of these properties change inputs.property "version", project.version inputs.property "mc_version", config.mc_version - inputs.property "ccl_version", config.ccl_version // Replace properties in info files from(sourceSets.main.resources.srcDirs) { include '*.info' - expand 'version':project.version,'mc_version':config.mc_version,'ccl_version':config.ccl_version + expand 'version':project.version,'mc_version':config.mc_version } // Copy everything else from(sourceSets.main.resources.srcDirs) { @@ -84,90 +69,44 @@ processResources { } } -// Add in a source jar for people, should they desire to download such a thing task sourceJar(type: Jar) { from sourceSets.main.allSource classifier = 'src' version = "${project.minecraft.version}-${project.version}" } -// Add in an mcp named jar, for those who wish to run in a development environment (assuming mcp naming matches) -task deobfJar(type: Jar) { +def commonManifest = { + attributes 'FMLCorePlugin': 'codechicken.core.launch.CodeChickenCorePlugin' +} + +jar { + classifier = 'universal' + version = "${project.minecraft.version}-${project.version}" + manifest commonManifest +} + +task devJar(type: Jar) { from sourceSets.main.output classifier = 'dev' version = "${project.minecraft.version}-${project.version}" - manifest { - attributes 'FMLCorePlugin': 'codechicken.core.launch.CodeChickenCorePlugin' - } + manifest commonManifest } // Tell the artifact system about our extra jars artifacts { - archives sourceJar, deobfJar + archives sourceJar, devJar } -// Configure an upload task. this is setup for uploading to files.minecraftforge.net. There are other examples around +// Configure an upload task. uploadArchives { dependsOn 'reobf' - repositories { - if (project.hasProperty("filesmaven")) { - logger.info('Publishing to files server') + if (project.hasProperty("local_maven")) { + repositories { + logger.info('Publishing to local maven repo') - mavenDeployer { - configuration = configurations.deployJars - - repository(url: project.filesmaven.url) { - authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key) - } - - // This is just the pom data for the maven repo - pom { - groupId = project.group - // Force the maven upload to use the - syntax preferred at files - version = "${project.minecraft.version}-${project.version}" - artifactId = project.archivesBaseName - project { - name project.archivesBaseName - packaging 'jar' - description 'CodeChickenCore' - url 'https://github.com/Chicken-Bones/CodeChickenCore' - - scm { - url 'https://github.com/Chicken-Bones/CodeChickenCore' - connection 'scm:git:git://github.com/Chicken-Bones/CodeChickenCore.git' - developerConnection 'scm:git:git@github.com:Chicken-Bones/CodeChickenCore.git' - } - - issueManagement { - system 'github' - url 'https://github.com/Chicken-Bones/CodeChickenCore/issues' - } - - licenses { - license { - name 'GNU Lesser Public License (GPL), Version 2.1' - url 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt' - distribution 'repo' - } - } - - developers { - developer { - id 'chicken-bones' - name 'chicken-bones' - roles { role 'developer' } - } - } - } - } - } - } else { - logger.info('Publishing to repo folder') - - mavenDeployer { - pom.version = "${project.minecraft.version}-${project.version}" - repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath()) - } - } - } + mavenDeployer { + repository(url: "file://${local_maven}") + } + } + } } \ No newline at end of file