-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,17 +41,31 @@ task unzip(type: Copy, description: 'Unzips the distribution to a temporary fold | |
} | ||
} | ||
|
||
task unzipFlatLib(type: Copy, description: 'Unzips the distribution to a temporary folder.') { | ||
from zipTree(file(configurations.app.iterator().next())) | ||
into file("${tempDir}") | ||
eachFile {details -> | ||
def targetPath = modifyPathFlatLib(details.path) | ||
details.path = targetPath | ||
} | ||
} | ||
|
||
task copyPlugins(type: Copy, dependsOn: 'unzip', description: 'Copies additional jars to the plugins folder (requires editing of build.gradle)') { | ||
from configurations.appPlugins | ||
into file("${appBase}/lib/plugins") | ||
} | ||
|
||
def modifyPath(def path) { | ||
def modified=path.replaceAll('\\Adotify-studio[^/]*(.+)', {"dotify-studio${it[1]}"}) | ||
println modified | ||
return modified | ||
} | ||
|
||
def modifyPathFlatLib(def path) { | ||
def modified=path.replaceAll('\\Adotify-studio[^/]*(.+)', {"dotify-studio${it[1]}"}) | ||
// Remove the 'lib' part of the path because the app.mainjar property of the cfg file that java packager generates cannot be set. | ||
return modified.replaceAll('\\Adotify-studio/lib/(.*)', {"dotify-studio/${it[1]}"}) | ||
} | ||
|
||
task copyIcon(type: Copy, dependsOn: 'unzip', description: 'Copies file icon to distribution.') { | ||
from ("${resourceDir}") { | ||
include 'favicon.ico' | ||
|
@@ -70,6 +84,10 @@ task deleteBin(type: Delete, dependsOn: 'unzip', description: 'Removes the bin f | |
delete "${appBase}/bin" | ||
} | ||
|
||
task deleteBinFlatLib(type: Delete, dependsOn: 'unzipFlatLib', description: 'Removes the bin folder from the distribution.') { | ||
delete "${appBase}/bin" | ||
} | ||
|
||
def launch4jManifest = file("$buildDir/launch4j.manifest") | ||
|
||
task createLaunch4jManifest(description: 'Creates the Launch4j manifest from a template.') { | ||
|
@@ -180,6 +198,89 @@ rpm { | |
postinst = 'chmod +x /usr/share/dotify-studio/bin/dotify-studio' | ||
} | ||
|
||
// Javapackager | ||
|
||
ant.taskdef (resource:'com/sun/javafx/tools/ant/antlib.xml', | ||
uri: 'javafx:com.sun.javafx.tools.ant', | ||
// JDK is required. Also, cannot use java.home because it might return the jre. | ||
classpath: System.getenv("JAVA_HOME") + '/lib/ant-javafx.jar' | ||
) | ||
|
||
def javaPackagerFolder = file('build/javapackager'); | ||
|
||
ext.runJavaPackager = { bundles, appIcon, appName -> | ||
String path = javaPackagerFolder.getAbsolutePath() | ||
|
||
ant { | ||
'javafx:com.sun.javafx.tools.ant:deploy'(outdir: path, outfile: 'dotify-studio', nativeBundles: bundles) { | ||
info(title: releaseName, description: appDescription, category: 'Office') { | ||
icon(href: appIcon) | ||
association( | ||
extension: 'pef', | ||
description: 'Portable embosser format', | ||
mimetype: 'application/x-pef+xml' | ||
) | ||
association( | ||
extension: 'obfl', | ||
description: 'Open braille formatting language', | ||
mimetype: 'application/x-obfl+xml' | ||
) | ||
} | ||
application( | ||
name: appName, | ||
mainClass: 'application.ui.MainFx', | ||
version: version | ||
) | ||
resources { | ||
fileset(dir: "${tempDir}/dotify-studio", includes: '**/*.*') | ||
} | ||
bundleArgument(arg: 'email', value: '[email protected]') | ||
bundleArgument(arg: 'win.menuGroup', value: releaseName) | ||
} | ||
} | ||
|
||
} | ||
|
||
task jpMsi(dependsOn: 'deleteBinFlatLib', description: 'Uses javapackager to create msi installer (experimental).') { | ||
doLast() { | ||
runJavaPackager('msi', file('ant-build/resources/app-icon.ico').getAbsolutePath(), 'dotify-studio') | ||
} | ||
outputs.dir javaPackagerFolder | ||
} | ||
|
||
task jpDeb(dependsOn: 'unzip', description: 'Uses javapackager to create deb installer (experimental).') { | ||
doLast() { | ||
runJavaPackager('deb', file('ant-build/resources/app-icon.png').getAbsolutePath(), releaseName) | ||
} | ||
outputs.dir javaPackagerFolder | ||
} | ||
|
||
task jpRpm(dependsOn: 'unzip', description: 'Uses javapackager to create rpm installer (experimental).') { | ||
doLast() { | ||
runJavaPackager('rpm', file('ant-build/resources/app-icon.png').getAbsolutePath(), releaseName) | ||
} | ||
outputs.dir javaPackagerFolder | ||
} | ||
|
||
task javapackager(dependsOn: 'unzip', description: 'Uses javapackager to create installers (experimental).') { | ||
doLast() { | ||
String path = file('build/javapackager').getAbsolutePath() | ||
String filename = 'dotify-studio' | ||
ant { | ||
'javafx:com.sun.javafx.tools.ant:deploy'(outdir: path, outfile: filename, nativeBundles: 'installer') { | ||
info(title: releaseName, description: appDescription) | ||
application( | ||
name: filename, | ||
mainClass: 'application.ui.MainFx', | ||
version: version | ||
) | ||
resources { | ||
fileset(dir: "${tempDir}/dotify-studio", includes: '**/*.*') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task wrapper(type: Wrapper, description: 'Refreshes the gradle wrapper') { | ||
gradleVersion = '3.5' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
version=0.10.0 | ||
version=0.10.1 | ||
releaseName=Dotify Studio | ||
appDescription=Creates, manages and embosses PEF-files |