[FEATURE] Получение launch4j. (#187)

* [FEATURE] Получение launch4j.

* [FEATURE] Генерация готового bundle, со всей структурой каталогов нужной для работы лауннчсервера.

* [FIX] Название архива с LaunchServer.
This commit is contained in:
Zaxar163 2019-03-08 16:21:41 +03:00 committed by Gravit
parent 57231d948d
commit 1819e1c95c

View file

@ -18,8 +18,10 @@
bundle
hikari
pack
launch4j
launch4jCJ
bundleOnly.extendsFrom bundle
compile.extendsFrom bundle, hikari, pack
compile.extendsFrom bundle, hikari, pack, launch4jCJ, launch4j
}
jar {
@ -57,10 +59,18 @@ pack project(':libLauncher')
exclude group: 'io.micrometer'
exclude group: 'org.slf4j'
}
compileOnly('net.sf.launch4j:launch4j:3.12') { // need user
launch4j('net.sf.launch4j:launch4j:3.12') {
exclude group: '*'
}
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-win32') {
exclude group: '*'
}
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-linux') {
exclude group: '*'
}
}
task hikari(type: Copy) {
@ -68,16 +78,49 @@ task hikari(type: Copy) {
from configurations.hikari
}
task launch4jM(type: Copy) {
into "$buildDir/libs/libraries/launch4j"
from(configurations.launch4jCJ.collect { it.isDirectory() ? it : zipTree(it) })
includeEmptyDirs false
eachFile { FileCopyDetails fcp ->
if (fcp.relativePath.pathString.startsWith("launch4j-")) {
def segments = fcp.relativePath.segments
def pathSegments = segments[1..-1] as String[]
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathSegments)
fcp.mode = 0755
} else {
fcp.exclude()
}
}
}
task launch4jA(type: Copy) {
into "$buildDir/libs/libraries/launch4j"
from(configurations.launch4j)
includeEmptyDirs false
eachFile { FileCopyDetails fcp ->
if (fcp.name.startsWith("launch4j")) {
fcp.name = "launch4j.jar"
fcp.mode = 0755
} else {
fcp.exclude()
}
}
}
task dumpLibs(type: Copy) {
dependsOn tasks.hikari
dependsOn tasks.hikari, tasks.launch4jM, tasks.launch4jA
into "$buildDir/libs/libraries"
from configurations.bundleOnly
}
task dumpClientLibs(type: Copy) {
dependsOn parent.childProjects.Launcher.tasks.build
into "$buildDir/libs/launcher-libraries"
from parent.childProjects.Launcher.tasks.dumpLibs.destinationDir
task bundle(type: Zip) {
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
archiveName 'LaunchServer.zip'
destinationDir file("$buildDir")
from(tasks.dumpLibs.destinationDir) { into 'libraries' }
from tasks.jar.archivePath
from(parent.childProjects.Launcher.tasks.dumpLibs) { into 'launcher-libraries' }
}
build.dependsOn tasks.dumpLibs, tasks.dumpClientLibs
build.dependsOn tasks.dumpLibs, tasks.bundle