3
0
KCauldronX/build.gradle
2015-05-27 17:46:53 +07:00

131 lines
3.6 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'
new JsonSlurper().parse(new URL("https://prok.pw/version/${group}/${name}"))['nextBuildNumber']
}
def retrieveGitHash() {
if (file('.git').exists())
return ['git', 'log', '--format=%H', '-n', '1'].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-Hash': retrieveGitHash(),
'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
}
}
}