2015-05-26 14:16:16 +00:00
|
|
|
import groovy.json.JsonSlurper
|
2015-06-01 10:29:21 +00:00
|
|
|
import kcauldron.CreateChangelog
|
2015-06-09 04:01:23 +00:00
|
|
|
import kcauldron.InstallBundle
|
2015-06-27 12:47:27 +00:00
|
|
|
import kcauldron.VersionParser
|
2015-05-26 14:16:16 +00:00
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
2017-06-25 05:24:11 +00:00
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
2015-03-22 17:38:04 +00:00
|
|
|
maven {
|
2017-06-25 05:24:11 +00:00
|
|
|
name 'yumc'
|
|
|
|
url 'http://repo.yumc.pw/content/groups/public/'
|
2015-03-22 17:38:04 +00:00
|
|
|
}
|
|
|
|
maven {
|
2015-06-22 10:00:20 +00:00
|
|
|
name 'forge'
|
|
|
|
url 'http://files.minecraftforge.net/maven'
|
2015-03-22 17:38:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-26 14:16:16 +00:00
|
|
|
tasks.whenTaskAdded {
|
|
|
|
if (it.name.startsWith('publish')) it.dependsOn 'preparePublication'
|
|
|
|
}
|
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
apply plugin: 'maven'
|
|
|
|
apply plugin: 'cauldron'
|
2015-05-26 14:16:16 +00:00
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
apply plugin: 'signing'
|
2015-03-22 17:38:04 +00:00
|
|
|
|
2015-06-22 10:00:20 +00:00
|
|
|
repositories {
|
2017-06-25 05:24:11 +00:00
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
2015-06-22 10:00:20 +00:00
|
|
|
maven {
|
2017-06-25 05:24:11 +00:00
|
|
|
name 'yumc'
|
|
|
|
url 'http://repo.yumc.pw/content/groups/public/'
|
2015-06-22 10:00:20 +00:00
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name 'forge'
|
|
|
|
url 'http://files.minecraftforge.net/maven'
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name 'minecraft'
|
|
|
|
url 'https://libraries.minecraft.net/'
|
|
|
|
}
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
minecraft {
|
|
|
|
version = '1.7.10'
|
|
|
|
mcpVersion = '9.05'
|
|
|
|
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
|
|
|
|
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
|
|
|
|
installerVersion = "1.4"
|
2017-07-02 11:55:18 +00:00
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4"
|
|
|
|
}
|
2015-05-26 14:16:16 +00:00
|
|
|
group = 'pw.prok'
|
2015-06-01 10:29:21 +00:00
|
|
|
ext.buildInfoCached = null;
|
|
|
|
|
|
|
|
def buildInfo(String key) {
|
|
|
|
if (!buildInfoCached) {
|
|
|
|
if (project.hasProperty('officialBuild')) {
|
2015-06-21 19:01:58 +00:00
|
|
|
buildInfoCached = new JsonSlurper().parse(new URL("https://api.prok.pw/repo/version/${group}/${name}"))
|
2015-06-01 10:29:21 +00:00
|
|
|
} else {
|
|
|
|
buildInfoCached = [
|
2017-06-28 00:27:45 +00:00
|
|
|
nextBuildNumber: '177',
|
2015-06-01 10:29:21 +00:00
|
|
|
version : 'NONE'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return key ? buildInfoCached[key] : buildInfoCached;
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.gitInfoCached = null;
|
|
|
|
|
|
|
|
def gitInfo(String key) {
|
|
|
|
if (!gitInfoCached) {
|
|
|
|
if (file('.git').exists()) {
|
|
|
|
gitInfoCached = [
|
|
|
|
hash : ['git', 'log', "--format=%h", '-n', '1'].execute().text.trim(),
|
|
|
|
fullHash: ['git', 'log', "--format=%H", '-n', '1'].execute().text.trim(),
|
2015-06-03 14:50:46 +00:00
|
|
|
branch : System.getenv("CI_BUILD_REF_NAME") ?: ['git', 'symbolic-ref', '--short', 'HEAD'].execute().text.trim(),
|
2015-06-01 10:29:21 +00:00
|
|
|
message : ['git', 'log', "--format=%B", '-n', '1'].execute().text.trim()
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
gitInfoCached = [
|
|
|
|
hash : 'NOT_A_GIT',
|
|
|
|
fullHash: 'NOT_A_GIT',
|
|
|
|
branch : 'NOT_A_GIT',
|
|
|
|
message : 'NOT_A_GIT'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return key ? gitInfoCached[key] : gitInfoCached;
|
2015-05-31 11:21:26 +00:00
|
|
|
}
|
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
ext.mcVersion = "1.7.10"
|
2015-06-27 21:35:19 +00:00
|
|
|
ext.forgeVersion = VersionParser.parseForgeRevision(file('src/main/resources/fmlversion.properties'))
|
2015-06-22 06:32:21 +00:00
|
|
|
ext.revision = project.hasProperty('revision') ? project.getProperty('revision') : buildInfo('nextBuildNumber')
|
2015-05-26 14:16:16 +00:00
|
|
|
version = "${mcVersion}-${forgeVersion}.${revision}"
|
2015-06-16 16:54:22 +00:00
|
|
|
if (project.hasProperty('officialBuild')) println "Updated KCauldron version: ${version}"
|
2015-03-22 17:38:04 +00:00
|
|
|
|
|
|
|
launch4j {
|
2017-07-02 11:55:18 +00:00
|
|
|
jreMinVersion = '1.7.0'
|
2015-03-22 17:38:04 +00:00
|
|
|
}
|
|
|
|
|
2015-06-16 16:30:52 +00:00
|
|
|
configurations {
|
|
|
|
compile.extendsFrom exported
|
|
|
|
libraries
|
|
|
|
bootstrap
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-10-23 13:54:39 +00:00
|
|
|
bootstrap 'pw.prok:KBootstrap:0.2.+'
|
2015-06-16 16:30:52 +00:00
|
|
|
|
2015-06-27 12:47:27 +00:00
|
|
|
libraries 'net.minecraft:launchwrapper:1.12@jar'
|
2015-06-16 16:30:52 +00:00
|
|
|
libraries 'org.ow2.asm:asm-all:5.0.3'
|
|
|
|
libraries 'com.typesafe.akka:akka-actor_2.11:2.3.3'
|
|
|
|
libraries 'com.typesafe:config:1.2.1'
|
|
|
|
libraries 'org.scala-lang:scala-actors-migration_2.11:1.1.0'
|
|
|
|
libraries 'org.scala-lang:scala-compiler:2.11.1'
|
|
|
|
libraries 'org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2'
|
|
|
|
libraries 'org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2'
|
|
|
|
libraries 'org.scala-lang:scala-library:2.11.1'
|
|
|
|
libraries 'org.scala-lang:scala-parser-combinators_2.11:1.0.1'
|
|
|
|
libraries 'org.scala-lang:scala-reflect:2.11.1'
|
|
|
|
libraries 'org.scala-lang:scala-swing_2.11:1.0.1'
|
|
|
|
libraries 'org.scala-lang:scala-xml_2.11:1.0.2'
|
2015-06-22 10:00:20 +00:00
|
|
|
libraries 'net.sf.jopt-simple:jopt-simple:4.7'
|
2015-06-16 16:30:52 +00:00
|
|
|
libraries 'lzma:lzma:0.0.1'
|
|
|
|
libraries 'org.yaml:snakeyaml:1.9'
|
|
|
|
libraries 'commons-lang:commons-lang:2.6'
|
|
|
|
libraries 'org.avaje:ebean:2.7.3'
|
|
|
|
libraries 'jline:jline:2.6'
|
2017-06-25 05:24:11 +00:00
|
|
|
libraries 'net.md-5:SpecialSource:1.7.3'
|
2015-06-16 16:30:52 +00:00
|
|
|
libraries 'net.sourceforge.argo:argo:2.25'
|
|
|
|
libraries 'org.fusesource.jansi:jansi:1.8'
|
|
|
|
libraries 'com.googlecode.json-simple:json-simple:1.1'
|
|
|
|
libraries 'org.xerial:sqlite-jdbc:3.7.2'
|
|
|
|
libraries 'mysql:mysql-connector-java:5.1.14'
|
|
|
|
libraries 'javax.persistence:persistence-api:1.0.2'
|
|
|
|
libraries 'net.minecraft:server:1.7.10'
|
2015-10-04 12:39:32 +00:00
|
|
|
libraries 'pw.prok:KImagine:0.2.0@jar'
|
2015-06-16 16:30:52 +00:00
|
|
|
libraries 'org.apache.httpcomponents:httpclient:4.4.1'
|
2016-02-10 12:17:47 +00:00
|
|
|
libraries 'colt:colt:1.2.0'
|
2017-06-25 05:24:11 +00:00
|
|
|
libraries 'java3d:vecmath:1.3.1'
|
2015-06-16 16:30:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
packageUniversal {
|
|
|
|
from { configurations.exported.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
|
|
}
|
|
|
|
|
|
|
|
def String repeat(String string, int times) {
|
|
|
|
StringBuilder builder = new StringBuilder(string.length() * times)
|
|
|
|
times.times { builder.append(string) }
|
|
|
|
builder as String
|
|
|
|
}
|
|
|
|
|
|
|
|
def generateClasspath(boolean legacy = false) {
|
|
|
|
def classpath = ''
|
|
|
|
configurations.libraries.resolvedConfiguration.resolvedArtifacts.collect { it.moduleVersion.id }.each {
|
|
|
|
def jar = "${it.group.replace('.', '/')}/${it.name}/${it.version}/${it.name}-${it.version}.jar"
|
|
|
|
classpath += " ${legacy ? 'libraries/' : repeat('../', (group as String).split('\\.').length + 2)}${jar}"
|
|
|
|
}
|
|
|
|
return classpath.trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
def generateManifest(boolean legacy = false) {
|
|
|
|
[
|
2015-06-01 10:29:21 +00:00
|
|
|
'KCauldron-Git-Branch' : gitInfo('branch'),
|
|
|
|
'KCauldron-Git-Hash' : gitInfo('fullHash'),
|
2015-06-16 16:54:22 +00:00
|
|
|
'KCauldron-Group' : project.group,
|
2015-06-03 14:50:46 +00:00
|
|
|
'KCauldron-Channel' : project.name,
|
2015-06-16 16:54:22 +00:00
|
|
|
'KCauldron-Version' : project.version,
|
2015-06-16 16:30:52 +00:00
|
|
|
'KCauldron-Legacy' : legacy,
|
2015-10-18 16:58:28 +00:00
|
|
|
'KCauldron-Official' : project.hasProperty('officialBuild'),
|
2015-06-01 10:29:21 +00:00
|
|
|
'Implementation-Vendor' : 'Prototik',
|
2015-06-03 14:50:46 +00:00
|
|
|
'Implementation-Title' : project.name,
|
2016-02-09 19:56:35 +00:00
|
|
|
'Implementation-Version': '1.7.10-R0.1-SNAPSHOT',
|
2015-06-01 10:29:21 +00:00
|
|
|
'Specification-Vendor' : 'Bukkit Team',
|
|
|
|
'Specification-Title' : 'Bukkit',
|
2015-06-16 16:30:52 +00:00
|
|
|
'Specification-Version' : '1.7.10-R0.1-SNAPSHOT',
|
2015-06-27 21:35:19 +00:00
|
|
|
'Forge-Version' : VersionParser.parseForgeVersion(file('forge/src/main/java/net/minecraftforge/common/ForgeVersion.java'), file('src/main/resources/fmlversion.properties')),
|
2015-06-16 16:30:52 +00:00
|
|
|
'TweakClass' : 'cpw.mods.fml.common.launcher.FMLTweaker',
|
|
|
|
'Main-Class' : 'cpw.mods.fml.relauncher.ServerLaunchWrapper',
|
|
|
|
'Class-Path' : generateClasspath(legacy)
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.packageUniversal {
|
|
|
|
classifier = 'server'
|
|
|
|
setManifest {}
|
|
|
|
manifest.attributes(generateManifest(true))
|
|
|
|
}
|
|
|
|
|
|
|
|
task jar(type: Jar, dependsOn: packageUniversal) {
|
|
|
|
destinationDir file("${buildDir}/distributions")
|
|
|
|
from zipTree(tasks.packageUniversal.archivePath)
|
|
|
|
manifest.attributes(generateManifest())
|
2015-03-22 17:38:04 +00:00
|
|
|
}
|
|
|
|
|
2015-05-26 14:16:16 +00:00
|
|
|
tasks.createChangelog.onlyIf { false }
|
2015-06-16 16:30:52 +00:00
|
|
|
tasks.packageInstaller.onlyIf { false }
|
2015-05-26 14:16:16 +00:00
|
|
|
|
2015-06-01 10:29:21 +00:00
|
|
|
task packageChangelog(type: CreateChangelog) {
|
|
|
|
onlyIf { project.hasProperty('officialBuild') }
|
|
|
|
classifier = 'changelog'
|
|
|
|
extension = 'txt'
|
2015-06-21 19:01:58 +00:00
|
|
|
oldChangelogUrl = "https://repo.prok.pw/${project.group.replace('.', '/')}/${project.name}/${buildInfo('version')}/${project.name}-${buildInfo('version')}-changelog.txt"
|
2015-06-01 10:29:21 +00:00
|
|
|
hash = gitInfo('hash')
|
|
|
|
message = gitInfo('message')
|
|
|
|
version = project.version
|
|
|
|
}
|
|
|
|
|
2015-06-30 16:02:34 +00:00
|
|
|
task bundleStub(type: Jar) {
|
|
|
|
classifier = 'stub'
|
|
|
|
manifest.attributes([
|
|
|
|
'Main-Class': 'cpw.mods.fml.relauncher.ServerLaunchWrapper',
|
|
|
|
'Class-Path': "bin/${project.group.replace('.', '/')}/${project.name}/${project.version}/${project.name}-${project.version}.jar"
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
2015-06-22 06:32:21 +00:00
|
|
|
task installBundle(type: InstallBundle, dependsOn: jar) {
|
2015-06-16 16:30:52 +00:00
|
|
|
serverJar tasks.jar.archivePath
|
|
|
|
bootstrapClasspath configurations.bootstrap
|
|
|
|
bootstrapMain 'pw.prok.bootstrap.Main'
|
2015-06-09 04:01:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task packageBundle(type: Zip, dependsOn: installBundle) {
|
|
|
|
classifier = 'bundle'
|
2015-06-16 16:30:52 +00:00
|
|
|
from fileTree(installBundle.installLocation)
|
2015-06-30 16:02:34 +00:00
|
|
|
from bundleStub
|
|
|
|
rename bundleStub.archiveName, 'KCauldron.jar'
|
2015-06-09 04:01:23 +00:00
|
|
|
}
|
|
|
|
|
2015-10-25 10:20:48 +00:00
|
|
|
task signJars(type: Sign, dependsOn: [packageChangelog, packageBundle, jar, 'generatePomFileForMavenPublication']) {
|
2015-06-01 10:29:21 +00:00
|
|
|
sign packageChangelog
|
2015-06-09 04:01:23 +00:00
|
|
|
sign packageBundle
|
2015-06-16 16:30:52 +00:00
|
|
|
sign jar
|
2015-05-26 14:16:16 +00:00
|
|
|
}
|
|
|
|
|
2015-06-16 16:30:52 +00:00
|
|
|
task signPom(type: Sign, dependsOn: 'generatePomFileForMavenPublication') {
|
2015-06-30 16:02:34 +00:00
|
|
|
outputs.upToDateWhen { false }
|
2015-06-16 16:30:52 +00:00
|
|
|
sign file("${buildDir}/publications/maven/pom-default.xml")
|
|
|
|
}
|
|
|
|
|
|
|
|
task preparePublication(dependsOn: [signJars, signPom]) {}
|
2015-05-26 14:16:16 +00:00
|
|
|
|
2015-06-16 16:54:22 +00:00
|
|
|
def getPomSignature = {
|
|
|
|
return project.tasks.signPom.signatureFiles.collect { it }[0]
|
|
|
|
}
|
|
|
|
|
2015-05-26 14:16:16 +00:00
|
|
|
def getSignatureFiles = {
|
|
|
|
def allFiles = project.tasks.signJars.signatureFiles.collect { it }
|
2015-06-01 10:29:21 +00:00
|
|
|
def signedChangelog = allFiles.find { it.name.contains('-changelog') }
|
2015-06-09 04:01:23 +00:00
|
|
|
def signedBundle = allFiles.find { it.name.contains('-bundle') }
|
2015-10-25 10:20:48 +00:00
|
|
|
def signedJar = (allFiles - [signedChangelog, signedBundle])[0]
|
2015-05-26 14:16:16 +00:00
|
|
|
return [
|
2015-06-09 04:01:23 +00:00
|
|
|
[archive: signedChangelog, classifier: 'changelog', extension: 'txt.asc'],
|
2015-06-21 19:01:58 +00:00
|
|
|
[archive: signedBundle, classifier: 'bundle', extension: 'zip.asc'],
|
2015-06-16 16:30:52 +00:00
|
|
|
[archive: signedJar, classifier: null, extension: 'jar.asc']
|
2015-05-26 14:16:16 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name 'ProK'
|
2015-06-21 19:01:58 +00:00
|
|
|
url 'https://repo.prok.pw/'
|
2015-06-01 10:29:21 +00:00
|
|
|
credentials {
|
2015-05-26 14:16:16 +00:00
|
|
|
username project.hasProperty('prokRepoUsername') ? prokRepoUsername : null
|
|
|
|
password project.hasProperty('prokRepoPassword') ? prokRepoPassword : null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
publications {
|
2015-06-01 10:29:21 +00:00
|
|
|
maven(MavenPublication) {
|
2015-05-26 14:16:16 +00:00
|
|
|
getSignatureFiles().each { signature ->
|
|
|
|
artifact(signature.archive) {
|
|
|
|
classifier = signature.classifier
|
|
|
|
extension = signature.extension
|
|
|
|
}
|
|
|
|
}
|
2015-06-16 16:54:22 +00:00
|
|
|
artifact(getPomSignature()) {
|
|
|
|
classifier = null
|
|
|
|
extension = 'pom.asc'
|
|
|
|
}
|
2015-06-01 10:29:21 +00:00
|
|
|
artifact packageChangelog
|
2015-06-09 04:01:23 +00:00
|
|
|
artifact packageBundle
|
2015-06-16 16:30:52 +00:00
|
|
|
artifact jar
|
2015-05-26 14:16:16 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-08 09:29:14 +00:00
|
|
|
}
|
2015-05-28 10:26:48 +00:00
|
|
|
|
|
|
|
tasks.generateProjectCauldron << {
|
2015-06-01 10:29:21 +00:00
|
|
|
def file = new File('eclipse/cauldron/build.gradle')
|
|
|
|
file.append('''
|
2015-05-28 10:26:48 +00:00
|
|
|
repositories {
|
2015-06-22 10:00:20 +00:00
|
|
|
clear()
|
|
|
|
maven {
|
2017-06-25 05:24:11 +00:00
|
|
|
name 'yumc'
|
|
|
|
url 'http://repo.yumc.pw/content/groups/public/'
|
2015-06-22 10:00:20 +00:00
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name 'forge'
|
|
|
|
url 'http://files.minecraftforge.net/maven'
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name 'minecraft'
|
|
|
|
url 'https://libraries.minecraft.net/'
|
|
|
|
}
|
|
|
|
mavenCentral()
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
''')
|
2015-06-16 16:30:52 +00:00
|
|
|
configurations.libraries.resolvedConfiguration.resolvedArtifacts.collect { it.moduleVersion.id }.each { module ->
|
2015-06-30 16:02:34 +00:00
|
|
|
if (['net.minecraft:server:', 'org.ow2.asm:asm-all'].findAll { (module as String).startsWith it }.size() > 0) {
|
2015-06-16 16:30:52 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
file.append(" compile '${module}'\n")
|
2015-06-01 10:29:21 +00:00
|
|
|
}
|
2015-06-16 16:30:52 +00:00
|
|
|
file.append('}')
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|
2015-06-30 16:02:34 +00:00
|
|
|
|
|
|
|
task resolveAllDependencies {
|
|
|
|
doLast {
|
|
|
|
configurations.each { it.resolve() }
|
|
|
|
}
|
2015-10-04 12:39:32 +00:00
|
|
|
}
|