Commit 5a274d77 authored by Drahomír Karchňák's avatar Drahomír Karchňák

#755 Gradle now launches script, which uses nsis to create an installer.

parent c8b307a8
......@@ -162,18 +162,41 @@ def download(String remoteUrl, String localUrl) {
}
}
task releaseExe(dependsOn: releaseJar, type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
//Creates release .exe file in desktop/build/bin
task createReleaseExe(dependsOn: releaseJar, type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
outfile = 'Tablexia.exe'
def jreFileName = '/jre.tar.gz'
//Download JRE
download(project.property('TABLEXIA_JRE_DOWNLOAD_MIRROR'), project.buildDir.absolutePath + jreFileName)
//Byte buffer to store stdout
def stdout = new ByteArrayOutputStream()
//Extract JRE to desktop/build/
Runtime.getRuntime().exec(
'tar -xf ' + project.buildDir.absolutePath + jreFileName +
' -C ' + project.buildDir.absolutePath
)
exec {
commandLine 'tar', '-xf', project.buildDir.absolutePath + jreFileName, '-C', project.buildDir.absolutePath
standardOutput = stdout
}
outfile = 'Tablexia.exe'
//print output of previous exec command
println stdout.toString().trim()
}
//Takes .exe file in desktop/build/bin and create installer using nsis
task releaseExe(dependsOn: createReleaseExe) {
//Byte buffer to store stdout
def stdout = new ByteArrayOutputStream()
//Launch create_installer.sh script, which uses nsis to create installer for Tablexia.exe
exec {
commandLine 'sh', 'create_installer.sh'
standardOutput = stdout
}
//print output of previous exec ommand
println stdout.toString().trim()
}
debugJar.dependsOn classes
......
#!/bin/bash
# download and unzip jre to desktop/build/jre
# prepare temp folder
mkdir installer
mkdir -p installer
#copy files for installer
cp -r build/jre installer/
cp -r build/bin installer/
cp assets/icons/desktop_icon_128.png.ico installer/logo.ico
cp -r build/jre/ installer/ &&
cp -r build/bin/ installer/ &&
cp assets/icons/desktop_icon_128.png.ico installer/logo.ico &&
#run script
makensis installer_script.nsi
makensis installer_script.nsi &&
#clean
rm -rf installer
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment