Skip to content

Commit ab01849

Browse files
committed
U build and copy winrun4j-launcher library automatically
1 parent 81474e9 commit ab01849

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies {
5656
implementation 'org.redline-rpm:redline:1.2.10'
5757

5858
//implementation 'io.github.fvarrui:gradle-launch4j:2.4.7'
59-
implementation 'edu.sc.seis.launch4j:launch4j:2.5.1'
59+
implementation 'edu.sc.seis.launch4j:launch4j:2.5.1'
6060

6161
testImplementation 'junit:junit:4.12'
6262

@@ -68,7 +68,7 @@ dependencies {
6868
mavenEmbedder 'org.eclipse.aether:aether-connector-basic:1.1.0'
6969
mavenEmbedder 'org.eclipse.aether:aether-transport-wagon:1.1.0'
7070
mavenEmbedder 'org.apache.maven.wagon:wagon-http:3.4.1'
71-
mavenEmbedder 'org.apache.maven.wagon:wagon-provider-api:3.4.1'
71+
mavenEmbedder 'org.apache.maven.wagon:wagon-provider-api:3.4.1'
7272
}
7373

7474
group = 'io.github.fvarrui'
@@ -96,8 +96,11 @@ install.repositories.mavenInstaller.pom.with {
9696
packaging = 'maven-plugin'
9797
}
9898

99+
build.dependsOn ':winrun4j-launcher:build'
100+
99101
// runs the plugin description generator
100102
task generatePluginDescriptor(type: JavaExec, dependsOn: compileJava) {
103+
101104
def pomFile = file("$buildDir/pom.xml")
102105
def pluginDescriptorFile = new File(project.compileJava.destinationDir, 'META-INF/maven/plugin.xml')
103106
def directory = buildDir.canonicalPath

src/main/java/io/github/fvarrui/javapackager/packagers/CreateWindowsExeWinRun4j.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ protected File doApply(WindowsPackager packager) throws Exception {
6464
Logger.info("INI file generated in " + genericIni.getAbsolutePath() + "!");
6565

6666
// process EXE with rcedit-x64.exe
67-
CommandUtils.execute(rcedit.getAbsolutePath(), getGenericExe(), "--set-icon", getGenericIcon());
68-
CommandUtils.execute(rcedit.getAbsolutePath(), getGenericExe(), "--application-manifest", getGenericManifest());
67+
CommandUtils.execute(rcedit, getGenericExe(), "--set-icon", getGenericIcon());
68+
CommandUtils.execute(rcedit, getGenericExe(), "--application-manifest", getGenericManifest());
6969

7070
// creates libs folder if it doesn't exist
7171
if (libsFolder == null) {
@@ -76,8 +76,8 @@ protected File doApply(WindowsPackager packager) throws Exception {
7676
FileUtils.copyFileToFolder(jarFile, libsFolder);
7777

7878
// copies winrun4j launcher helper library (needed to work around
79-
File winrun4jJar = new File(libsFolder, "winrun4j-launcher-0.0.1.jar");
80-
FileUtils.copyResourceToFile("/windows/winrun4j-launcher-0.0.1.jar", winrun4jJar);
79+
File winrun4jJar = new File(libsFolder, "winrun4j-launcher.jar");
80+
FileUtils.copyResourceToFile("/windows/winrun4j-launcher.jar", winrun4jJar);
8181

8282
// generates winrun4j properties pointing to main class
8383
File propertiesFile = new File(getOutputFolder(), "winrun4j.properties");
-987 Bytes
Binary file not shown.
977 Bytes
Binary file not shown.

winrun4j-launcher/build.gradle

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,26 @@ targetCompatibility = 1.8
1111

1212
compileJava.options.encoding = 'UTF-8'
1313

14+
ext {
15+
baseName = 'winrun4j-launcher'
16+
}
17+
1418
jar {
15-
archiveBaseName = 'winrun4j-launcher'
16-
archiveVersion = '0.0.1'
17-
}
19+
archiveBaseName = baseName
20+
archiveVersion = version
21+
}
22+
23+
task copyArtifact {
24+
doLast {
25+
def DIST_DIR = "${rootDir}/src/main/resources/windows"
26+
def SRC_DIR = "${buildDir}/libs"
27+
def ARTIFACT = "${baseName}-${version}.jar"
28+
ant.mkdir(dir: DIST_DIR)
29+
ant.copy(todir: DIST_DIR) {
30+
fileset(dir: SRC_DIR, includes: ARTIFACT)
31+
globmapper(from: ARTIFACT, to: "${baseName}.jar")
32+
}
33+
}
34+
}
35+
36+
build.dependsOn copyArtifact

0 commit comments

Comments
 (0)