forked from xjboss/KCauldronX
173 lines
4.5 KiB
Groovy
173 lines
4.5 KiB
Groovy
import groovy.json.JsonSlurper
|
|
|
|
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'
|
|
}
|
|
}
|
|
|
|
tasks.whenTaskAdded {
|
|
if (it.name.startsWith('publish')) it.dependsOn 'preparePublication'
|
|
}
|
|
|
|
apply plugin: 'maven'
|
|
apply plugin: 'cauldron'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
|
|
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 {
|
|
mavenCentral()
|
|
maven {
|
|
name = "sonatype"
|
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
}
|
|
}
|
|
}
|
|
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4"
|
|
}
|
|
|
|
group = 'pw.prok'
|
|
|
|
def retrieveBuildNumber() {
|
|
if (!project.hasProperty('officialBuild')) return 'UNOFFICIAL.' + retrieveGitHash(false)
|
|
new JsonSlurper().parse(new URL("https://prok.pw/version/${group}/${name}"))['nextBuildNumber']
|
|
}
|
|
|
|
def retrieveGitHash(full = true) {
|
|
if (file('.git').exists())
|
|
return ['git', 'log', "--format=%${full?'H':'h'}", '-n', '1'].execute().text.trim()
|
|
return 'NOTGIT'
|
|
}
|
|
|
|
def retrieveGitBranch() {
|
|
if (file('.git').exists())
|
|
return ['git', 'symbolic-ref', '--short', 'HEAD'].execute().text.trim();
|
|
return 'NOTGIT'
|
|
}
|
|
|
|
ext.mcVersion = "1.7.10"
|
|
ext.forgeVersion = "1408"
|
|
ext.revision = retrieveBuildNumber()
|
|
version = "${mcVersion}-${forgeVersion}.${revision}"
|
|
println " # Updated KCauldron version: ${version}"
|
|
|
|
launch4j {
|
|
jreMinVersion = '1.6.0'
|
|
}
|
|
|
|
tasks.packageUniversal {
|
|
classifier = 'server'
|
|
manifest.attributes([
|
|
'KCauldron-Git-Branch': retrieveGitBranch(),
|
|
'KCauldron-Git-Hash': retrieveGitHash(),
|
|
'KCauldron-Version': project.version,
|
|
'Implementation-Vendor': 'Prototik',
|
|
'Implementationk-Title': 'KCauldron',
|
|
'Implementation-Version': 'KCauldron-'+project.version,
|
|
'Forge-Version': '10.13.3.1408',
|
|
'Specification-Vendor': 'Bukkit Team',
|
|
'Specification-Title': 'Bukkit',
|
|
'Specification-Version': '1.7.10-R0.1-SNAPSHOT'
|
|
])
|
|
}
|
|
|
|
tasks.createChangelog.onlyIf { false }
|
|
|
|
task signJars(type: Sign, dependsOn: [packageUniversal, packageInstaller]) {
|
|
sign packageInstaller
|
|
sign packageUniversal
|
|
}
|
|
|
|
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') }
|
|
return [
|
|
[archive: signedServer, classifier: 'server', extension: 'jar.asc'],
|
|
[archive: signedInstaller, classifier: 'installer', extension: 'jar.asc']
|
|
]
|
|
}
|
|
|
|
publishing {
|
|
repositories {
|
|
maven {
|
|
name 'ProK'
|
|
url 'https://prok.pw/repo/'
|
|
credentials {
|
|
username project.hasProperty('prokRepoUsername') ? prokRepoUsername : null
|
|
password project.hasProperty('prokRepoPassword') ? prokRepoPassword : null
|
|
}
|
|
}
|
|
}
|
|
|
|
publications {
|
|
gpg(MavenPublication) {
|
|
getSignatureFiles().each { signature ->
|
|
artifact(signature.archive) {
|
|
classifier = signature.classifier
|
|
extension = signature.extension
|
|
}
|
|
}
|
|
}
|
|
jar(MavenPublication) {
|
|
artifact packageUniversal
|
|
artifact packageInstaller
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.generateProjectCauldron << {
|
|
def file = new File('eclipse/cauldron/build.gradle')
|
|
file.append('''
|
|
repositories {
|
|
maven {
|
|
url 'https://prok.pw/repo'
|
|
}
|
|
}
|
|
dependencies {
|
|
compile 'pw.prok:KImagine:+@jar'
|
|
compile 'org.apache.httpcomponents:httpclient:4.4.1'
|
|
}
|
|
''')
|
|
}
|
|
|
|
configurations {
|
|
compile.extendsFrom exported
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url 'https://prok.pw/repo'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
exported 'pw.prok:KImagine:+@jar'
|
|
exported 'org.apache.httpcomponents:httpclient:4.4.1'
|
|
}
|
|
|
|
packageUniversal {
|
|
from { configurations.exported.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
}
|