make launch4j work from gradle

This commit is contained in:
Anton Keks 2018-11-21 23:17:38 +02:00
parent deef81e501
commit e301f0ebf0
2 changed files with 30 additions and 12 deletions

View File

@ -32,7 +32,7 @@ dependencies {
testCompile 'org.mockito:mockito-core:2.23.0'
}
def packageTask(def platform, def moreJars, def moreLibs) {
def packageTask(def platform, def moreJars, def moreLibs, Closure doMore) {
return tasks.create(platform, Jar) {
manifest {
attributes 'Implementation-Title': 'Angry IP Scanner',
@ -102,14 +102,32 @@ def packageTask(def platform, def moreJars, def moreLibs) {
'org/eclipse/swt/awt/**'
)
with jar
doLast(doMore)
}
}
packageTask('linux', [], 'ext/rocksaw/lib/linux/librocksaw.so')
packageTask('linux64', [], 'ext/rocksaw/lib/linux64/librocksaw64.so')
packageTask('win32', 'lib/jna-win32.jar', 'ext/rocksaw/lib/rocksaw.dll')
packageTask('win64', 'lib/jna-win64.jar', [])
packageTask('mac', [], [])
def launch4j(def platform) {
ant.taskdef(name: 'launch4j', classname: 'net.sf.launch4j.ant.Launch4jTask', classpath: 'ext/launch4j/launch4j.jar:ext/launch4j/xstream.jar')
def configFile = "build/libs/launch4j-${platform}.xml"
ant.copy(file: "ext/launch4j/ipscan.xml", tofile: configFile)
ant.replace(file: configFile) {
ant.replacefilter(token: "BASENAME", value: "${project.name}-${platform}-${version}")
ant.replacefilter(token: "VERSION", value: version)
}
ant.launch4j(configFile: configFile)
}
packageTask('linux', [], 'ext/rocksaw/lib/linux/librocksaw.so') {}
packageTask('linux64', [], 'ext/rocksaw/lib/linux64/librocksaw64.so') {}
packageTask('win32', 'lib/jna-win32.jar', 'ext/rocksaw/lib/rocksaw.dll') { launch4j('win32') }
packageTask('win64', 'lib/jna-win64.jar', []) { launch4j('win64') }
packageTask('mac', [], []) {}
//task 'win-installer'
task all(dependsOn: ['linux', 'linux64', 'win32', 'win64', 'mac'])

View File

@ -1,16 +1,16 @@
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>FILENAME_IN</jar>
<outfile>FILENAME_OUT</outfile>
<jar>BASENAME.jar</jar>
<outfile>BASENAME.exe</outfile>
<errTitle>Angry IP Scanner</errTitle>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl>http://www.angryip.org/</supportUrl>
<supportUrl>https://angryip.org/</supportUrl>
<customProcName>true</customProcName>
<stayAlive>false</stayAlive>
<manifest>../ext/launch4j/ipscan.manifest</manifest>
<icon>../resources/images/icon.ico</icon>
<manifest>../../ext/launch4j/ipscan.manifest</manifest>
<icon>../../resources/images/icon.ico</icon>
<jre>
<minVersion>1.7.0</minVersion>
</jre>
@ -19,7 +19,7 @@
<txtFileVersion>VERSION</txtFileVersion>
<fileDescription>Angry IP Scanner - fast and friendly network scanner</fileDescription>
<copyright>Anton Keks</copyright>
<productVersion>3.2.0.0</productVersion>
<productVersion>3.5.0.0</productVersion>
<txtProductVersion>VERSION</txtProductVersion>
<productName>Angry IP Scanner</productName>
<internalName>ipscan</internalName>