From 1819e1c95cf15860dab6ca9c10c60a4a0173243a Mon Sep 17 00:00:00 2001 From: Zaxar163 <35835496+Zaxar163@users.noreply.github.com> Date: Fri, 8 Mar 2019 16:21:41 +0300 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=9F=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20launch4j.=20(#187)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [FEATURE] Получение launch4j. * [FEATURE] Генерация готового bundle, со всей структурой каталогов нужной для работы лауннчсервера. * [FIX] Название архива с LaunchServer. --- LaunchServer/build.gradle | 61 +++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index c6702389..0f2209c1 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -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