Skip to content

Commit

Permalink
Updates from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Håkansson committed Aug 21, 2018
2 parents 12a283f + 4fc45ae commit 7c51385
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
Binary file added ant-build/resources/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 102 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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.') {
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
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

0 comments on commit 7c51385

Please sign in to comment.