Commit 8fcfd3ed authored by Lukas Marik's avatar Lukas Marik

#782 generate plist for debug and release version

parent d91eb180
import edu.sc.seis.launch4j.tasks.Launch4jLibraryTask
import edu.sc.seis.macAppBundle.MacAppBundlePlugin
import groovy.io.FileType
import org.apache.tools.ant.filters.ReplaceTokens
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
......@@ -294,23 +294,24 @@ macAppBundle {
createDmg.enabled = false
createAppZip.enabled = false
task debugMac(dependsOn: createApp){
doLast{
setupMacApp('debug')
task debugMac(dependsOn: createApp) {
doLast {
setupMacApp('debug', applicationIdDebug)
}
}
task releaseMac(dependsOn: createApp){
doLast{
setupMacApp('release')
task releaseMac(dependsOn: createApp) {
doLast {
setupMacApp('release', applicationIdRelease)
}
}
def setupMacApp(String buildType){
def setupMacApp(String buildType, String applicationId) {
def appFolderName = project.tablexiaAppName + '-' + buildType + '-' + project.tablexiaVersionName + '.app'
def iconName = 'Tablexia_Icon_' + buildType + '.icns'
def outputDir = new File(project.buildDir.absolutePath + '/outputApp')
if(!outputDir.exists()){
if (!outputDir.exists()) {
// create output directory
outputDir.mkdir()
} else {
......@@ -327,12 +328,53 @@ def setupMacApp(String buildType){
// copy jar file to app
project.copy {
from project.buildDir.absolutePath + '/libs/' + project.tablexiaAppName + '-' + buildType + '-' + project.tablexiaVersionName + '.jar'
into project.buildDir.absolutePath+ '/outputApp/' + appFolderName + '/Contents/Java'
into project.buildDir.absolutePath + '/outputApp/' + appFolderName + '/Contents/Java'
}
//delete old plist
file(project.buildDir.absolutePath + '/outputApp/' + appFolderName + '/Contents/Info.plist').delete()
//set properties
updateMacProperties(buildType, applicationId, iconName)
//config plist
project.copy {
from 'macapp_plist.xml'
into project.buildDir.absolutePath + '/outputApp/' + appFolderName + '/Contents/'
rename'.*', 'Info.plist'
def myProps = new Properties()
file("macapp_prop.properties").withInputStream {
myProps.load(it);
}
filter(ReplaceTokens, tokens: myProps)
}
}
task cleanMacAppDir(){
doLast{
def updateMacProperties(String buildType, String applicationId, String iconName) {
Properties props = new Properties()
def propsFile = file('macapp_prop.properties')
if (!propsFile.exists()) {
propsFile.createNewFile();
}
props.load(propsFile.newDataInputStream())
props.setProperty('app.name', tablexiaAppName)
props.setProperty('app.icon', iconName)
props.setProperty('app.id', applicationId)
props.setProperty('app.mainclass', mainLauncherClassName)
props.setProperty('app.version', tablexiaModelVersionName)
props.setProperty('app.build', '' + tablexiaVersionCode)
props.setProperty('app.buildtype', buildType)
props.setProperty('app.executable', tablexiaAppName + '-' + buildType + '-' + tablexiaVersionName)
props.setProperty('app.sentryDSN', sentryDSNFallbackValue)
props.store(propsFile.newDataOutputStream(), '')
}
task cleanMacAppDir() {
doLast {
file(project.buildDir.absolutePath + "/macApp").deleteDir()
}
}
......@@ -356,7 +398,7 @@ iTestJar.dependsOn(':util:checksum:runChecksum')
cleanMacAppDir.dependsOn debugMac
cleanMacAppDir.dependsOn releaseMac
assemble.dependsOn([handleJreTask, debugJar, debugExe, debugMac, releaseJar, releaseExe, releaseMac, iTestJar, cleanMacAppDir])
assemble.dependsOn([handleJreTask, debugJar, /*debugExe,*/ debugMac, releaseJar, /*releaseExe,*/ releaseMac, iTestJar, cleanMacAppDir])
jar.enabled = false
eclipse {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>@app.name@</string>
<key>CFBundleExecutable</key>
<string>@app.executable@</string>
<key>CFBundleIconFile</key>
<string>@app.icon@</string>
<key>CFBundleIdentifier</key>
<string>@app.id@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>@app.name@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>@app.build</string>
<key>CFBundleShortVersionString</key>
<string>@app.version@</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@app.build@</string>
<key>cz.nic.tablexia.BuildType</key>
<string>@app.buildtype@</string>
<key>cz.nic.tablexia.SentryDSN</key>
<string>@app.sentryDSN@</string>
<key>JVMMainClassName</key>
<string>@app.mainclass@</string>
<key>JVMOptions</key>
<array />
<key>JVMArguments</key>
<array />
</dict>
</plist>
\ No newline at end of file
#
#Tue Dec 05 12:50:26 CET 2017
app.buildtype=release
app.version=3.5-41
app.mainclass=cz.nic.tablexia.desktop.DesktopLauncher
app.icon=Tablexia_Icon_release.icns
app.executable=Tablexia (feature-osx-desktop)-release-3.5-41
app.sentryDSN=None
app.build=1512060504
app.name=Tablexia (feature-osx-desktop)
app.id=cz.nic.tablexia.featureosxdesktop
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