2015-05-26 14:16:16 +00:00
|
|
|
import groovy.json.JsonSlurper
|
2015-06-01 10:29:21 +00:00
|
|
|
import kcauldron.CreateChangelog
|
2015-05-26 14:16:16 +00:00
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
minecraft {
|
|
|
|
version = '1.7.10'
|
|
|
|
mcpVersion = '9.05'
|
|
|
|
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
|
|
|
|
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
|
|
|
|
installerVersion = "1.4"
|
|
|
|
subprojects {
|
|
|
|
repositories {
|
2015-05-26 14:16:16 +00:00
|
|
|
mavenCentral()
|
2015-03-22 17:38:04 +00:00
|
|
|
maven {
|
|
|
|
name = "sonatype"
|
|
|
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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')) {
|
|
|
|
buildInfoCached = new JsonSlurper().parse(new URL("https://prok.pw/version/${group}/${name}"))
|
|
|
|
} else {
|
|
|
|
buildInfoCached = [
|
|
|
|
nextBuildNumber: 'UNOFFICIAL.' + gitInfo('hash'),
|
|
|
|
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-01 09:13:46 +00:00
|
|
|
ext.forgeVersion = "1420"
|
2015-06-01 10:29:21 +00:00
|
|
|
ext.revision = buildInfo('nextBuildNumber')
|
2015-05-26 14:16:16 +00:00
|
|
|
version = "${mcVersion}-${forgeVersion}.${revision}"
|
2015-06-01 09:13:46 +00:00
|
|
|
println "Updated KCauldron version: ${version}"
|
2015-03-22 17:38:04 +00:00
|
|
|
|
|
|
|
launch4j {
|
2015-06-03 05:21:21 +00:00
|
|
|
jreMinVersion = '1.6.0'
|
2015-03-22 17:38:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.packageUniversal {
|
|
|
|
classifier = 'server'
|
2015-05-26 14:16:16 +00:00
|
|
|
manifest.attributes([
|
2015-06-01 10:29:21 +00:00
|
|
|
'KCauldron-Git-Branch' : gitInfo('branch'),
|
|
|
|
'KCauldron-Git-Hash' : gitInfo('fullHash'),
|
|
|
|
'KCauldron-Version' : project.version,
|
2015-06-03 14:50:46 +00:00
|
|
|
'KCauldron-Channel' : project.name,
|
2015-06-01 10:29:21 +00:00
|
|
|
'Implementation-Vendor' : 'Prototik',
|
2015-06-03 14:50:46 +00:00
|
|
|
'Implementation-Title' : project.name,
|
2015-06-01 10:29:21 +00:00
|
|
|
'Implementation-Version': project.version,
|
|
|
|
'Forge-Version' : '10.13.3.1420',
|
|
|
|
'Specification-Vendor' : 'Bukkit Team',
|
|
|
|
'Specification-Title' : 'Bukkit',
|
|
|
|
'Specification-Version' : '1.7.10-R0.1-SNAPSHOT'
|
2015-05-26 14:16:16 +00:00
|
|
|
])
|
2015-03-22 17:38:04 +00:00
|
|
|
}
|
|
|
|
|
2015-05-26 14:16:16 +00:00
|
|
|
tasks.createChangelog.onlyIf { false }
|
|
|
|
|
2015-06-01 10:29:21 +00:00
|
|
|
task packageChangelog(type: CreateChangelog) {
|
|
|
|
onlyIf { project.hasProperty('officialBuild') }
|
|
|
|
classifier = 'changelog'
|
|
|
|
extension = 'txt'
|
|
|
|
oldChangelogUrl = "https://prok.pw/repo/${project.group.replace('.','/')}/${project.name}/${buildInfo('version')}/${project.name}-${buildInfo('version')}-changelog.txt"
|
|
|
|
hash = gitInfo('hash')
|
|
|
|
message = gitInfo('message')
|
|
|
|
version = project.version
|
|
|
|
}
|
|
|
|
|
2015-05-26 14:16:16 +00:00
|
|
|
task signJars(type: Sign, dependsOn: [packageUniversal, packageInstaller]) {
|
|
|
|
sign packageInstaller
|
|
|
|
sign packageUniversal
|
2015-06-01 10:29:21 +00:00
|
|
|
sign packageChangelog
|
2015-05-26 14:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task preparePublication(dependsOn: signJars) {}
|
|
|
|
|
|
|
|
def getSignatureFiles = {
|
|
|
|
def allFiles = project.tasks.signJars.signatureFiles.collect { it }
|
|
|
|
def signedServer = allFiles.find { it.name.contains('-server') }
|
|
|
|
def signedInstaller = allFiles.find { it.name.contains('-installer') }
|
2015-06-01 10:29:21 +00:00
|
|
|
def signedChangelog = allFiles.find { it.name.contains('-changelog') }
|
2015-05-26 14:16:16 +00:00
|
|
|
return [
|
|
|
|
[archive: signedServer, classifier: 'server', extension: 'jar.asc'],
|
2015-06-01 10:29:21 +00:00
|
|
|
[archive: signedInstaller, classifier: 'installer', extension: 'jar.asc'],
|
|
|
|
[archive: signedChangelog, classifier: 'changelog', extension: 'txt.asc']
|
2015-05-26 14:16:16 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name 'ProK'
|
|
|
|
url 'https://prok.pw/repo/'
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
artifact packageUniversal
|
|
|
|
artifact packageInstaller
|
2015-06-01 10:29:21 +00:00
|
|
|
artifact packageChangelog
|
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 {
|
|
|
|
maven {
|
|
|
|
url 'https://prok.pw/repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
2015-06-08 12:08:18 +00:00
|
|
|
compile 'pw.prok:KImagine:0.1.10+@jar'
|
2015-05-31 11:21:26 +00:00
|
|
|
compile 'org.apache.httpcomponents:httpclient:4.4.1'
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|
|
|
|
''')
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
2015-06-01 10:29:21 +00:00
|
|
|
compile.extendsFrom exported
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
2015-06-01 10:29:21 +00:00
|
|
|
maven {
|
|
|
|
url 'https://prok.pw/repo'
|
|
|
|
}
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-06-08 12:08:18 +00:00
|
|
|
exported 'pw.prok:KImagine:0.1.10+@jar'
|
2015-06-01 10:29:21 +00:00
|
|
|
exported 'org.apache.httpcomponents:httpclient:4.4.1'
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
packageUniversal {
|
2015-06-01 10:29:21 +00:00
|
|
|
from { configurations.exported.collect { it.isDirectory() ? it : zipTree(it) } }
|
2015-05-28 10:26:48 +00:00
|
|
|
}
|