Commit 06884dd3 authored by Drahomír Karchňák's avatar Drahomír Karchňák

#755 Rewritten whole desktop version building script into gradle build script.

parent 50eeef76
......@@ -163,43 +163,79 @@ def download(String remoteUrl, String localUrl) {
}
}
//Creates release .exe file in desktop/build/bin
task createReleaseExe(dependsOn: releaseJar, type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
task releaseExe(dependsOn: releaseJar, type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
outfile = 'Tablexia.exe'
def jreFileName = '/jre.tar.gz'
doFirst {
def jreFileName = '/jre.tar.gz'
//TODO - Don't download JRE on every build??
//TODO - Building without internet connection (Providing JRE manually)
//Download JRE
download(project.property('TABLEXIA_JRE_DOWNLOAD_MIRROR'), project.buildDir.absolutePath + jreFileName)
//TODO - Don't download JRE on every build??
//TODO - Building without internet connection (Providing JRE manually)
//Download JRE
download(project.property('TABLEXIA_JRE_DOWNLOAD_MIRROR'), project.buildDir.absolutePath + jreFileName)
//Byte buffer to store stdout
def stdout = new ByteArrayOutputStream()
//Byte buffer to store stdout
def stdout = new ByteArrayOutputStream()
//Extract JRE to desktop/build/
exec {
commandLine 'tar', '-xf', project.buildDir.absolutePath + jreFileName, '-C', project.buildDir.absolutePath
standardOutput = stdout
//Extract JRE to desktop/build/
exec {
commandLine 'tar', '-xf', project.buildDir.absolutePath + jreFileName, '-C', project.buildDir.absolutePath
standardOutput = stdout
}
//print output of previous exec command
def output = stdout.toString().trim()
if(!output.isEmpty()) println output
}
//print output of previous exec command
println stdout.toString().trim()
}
doLast {
println "Create temporary folder for installer files"
def installerDir = new File(project.buildDir.absolutePath + '/installer')
if(installerDir.exists()) installerDir.mkdir()
println "Copying jre/ folder to temporary installer folder"
copy {
from project.buildDir.absolutePath + '/jre'
into installerDir.absolutePath + '/jre'
}
//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()
println "Copying bin/ folder to temporary installer folder"
copy {
from project.buildDir.absolutePath + '/bin'
into installerDir.absolutePath + '/bin'
}
//Launch create_installer.sh script, which uses nsis to create installer for Tablexia.exe
exec {
commandLine 'sh', 'create_installer.sh'
standardOutput = stdout
}
println "Copying icon folder to temporary installer folder"
copy {
from project.projectDir.absolutePath + '/assets/icons/desktop_icon_128.png.ico'
into installerDir.absolutePath + '/logo.ico'
}
def stdout = new ByteArrayOutputStream()
//Launch makensis
exec {
commandLine 'makensis', 'installer_script.nsi'
standardOutput = stdout
}
//print output of previous exec ommand
println stdout.toString().trim()
//print output of previous exec command
def output = stdout.toString().trim()
if(!output.isEmpty()) println output
println "Creating outputs folder"
def outputsFile = new File(project.buildDir.absolutePath + '/outputs/')
if(!outputsFile.exists()) outputsFile.mkdir();
println "Moving built .exe installer to outputs folder"
copy {
from project.buildDir.absolutePath + '/bin/TablexiaSetup.exe'
into new File(outputsFile, tablexiaAppName + '-release-' + tablexiaVersionName + '-Setup.exe')
}
println "Deleting temporary installer folder"
outputsFile.deleteDir()
}
}
debugJar.dependsOn classes
......
#!/bin/bash
# prepare temp folder
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 &&
#run script
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