Commit 8f6c8ede authored by Drahomír Karchňák's avatar Drahomír Karchňák

#755 Don't download jre if its already present.

parent 8230cfbb
......@@ -150,7 +150,10 @@ def runItest(String iTestName) {
***************************/
def download(String remoteUrl, String localUrl) {
new File("$localUrl").withOutputStream { out ->
File localFile = new File("$localUrl")
if(!localFile.exists()) localFile.createNewFile()
localFile.withOutputStream { out ->
new URL(remoteUrl).withInputStream { from -> out << from; }
}
}
......@@ -158,23 +161,27 @@ def download(String remoteUrl, String localUrl) {
task handleJreTask() {
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)
File jreFolder = new File(project.buildDir.absolutePath + '/jre/')
boolean forceJreDownload = project.hasProperty('TABLEXIA_JRE_FORCE_DOWNLOAD') ? project.property('TABLEXIA_JRE_FORCE_DOWNLOAD') : false;
if(!jreFolder.exists() || forceJreDownload) {
logger.lifecycle("Downloading JRE.")
//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
def output = stdout.toString().trim()
if(!output.isEmpty()) println output
}
}
/**
......
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