Permalink
Browse files

Gradle script automatically updates update.json

  • Loading branch information...
1 parent c08fa02 commit cc1b66f3cd31206a2716233816ae970fe2d53e8c @williewillus williewillus committed May 28, 2016
Showing with 22 additions and 8 deletions.
  1. +20 −6 build.gradle
  2. +2 −2 gradle/wrapper/gradle-wrapper.properties
View
@@ -1,3 +1,6 @@
+import groovy.json.JsonSlurper
+import groovy.json.JsonOutput
+
buildscript {
repositories {
mavenCentral()
@@ -115,8 +118,22 @@ task incrementBuildNumber(dependsOn: 'reobfJar') << {
file('web/versions.ini').append("\n${version}=${minecraft.version}")
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
+
+ def updateJsonFile = file('version/update.json')
+ def updateJson = new JsonSlurper().parse(updateJsonFile) as Map
+
+ // Add to version section
+ updateJson."${minecraft.version}"."${version}" = "See https://github.com/williewillus/Botania/releases/${version}"
+
+ // Update promos
+ updateJson.promos."${minecraft.version}-latest" = "${version}"
+ updateJson.promos."${minecraft.version}-recommended" = "${version}"
+
+
+ updateJsonFile.write(JsonOutput.prettyPrint(JsonOutput.toJson(updateJson)))
}
+/* Unused - Forgecraft and web server stuff
// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
@@ -154,9 +171,7 @@ task sort(type: Delete) {
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
}
-/**
- * This is the upload task from the build.xml
- */
+// This is the upload task from the build.xml
task upload() << {
scp('/files') {
fileset(file: jar.archivePath)
@@ -172,9 +187,7 @@ task upload() << {
}
}
-/**
- * This is deply_web task
- */
+// This is deploy_web task
task deployWeb << {
scp('/') {
fileset(dir: 'web') //everything from the web directory
@@ -202,6 +215,7 @@ def scp(String dir, Closure antFileset = {}) {
}
}
}
+*/
def parseConfig(File config) {
config.withReader {
@@ -1,6 +1,6 @@
-#Mon Sep 14 12:28:28 PDT 2015
+#Sat May 28 11:56:22 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip

0 comments on commit cc1b66f

Please sign in to comment.