Skip to content

Instantly share code, notes, and snippets.

@marchermans
Last active October 25, 2015 16:16
Show Gist options
  • Save marchermans/ff7d3906ab94a1f017bd to your computer and use it in GitHub Desktop.
Save marchermans/ff7d3906ab94a1f017bd to your computer and use it in GitHub Desktop.
Build error
//Buildscript: Armory
// Load the properties of this project.
ext.configFile = file "build.properties"
//Reference the properties inside the project:
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
//Date formatting helper function
def getDate() {
def date = new Date()
def formattedDate = date.format('dd-MM-yyyy : hh:mm:ss')
return formattedDate
}
def build_mode = config.build_mode
//ForgeGradle BuildScript.
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
//The repositories in which the dependencies are stored:
repositories {
mavenCentral()
maven { // The repo from which to get waila
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
maven { //The repo to get NEI etc
name 'CB FS'
url 'http://chickenbones.net/maven'
}
maven { //The repo to get TiC
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven { //Forges own repo
name 'ForgeFS'
url 'http://files.minecraftforge.net/maven'
}
maven { //My own repo (used for uploading and dependency)
name 'OrionMavenRepo'
url 'http://mavenrepo.orionminecraft.com/'
}
}
//Apply the gradle plugins.
apply plugin: 'java'
apply plugin: 'forge'
apply plugin: 'maven'
apply plugin: 'curseforge'
//These configurations are needed for uploading to a MavenRepo:
configurations {
deployerJars
}
//Initializing the mod environment
version = config.mod_version.toString() + "-" + System.getenv().TRAVIS_BUILD_NUMBER.toString()
def apiversion = config.api_version.toString()() + "-" + System.getenv().TRAVIS_BUILD_NUMBER.toString()
if(System.getenv().TRAVIS_BRANCH.toString().contains("Development"))
{
version = version + "-SNAPSHOT"
api_version = apiversion + "-SNAPSHOT"
}
group = "com.SmithsModding.Armory"
archivesBaseName = "Armory"
//Idea fix
idea {
module {
inheritOutputDirs = true
}
}
//Sets up the currect versions for minecraft and Forge
minecraft {
version = config.forge_version.toString() + "-" + config.minecraft_version
runDir = "run/assets"
//Replacing stuff inside the code:
replace "@VERSION@", project.version
replace "@MCVERSION@", config.minecraft_version
replace "@APIVERSION@", apiversion
}
//Tells gradle which dependencies are needed for gradle and project
dependencies {
//Mod dependencies
compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.CCLIB_version}:dev"
compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.ccc_version}:dev"
compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev"
//Maven uploader
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.2'
}
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'resources'
}
}
}
//This will process all the resources used during build, and needed for running the project
processResources
{
//This will ensure that this task is redone when the versions change.
inputs.property "@VERSION@", project.version
inputs.property "@MCVERSION@", config.minecraft_version
//Replaces stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand '@VERSION@': project.version, '@MCVERSIONä': config.minecraft_version
}
//Copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
exclude '**/Thumbs.db'
}
jar {
manifest {
attributes 'FMLAT': 'Armory_at.cfg'
}
}
task devJar(type: Jar, dependsOn: 'classes') {
from "build/source/main"
extension = 'jar'
classifier "dev"
}
task apiJar(type: Jar, dependsOn: 'jar') {
from "build/source/main"
include "com/SmithsModding/Armory/API/**"
extension = 'jar'
classifier = 'dev'
}
task sourceJar(type: Jar, dependsOn: 'sourceMainJava') {
from "build/sources/java"
from "build/resources/main/"
extension = 'jar'
classifier "sources"
}
artifacts {
archives devJar
archives apiJar
archives sourceJar
}
//The following function comes with thanks to AbrarSyed:
//Copying the coremod dependencies from the classpath to the mods directory so the system can load them in a Dev Env.
//This is not executed during build!
task copyChicken(type: Copy){
from configurations.compile
include "**/*Chicken*.jar", "**/*NotEnoughItems*.jar"
exclude "**/CodeChickenLib*" // because CCC downloads it anyways.. -_-
into file(minecraft.runDir + "/mods") // parallel to the assets dir
}
curse {
dependsOn 'reobf'
if (System.getenv().CURSEAPIKEY != null)
{
if (!build_mode.toString().trim().equals("SYNC"))
{
if ((build_mode.toString().trim().equals("DEBUG") && System.getenv().TRAVIS_BRANCH.toString().contains("Development")) || ((build_mode.toString().trim().equals("RELEASE") && !System.getenv().TRAVIS_BRANCH.toString().contains("Development"))))
{
projectId = System.getenv().CURSEPROJECTID
apiKey = System.getenv().CURSEAPIKEY
changelog = "Check out: " + "https://github.com/" + System.getenv().TRAVIS_REPO_SLUG.toString() + "/commits/" + System.getenv().TRAVIS_BRANCH.toString() + " for all Changes."
if (System.getenv().TRAVIS_BRANCH.toString().contains("Development"))
{
releaseType = "Alpha"
}
else
{
releaseType = "Beta"
}
additionalArtifact devJar
}
else
{
logger.lifecycle("Cannor run the CurseUpload sequence. Curse upload is only done on the Development-Branch when in Debug mode, or on any other branch in Release mode. Current Branch: " + System.getenv().TRAVIS_BRANCH.toString() + " - Current build mode: " + build_mode.toString())
}
}
else
{
logger.lifecycle("Cannot run CurseUpload sequence. We are currently synchronising to Computers.")
}
}
else
{
logger.lifecycle("Cannot run the CurseUpload sequence. No API-Key was available.")
}
}
//Function to upload completed project to the maven repo.
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
if(System.getenv().TRAVIS_BRANCH.toString().contains("Development"))
{
snapshotRepository(url: "ftp://mavenrepo.armory.orionminecraft.com") {
authentication(userName: "mavenrepo.armory.orionminecraft.com|" + System.getenv().FTPUserName.toString(), password: System.getenv().FTPPassword.toString())
}
}
else {
repository(url: "ftp://mavenrepo.armory.orionminecraft.com") {
authentication(userName: "mavenrepo.armory.orionminecraft.com|" + System.getenv().FTPUserName.toString(), password: System.getenv().FTPPassword.toString())
}
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
}
pom.project {
name project.archivesBaseName
packaging 'jar'
description 'Armory'
url 'https://github.com/SmithsModding/Armory'
scm {
url 'https://github.com/SmithsModding/Armory'
connection 'scm:git:git://github.com/SmithsModding/Armory.git'
developerConnection 'scm:git:[email protected]/SmithsModding/Armory.git'
}
issueManagement {
system 'github'
url 'https://github.com/SmithsModding/Armory/issues'
}
developers {
developer {
id 'OrionDevelopment'
name 'Orion'
roles {
role 'developer'
}
}
}
}
}
}
//Task to synchronise two github branches.
task('createGithubBranches') << {
if ((System.getenv().TRAVIS_BRANCH.toString().contains("Development")) && (build_mode.toString().trim().equals("RELEASE")))
{
logger.lifecycle("Uploading code to the corresponding Minecraft version branch. Creating branch if needed.")
logger.lifecycle("Creating local branch.")
//Creates/Or checks out the new local branch.
def createLocalBranchCMD = "git checkout -b Minecraft-" + config.minecraft_version.toString()
def createLocalProg = createLocalBranchCMD.execute();
createLocalProg.waitFor()
//Adds a tag to the minecraft version specific branch for the version number.
logger.lifecycle("Adding version tag.")
def addTagCMD = "git -a Version[" + version + "] -m 'Autobuild by Travis CI. Build on: " + getDate() + ".'"
def addTagProg = addTagCMD.execute()
addTagProg.waitFor()
logger.lifecycle("Uploading force push to repo.")
def setUrlCMD = "git config remote.origin.url https://" + System.getenv().GitUsername.toString() + ":" + System.getenv().GitPassword.toString() + "@github.com/SmithsModding/Armory"
def setURLProg = setUrlCMD.execute()
setURLProg.waitFor()
def cmd = "git push origin -f Minecraft-" + config.minecraft_version.toString()
def prog = cmd.execute()
prog.waitFor()
logger.lifecycle("Mirrored the code the corresponding minecraft version branch. Current MC Version: " + config.minecraft_version.toString() + ". Branch name: Minecraft-" + config.minecraft_version.toString() + ".")
}
else
{
logger.lifecycle("The sync of the branches is not being executed, because we are not releasing a new version.")
}
}
//The external task that executes the uploadAtchives function.
task('uploadJars', dependsOn: uploadArchives) {
description = "uploads JARs"
}
D:\Development\Minecraft\Armory>gradle build#
'gradle' is not recognized as an internal or external command,
operable program or batch file.
D:\Development\Minecraft\Armory>gradlew build
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Development\Minecraft\Armory\build.gradle' line: 77
* What went wrong:
A problem occurred evaluating root project 'Armory'.
> No signature of method: java.lang.String.call() is applicable for argument types: () values: []
Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), take(int)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 17.476 secs
D:\Development\Minecraft\Armory>gradlew build -S
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Development\Minecraft\Armory\build.gradle' line: 77
* What went wrong:
A problem occurred evaluating root project 'Armory'.
> No signature of method: java.lang.String.call() is applicable for argument types: () values: []
Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), take(int), any(groovy.lang.Closure)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'Armory'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:76)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:85)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:50)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:27)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: () values: []
Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), take(int), any(groovy.lang.Closure)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at build_bmfalonlv8rndu6his1m8louc.run(D:\Development\Minecraft\Armory\build.gradle:77)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:74)
... 46 more
BUILD FAILED
Total time: 4.84 secs
D:\Development\Minecraft\Armory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment