Deprecate installer & use KBootstrap for updating
This commit is contained in:
@ -2,14 +2,26 @@ 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
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.tasks.*
|
||||
|
||||
class InstallBundle extends DefaultTask {
|
||||
@InputFile
|
||||
def File installer
|
||||
def File serverJar
|
||||
|
||||
@InputFiles
|
||||
def ConfigurableFileCollection bootstrapClasspath
|
||||
|
||||
@Input
|
||||
def String bootstrapMain
|
||||
|
||||
InstallBundle() {
|
||||
bootstrapClasspath = project.files()
|
||||
}
|
||||
|
||||
def bootstrapClasspath(Object... args) {
|
||||
bootstrapClasspath.from args
|
||||
}
|
||||
|
||||
@OutputDirectory
|
||||
def File getInstallLocation() {
|
||||
@ -20,14 +32,40 @@ class InstallBundle extends DefaultTask {
|
||||
def install() {
|
||||
installLocation.deleteDir()
|
||||
installLocation.mkdirs()
|
||||
new File(installLocation, "README.txt").withWriter {
|
||||
def String jarPath = 'bin/' << (project.group as String).replace('.', File.separator) << File.separator << project.name << File.separator << project.version << File.separator << project.name << '-' << project.version << '.jar'
|
||||
|
||||
it << '''KCauldron installation guide
|
||||
|
||||
# Understanding this bundle
|
||||
You're reading this guide because you're using deprecated installation method
|
||||
If you want use easier & safer method please read about KBootstrap at https://prok.pw/KBootstrap
|
||||
|
||||
# Installation and usage
|
||||
1. Unpack this zip into server directory
|
||||
2. Use following line to start the server:
|
||||
java -jar '''
|
||||
it << jarPath
|
||||
it << '''
|
||||
3. That's end, enjoy
|
||||
|
||||
# Why I should use KBootstrap?
|
||||
1. Easiest server installation
|
||||
2. Built-in libraries management
|
||||
3. Update & run server in one line
|
||||
4. Ability to not read this boring guide
|
||||
5. What else?
|
||||
If you are not yet convinced and want to use bundles instead KBootstrap... Meh, this is your choice.
|
||||
'''
|
||||
}
|
||||
def cp = bootstrapClasspath
|
||||
for (int i = 0; i < 3; i++) {
|
||||
def result = project.javaexec {
|
||||
def result = project.javaexec { it ->
|
||||
workingDir installLocation
|
||||
classpath installer
|
||||
main 'net.minecraftforge.installer.SimpleInstaller'
|
||||
args '--installServer'
|
||||
standardOutput new NopOutputStream()
|
||||
errorOutput new NopOutputStream()
|
||||
classpath cp
|
||||
main bootstrapMain
|
||||
args '--serverDir', installLocation.canonicalPath,
|
||||
'--installServer', serverJar.canonicalFile
|
||||
}
|
||||
if (result.exitValue == 0) return
|
||||
}
|
||||
|
Reference in New Issue
Block a user