From 55080540b65bd1956edb9c51735258e2ff265caf Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 8 Mar 2019 15:25:31 +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.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LaunchServer/build.gradle | 49 +++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index c6702389..3da0f287 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 } 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') { // need user exclude group: '*' } + + launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-win32') { // need user + exclude group: '*' + } + + launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-linux') { // need user + exclude group: '*' + } } task hikari(type: Copy) { @@ -68,8 +78,39 @@ 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-")) { + // remap the file to the root + 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 }