forked from xjboss/KCauldronX
Make bundle for publishing
This commit is contained in:
parent
33633471ca
commit
474ef40d59
24
build.gradle
24
build.gradle
@ -1,5 +1,6 @@
|
|||||||
import groovy.json.JsonSlurper
|
import groovy.json.JsonSlurper
|
||||||
import kcauldron.CreateChangelog
|
import kcauldron.CreateChangelog
|
||||||
|
import kcauldron.InstallBundle
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
@ -126,10 +127,26 @@ task packageChangelog(type: CreateChangelog) {
|
|||||||
version = project.version
|
version = project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
task signJars(type: Sign, dependsOn: [packageUniversal, packageInstaller]) {
|
task installBundle(type: InstallBundle, dependsOn: packageInstaller) {
|
||||||
|
installer packageInstaller.archivePath
|
||||||
|
}
|
||||||
|
|
||||||
|
task packageBundle(type: Zip, dependsOn: installBundle) {
|
||||||
|
onlyIf { project.hasProperty('officialBuild') }
|
||||||
|
classifier = 'bundle'
|
||||||
|
from packageInstaller
|
||||||
|
from packageUniversal
|
||||||
|
from fileTree(installBundle.installLocation, {
|
||||||
|
include 'libraries/**'
|
||||||
|
include 'minecraft_server.*.jar'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
task signJars(type: Sign, dependsOn: [packageUniversal, packageInstaller, packageChangelog, packageBundle]) {
|
||||||
sign packageInstaller
|
sign packageInstaller
|
||||||
sign packageUniversal
|
sign packageUniversal
|
||||||
sign packageChangelog
|
sign packageChangelog
|
||||||
|
sign packageBundle
|
||||||
}
|
}
|
||||||
|
|
||||||
task preparePublication(dependsOn: signJars) {}
|
task preparePublication(dependsOn: signJars) {}
|
||||||
@ -139,10 +156,12 @@ def getSignatureFiles = {
|
|||||||
def signedServer = allFiles.find { it.name.contains('-server') }
|
def signedServer = allFiles.find { it.name.contains('-server') }
|
||||||
def signedInstaller = allFiles.find { it.name.contains('-installer') }
|
def signedInstaller = allFiles.find { it.name.contains('-installer') }
|
||||||
def signedChangelog = allFiles.find { it.name.contains('-changelog') }
|
def signedChangelog = allFiles.find { it.name.contains('-changelog') }
|
||||||
|
def signedBundle = allFiles.find { it.name.contains('-bundle') }
|
||||||
return [
|
return [
|
||||||
[archive: signedServer, classifier: 'server', extension: 'jar.asc'],
|
[archive: signedServer, classifier: 'server', extension: 'jar.asc'],
|
||||||
[archive: signedInstaller, classifier: 'installer', extension: 'jar.asc'],
|
[archive: signedInstaller, classifier: 'installer', extension: 'jar.asc'],
|
||||||
[archive: signedChangelog, classifier: 'changelog', extension: 'txt.asc']
|
[archive: signedChangelog, classifier: 'changelog', extension: 'txt.asc'],
|
||||||
|
[archive: signedBundle, classifier: 'bundle', extension: 'jar.asc']
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +188,7 @@ publishing {
|
|||||||
artifact packageUniversal
|
artifact packageUniversal
|
||||||
artifact packageInstaller
|
artifact packageInstaller
|
||||||
artifact packageChangelog
|
artifact packageChangelog
|
||||||
|
artifact packageBundle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
50
buildSrc/src/main/groovy/kcauldron/InstallBundle.groovy
Normal file
50
buildSrc/src/main/groovy/kcauldron/InstallBundle.groovy
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package kcauldron
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.GradleException
|
||||||
|
import org.gradle.api.tasks.InputFile
|
||||||
|
import org.gradle.api.tasks.OutputDirectory
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
import org.gradle.api.tasks.incremental.IncrementalTaskInputs
|
||||||
|
|
||||||
|
class InstallBundle extends DefaultTask {
|
||||||
|
@InputFile
|
||||||
|
def File installer
|
||||||
|
|
||||||
|
@OutputDirectory
|
||||||
|
def File getInstallLocation() {
|
||||||
|
new File(project.buildDir, 'bundle')
|
||||||
|
}
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
def install() {
|
||||||
|
installLocation.deleteDir()
|
||||||
|
installLocation.mkdirs()
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
def result = project.javaexec {
|
||||||
|
workingDir installLocation
|
||||||
|
classpath installer
|
||||||
|
main 'net.minecraftforge.installer.SimpleInstaller'
|
||||||
|
args '--installServer'
|
||||||
|
standardOutput new NopOutputStream()
|
||||||
|
errorOutput new NopOutputStream()
|
||||||
|
}
|
||||||
|
if (result.exitValue == 0) return
|
||||||
|
}
|
||||||
|
throw new GradleException("Failed to install bundle into ${installLocation}")
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class NopOutputStream extends OutputStream {
|
||||||
|
@Override
|
||||||
|
void write(byte[] b, int off, int len) throws IOException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void write(byte[] b) throws IOException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void write(int b) throws IOException {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user