Skip to content

Instantly share code, notes, and snippets.

@marchermans
Created June 9, 2015 08:57
Show Gist options
  • Save marchermans/f8833db3707923421fce to your computer and use it in GitHub Desktop.
Save marchermans/f8833db3707923421fce to your computer and use it in GitHub Desktop.
Curse upload problem
//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
}
//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()
if(System.getenv().TRAVIS_BRANCH.toString().contains("Development"))
{
version = version + "-SNAPSHOT"
}
group= "com.Orion.Armory"
archivesBaseName = "Armory"
def ChangeLogText = "The changelog was not madeup during the BuildProcess."
//IDea fix for
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
replaceIn "Armory.java"
}
//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/Armory'
}
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", project.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':project.minecraft.version
}
//Copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
exclude '**/Thumbs.db'
}
//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
}
//External task for settingup the a dev environment to develop Armory inc. NEI and WAILA
task createDevSetup{
description "Creates a full decompiled and ready to go (as far as possible) dev environment."
}
//Set the dependencies properly for the createDevSetup task.
tasks.createDevSetup.dependsOn("setupDevWorkspace", "setupDecompWorkspace", "copyChicken")
import net.minecraftforge.gradle.delayed.*
task('createChangeLog') << {
onlyIf(System.getenv().TRAVIS_BRANCH);
logger.lifecycle("Generating Changelog.")
logger.lifecycle("Parsing Git Commits and processing them...")
//Creates/Or checks out the new local branch.
def createGitLogCommand = "github_changelog_generator"
def createLocalProg = createGitLogCommand.execute();
createLocalProg.waitFor()
println("Generated Log File.")
ChangeLogText = new File("CHANGELOG.MD").text
logger.lifecycle("Loaded the changelog into memory. Done!")
}
curse {
onlyIf { (System.getenv().CURSEAPIKEY != null) }
projectId = System.getenv().CURSEPROJECTID ? System.getenv().CURSEPROJECTID : ''
apiKey = System.getenv().CURSEAPIKEY ? System.getenv().CURSEAPIKEY : ''
if (config.build_mode.equals("DEBUG"))
{
releaseType = "Alpha"
}
else
{
releaseType = "Beta"
}
}
curse.dependsOn {
reobf
}
//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.orionminecraft.com"){
authentication(userName: "mavenrepo.orionminecraft.com|" + System.getenv().FTPUserName.toString(), password: System.getenv().FTPPassword.toString())
}
}
else {
repository(url: "ftp://mavenrepo.orionminecraft.com") {
authentication(userName: "mavenrepo.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('createGithubBranches') << {
if ((System.getenv().TRAVIS_BRANCH.toString().contains("Development")) && (config.build_mode.toString().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() + ".")
}
}
//The external task that executes the uploadAtchives function.
task('uploadJars', dependsOn: uploadArchives) {
description = "uploads JARs"
}
Execution failed for task ':curse'.
> Curse Error 401: You must provide an API token using the `X-Api-Token` header, the `token` query string parameter, your email address and an API token using HTTP basic authentication.
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':curse'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
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: java.lang.RuntimeException: Curse Error 401: You must provide an API token using the `X-Api-Token` header, the `token` query string parameter, your email address and an API token using HTTP basic authentication.
at net.minecraftforge.gradle.curseforge.CurseUploadTask.getWithEtag(CurseUploadTask.java:281)
at net.minecraftforge.gradle.curseforge.CurseUploadTask.resolveGameVersion(CurseUploadTask.java:182)
at net.minecraftforge.gradle.curseforge.CurseUploadTask.doTask(CurseUploadTask.java:80)
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.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:589)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:572)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 57 more
BUILD FAILED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment