crotwell / gradle-macappbundle Goto Github PK
View Code? Open in Web Editor NEWA Gradle Plugin to create a Mac OSX .app application and dmg based on the project.
License: Apache License 2.0
A Gradle Plugin to create a Mac OSX .app application and dmg based on the project.
License: Apache License 2.0
Hi Crotwell,
When I try to enable backgroundImage (to have /Application link) the macAppBundle task fails on osascript with the following error:
> Problem running applescript to set dmg background image: 1 335:336: syntax error: Expected „,” or „}”, but found „:”. (-2741)
I was able to dump what is being sent to osascript:
tell application "Finder"
tell disk "example-1.0.1"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to { 0, 0, pixelWidth:, pixelHeight: }
set the position of the container window to {400, 100}
set viewOptions to the icon view options of container window
set arrangement of viewOptions to not arranged
set icon size of viewOptions to 72
set background picture of viewOptions to file ".background:dmg-bg.png"
set position of item "Example.app" of container window to { 160, 205 }
set position of item "Applications" of container window to { 360, 205 }
close
open
update without registering applications
delay 2
end tell
end tell
Apparently, the invocation of sips in MacAppBundlePlugin#createCopyBackgroundImageTask may return unexpected number of separators and tokenize()[2] may hit at wrong fragment resulting in "pixelWidth:" and "pixelHeight:" being sent to osascript. This will happen when the project is on the path which contains spaces (for example: /Users/doe/my projects/project) and the image path given to sips is also printed and it interferes with tokenizer.
I would suggest to replace:
imageWidth = imageWidth.tokenize()[2];
with:
imageWidth = imageWidth.tokenize().last();
if you still want to use tokonize for it.
Pull request provided.
Versions:
I'm not able to configure the properties using Gradle 1.4. I also tried 1.3 and
1.2, with similar results. Is there a specific version of Gradle I should be
using, or is there an error in my script?
What steps will reproduce the problem?
apply plugin: 'java'
sourceCompatibility = 1.6
version = '0.1'
dependencies {
compile fileTree(dir: 'lib', include: '**/*.jar')
runtime fileTree(dir: 'lib', include: '**/*.jar')
}
jar {
manifest {
attributes 'Implementation-Title': 'TestSketch',
'Implementation-Version': version
}
}
apply plugin: 'macAppBundle'
macAppBundle {
appName = "TestApp"
mainClassName = "gui.TestSketch"
}
buildscript {
repositories {
ivy {
artifactPattern 'http://gradle-macappbundle.googlecode.com/files/[module]-[revision]
.[ext]'
}
}
dependencies {
classpath 'edu.sc.seis:gradle-macappbundle:1.0.4'
}
}
What is the expected output? What do you see instead?
I expected to find a build/macApp/TestSketch.app file. Instead there is a
build/macApp/gridmon.app and nothing happens when I launch it. Here is the
build output:
Creating properties on demand (a.k.a. dynamic properties) has been deprecated
and is scheduled to be removed in Gradle 2.0. Please read
http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtensi
on.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "appName" on "root project 'gridmon'", value:
"TestApp".
:copyStub
Deprecated dynamic property: "dest" on "task ':copyStub'", value:
"/Users/tester1/dev/ja...".
Deprecated dynamic property: "outStream" on "task ':copyStub'", value:
"java.io.BufferedOutput...".
Deprecated dynamic property: "buf" on "task ':copyStub'", value: "[B@a62812d".
Deprecated dynamic property: "inStream" on "task ':copyStub'", value:
"sun.net.www.protocol.j...".
What version of the product are you using? On what operating system?
1.0.4, tried with Gradle 1.2, 1.3 and 1.4.
Original issue reported on code.google.com by [email protected]
on 4 Feb 2013 at 7:39
Since this is so important now for OSX 10.8, it would be nice if this plugin
supported it. We need to:
1. Rename JavaApplicationStub to the name of the .app
2. Take a key from the keystore and sign the app
Original issue reported on code.google.com by [email protected]
on 10 Sep 2012 at 6:20
I am trying to bundle a JavaFX application for macOS using JDK 10, Gradle 4.6.0 and plugin version 2.2.1.
When bundleJRE = false
, everything seems to work and I can start the app (because JDK 10 is installed locally). When set to true
, the JDK doesn't seem to be bundled to the app unfortunately, so starting the app results in a JRELoadError
.
The corresponding directory in the app bundle is empty:
What am I missing here?
The following deprecation warning is generated with Gradle 4.0-rc-1:
Using a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
at edu.sc.seis.macAppBundle.MacAppBundlePlugin.apply(MacAppBundlePlugin.groovy:84)
at edu.sc.seis.macAppBundle.MacAppBundlePlugin.apply(MacAppBundlePlugin.groovy)
Output above is generated with --stacktrace
option, grepping the stacktrace elements on edu
.
Otherwise the given location is the place in build.gradle
where the plugin is applied.
A recursive task search in plugin.apply causes early evaluation of subprojects.
I was having an issue in a multiproject build where a subproject's app was not copying lib jars into the .app.
Finally, I tracked down the cause. The following block in MacAppBundle.groovy needs to be put inside a project.afterEvaluate
block:
if (Os.isFamily(Os.FAMILY_MAC)) {
project.getTasksByName("assemble", true).each{ t -> t.dependsOn(dmgTask) }
} else {
project.getTasksByName("assemble", true).each{ t -> t.dependsOn(zipTask) }
}
Putting this inside an afterEvaluate
solved all my problems. I guess the recursive task search forces an early evaluation of subprojects. Then when addCopyToLibTask()
is called this block doesn't get called in the subproject since its already evaluated.
project.afterEvaluate {
task.with configureDistSpec(project)
}
My solution feels like more of a workaround though. Shouldn't gradle execute project.afterEvaluate
blocks for projects that were already evaluated before? I did a lot of testing and it seems that afterEvaluate
must be called before the project is evaluated...
when using gradle/macappbundle together with continuous integration tools like
Jenkins it is preferred to use a custom keychain instead of the default.
the codesign documentation specifies an additional parameter (--keychain) to
allow that.
Is it possible to add that extra parameter to the macappbundle plugin?
Thanks
Marcin
Original issue reported on code.google.com by [email protected]
on 2 Oct 2012 at 12:42
1. configure macAppBunder with
javaExtras.put("StartOnMainThread", true)
2. generate plist
I expect the output to be
<key>StartOnMainThread</key>
<true/>
instead I see
<key>StartOnMainThread</key>
<string>true</string>
I'm using the latest build from maven on mac os x 10.9 with gradle 1.8
doValue(...) in GenerateInfoPlistTask.groovy turns everything into a <string>
element, and shouldn't. If I really want a string, I can make it a string
myself.
Original issue reported on code.google.com by [email protected]
on 14 Nov 2013 at 12:58
This is missing in the Info.plist file:
<key>NSHighResolutionCapable</key>
<string>True</string>
Alternative would be to be able to specify arbitrary key value pairs for the
generated plist file.
Original issue reported on code.google.com by [email protected]
on 26 Mar 2015 at 8:28
I'm using gradle-macappbundle at Windows 8 by issuing gradlew createMacApp.
The result includes a JavaApplicationStub, which is non-executable. Is it
possible to include a target createMacAppZip, where all the files are
compressed and the right permissions are set?
I think,
http://gradle.org/docs/current/dsl/org.gradle.api.tasks.bundling.Zip.html could
be a starting point. There is the property "fileMode".
Original issue reported on code.google.com by [email protected]
on 12 Jan 2013 at 12:14
[deleted issue]
I added a correct icon set in my resources.. but it doesn't seem to load it in
the app.
it is defined the way it is described by the wikipage.
Original issue reported on code.google.com by maescool
on 24 Mar 2012 at 3:36
I'm trying to upgrade to version 1.0.8 and I'm getting the following build
output:
* What went wrong:
A problem occurred configuring project ':ChessCrafterDesktop'.
> Could not resolve all dependencies for configuration
':ChessCrafterDesktop:classpath'.
> Could not find edu.sc.seis:gradle-macappbundle:1.0.8.
Required by:
chess:ChessCrafterDesktop:unspecified
My build.gradle file is as follows:
-------------------------------------------------
apply plugin: 'java'
sourceCompatibility = 1.6
version = '1.0'
sourceSets.main {
java {
srcDirs = ['src']
}
resources {
srcDir 'resources'
}
}
repositories {
mavenCentral()
}
dependencies {
compile project(':ChessCrafterShared')
compile group: 'com.google.guava', name: 'guava', version: '15.0'
}
jar {
manifest.attributes("Main-Class": "gui.Driver", "provider": "gradle")
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
apply plugin: 'macAppBundle'
macAppBundle {
mainClassName = "gui.Driver"
appName = "Chess Crafter"
}
buildscript {
repositories {
ivy {
artifactPattern 'http://gradle-macappbundle.googlecode.com/files/[module]-[revision].[ext]'
}
}
dependencies {
classpath 'edu.sc.seis:gradle-macappbundle:1.0.8'
}
}
-------------------------------------------------
Everything works fine if I use 1.0.4 as the classpath, but I'd like to upgrade
to the latest version
Original issue reported on code.google.com by drewhannay
on 13 Oct 2013 at 7:29
Trying to codeSign our app with the following:
jar {
manifest {
attributes 'Implementation-Title': 'MyApp.Server',
'Main-Class': 'com.squareup.myapp.Server'
}
}
macAppBundle {
certIdentity="MyApp"
bundleExecutable = "${->project.name}"
codeSignCmd='codesign'
mainClassName = 'com.squareup.myapp.Server'
bundleJRE = true
icon = 'resources/bus.icns'
appName = 'MyApp'
}
codeSign fails, returning 1. The command line executed is:
codesign -s MyApp -f
/Users/ray/Development/square/comms/socketbus/build/macApp/MhyApp.app
If we run that command line manually and add --deep, the app is signed as
expected and codesign returns 0
Original issue reported on code.google.com by [email protected]
on 30 Jan 2015 at 7:35
The Configuration section of the Intro page has a link to MacAppBundlePluginExtension at https://github.com/crotwell/gradle-macappbundle/source/browse/src/main/groovy/edu/sc/seis/gradle/macAppBundle/MacAppBundlePluginExtension.groovy . However, this results in a 404 error.
I believe that it is intending to point to https://github.com/crotwell/gradle-macappbundle/blob/master/src/main/groovy/edu/sc/seis/macAppBundle/MacAppBundlePluginExtension.groovy
Proper way to throw a gradle exception
Original issue reported on code.google.com by [email protected]
on 5 Oct 2012 at 6:04
Attachments:
I see that support for CFBundleShortVersionString
has been added to the code base, but no new plugin version has been released with this support. Could we get a new release?
Instructions are laid out at http://plugins.gradle.org/submit
Suggested values for the gradle-plugin attribute parts:
- id: com.google.code.macappbundle
- group: edu.sc.seis.gradle
- artifact: macappbundle
The `shadow` plugin uses the `com.jfrog.bintray` plugin to automate the upload,
as shown in
https://github.com/johnrengelman/shadow/blob/master/gradle/publish.gradle
You can sync with Sonatype's repo once a package has been published to Bintray.
Original issue reported on code.google.com by [email protected]
on 18 Jul 2014 at 10:40
CFBundleIdentifier
is currently hardcoded to mainClassName
.
I'd suggest to add a bundleIdentifier
property to MacAppBundlePluginExtension
and use that if configured, with mainClassName
being the fallback.
This is a nice plugin, but we need to customise the plist beyond what you have
hooks for. Is there a way to do that? Or can we substitute our own plist file?
Original issue reported on code.google.com by [email protected]
on 7 Sep 2012 at 4:05
What steps will reproduce the problem?
1. setup macosx plugin with outputDir = 'distributions/macosx'
2. run gradle target which produces dmg
What is the expected output? What do you see instead?
the .app is located in '${buildDir}/distributions/macosx' folder,
the .dmg is created in '${buildDir}/distributions' folder
I'd expect both product to be created in the outputDir
What version of the product are you using? On what operating system?
1.0.7
Original issue reported on code.google.com by [email protected]
on 1 Oct 2012 at 11:14
I want to build both the jre-bundled and non-bundled version of my app in single build command. Now, it seems I need to edit the bundleJRE
before triggering new builds.
One of my projects already provides the Info.plist
file as a static resource. Instead of generating it, would it be possible to expose a property in the extension that can be assigned by the user and bypasses the dictionary file generation?
What steps will reproduce the problem?
1. run 'gradle createApp'
2. delete the created product
3. run 'gradle createApp' again
What is the expected output? What do you see instead?
The result application doesn't get the MacOS/JavaApplication component added.
seems like the task is not verifying its outputs correctly, as in the console I
can see
:copyStub UP-TO-DATE
What version of the product are you using? On what operating system?
plugin 1.0.7, gradle 1.2, OSX 10.8.2
Original issue reported on code.google.com by [email protected]
on 9 Oct 2012 at 12:11
When running ./gradlew clean build -p mymodule
I'm getting
* What went wrong:
Execution failed for task ':mymodule:createDmg'.
> execCommand == null!
I'm using Gradle 3.3 and 2.1.6 of this plugin.
Hi,
I wanted to add -Xmx4g to the Info.plist in the JVMOptions section, but it gets put in in the wrong format, causing the app to crash. Maybe I’m doing something wrong, but the javaExtras.put takes key value pairs so it doesn’t work if it put the single -Xmx4g flag and if I try something like “-Xmx”, “4g”, it crashes because it doesn’t like the resulting “-Xmx=4g” that it puts in the file. If I manually edit the Info.plist value to remove the “=“, it works. How do I add just that one flag to the file?
Thanks,
Rob
I want create a dmg for drag app to the Applications dir,how can I do for this?
Thanks very much.
Is there a way I can pass the memory settings for the dmg that is created?
This is a nice to have. I have figured out a workaround for now.
The JavaAppLauncher does not load a splash screen as specified by the SplashScreen-Image attribute in the main jar. I am able to get it to load by copying the splash image into the app folder and then updating the Info.plist properties as follows:
<key>JVMOptions</key>
<array>
<string>-splash:$APP_ROOT/Contents/Java/splash.png</string>
...
</array>
This works, and for now I will add a task to modify the plist after it has been generated, but it would be convenient if there was a way of adding this option ahead of time. Right now it looks like the only options you support this way are those that are of the form key=value which does not apply here.
From GenerateInfoPlistTask.groovy:
key('JVMOptions')
array() {
extension.javaProperties.each { k, v->
string("-D$k=$v")
}
extension.javaExtras.each { k, v->
string("$k=$v")
}
}
The reason I want a splash screen is because the bundled JRE seems to take a few seconds to initialize, and I'd prefer to have faster feedback for my users.
Thanks,
Matt
thanks for the job, i'm performing the task with android studio and jdk 1.8+ and i have this problem:
FAILURE: Build failed with an exception.
What went wrong:
Ambiguous method overloading for method java.io.File#.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.String]
[class java.net.URI]
Try:
Run with --info or --debug option to get more log output.
Exception is:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.io.File#.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.String]
[class java.net.URI]
at com.github.cr0.gradle.macAppBundle.MacAppBundlePluginExtension.getJREDirName(MacAppBundlePluginExtension.groovy:166)
at com.github.cr0.gradle.macAppBundle.MacAppBundlePluginExtension$getJREDirName$0.call(Unknown Source)
at com.github.cr0.gradle.macAppBundle.MacAppBundlePlugin$_createBundleJRETask_closure22.doCall(MacAppBundlePlugin.groovy:166)
at org.gradle.api.internal.file.FileOrUriNotationConverter.convert(FileOrUriNotationConverter.java:85)
at org.gradle.internal.typeconversion.NotationConverterToNotationParserAdapter.parseNotation(NotationConverterToNotationParserAdapter.java:30)
at org.gradle.internal.typeconversion.ErrorHandlingNotationParser.parseNotation(ErrorHandlingNotationParser.java:47)
at org.gradle.api.internal.file.AbstractFileResolver.convertObjectToFile(AbstractFileResolver.java:125)
at org.gradle.api.internal.file.AbstractBaseDirFileResolver.doResolve(AbstractBaseDirFileResolver.java:69)
at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:86)
at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:68)
at org.gradle.api.internal.file.copy.DestinationRootCopySpec.getDestinationDir(DestinationRootCopySpec.java:48)
at org.gradle.api.internal.file.copy.DestinationRootCopySpec_Decorated.getDestinationDir(Unknown Source)
at org.gradle.api.tasks.Sync.getDestinationDir(Sync.java:100)
at org.gradle.api.tasks.Sync_Decorated.getDestinationDir(Unknown Source)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.TaskPropertyInfo$4.create(TaskPropertyInfo.java:99)
at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:217)
at org.gradle.api.internal.project.taskfactory.TaskPropertyInfo.getValue(TaskPropertyInfo.java:97)
at org.gradle.api.internal.project.taskfactory.TaskClassValidator$FutureValue.call(TaskClassValidator.java:65)
at org.gradle.util.GUtil.uncheckedCall(GUtil.java:432)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:125)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:94)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext.java:161)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:111)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:94)
at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:172)
at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:55)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:68)
at com.google.common.collect.Iterables$8.iterator(Iterables.java:713)
at com.google.common.collect.Sets.newHashSet(Sets.java:219)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.canonicalizedPaths(DefaultTaskExecutionPlan.java:709)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.getOutputPaths(DefaultTaskExecutionPlan.java:785)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.recordTaskStarted(DefaultTaskExecutionPlan.java:815)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.access$2700(DefaultTaskExecutionPlan.java:91)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan$9.transform(DefaultTaskExecutionPlan.java:601)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan$9.transform(DefaultTaskExecutionPlan.java:590)
at org.gradle.internal.resources.DefaultResourceLockCoordinationService.withStateLock(DefaultResourceLockCoordinationService.java:45)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.selectNextTask(DefaultTaskExecutionPlan.java:590)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.access$2300(DefaultTaskExecutionPlan.java:91)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan$8.transform(DefaultTaskExecutionPlan.java:564)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan$8.transform(DefaultTaskExecutionPlan.java:545)
at org.gradle.internal.resources.DefaultResourceLockCoordinationService.withStateLock(DefaultResourceLockCoordinationService.java:45)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:545)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Get more help at https://help.gradle.org
BUILD FAILED in 0s
when doing createDmg i get this exception (i filtered this out of it)
Caused by: java.io.InvalidClassException:
edu.sc.seis.gradle.macAppBundle.MacAppBundlePluginExtension; local class
incompatible: stream classdesc serialVersionUID = 680222416952631697, local
class serialVersionUID = 2807445984896854523
1.0.3 build goes fine..
Original issue reported on code.google.com by maescool
on 24 Mar 2012 at 3:13
In 10.6, 10.7 and 10.8 this is where I found the file.
Original issue reported on code.google.com by [email protected]
on 5 Oct 2012 at 6:01
Attachments:
Rather than hardcoded background image size, you might like to get the real
image dimensions with this command line:
sips -g pixelHeight -g pixelWidth ${DMG_BACKGROUND_IMG}
and then parsing out the values you need from the output...
Original issue reported on code.google.com by [email protected]
on 16 Jun 2014 at 11:43
Hi,
i was trying to build an .app on linux, it builded it without any errors, but
when i zipped it and downloaded it to a mac, it refused to start the app..
I just wan't to know if this is on the todo-list to fix?
also createDmg required hdiutil, which doesn't exists for linux, but there are
workarrounds to make it, can this also be added?
thanks!
Original issue reported on code.google.com by maescool
on 25 Feb 2012 at 3:36
How do i set the title/name of the dmg?
now it is always "macApp"
Original issue reported on code.google.com by maescool
on 24 Mar 2012 at 3:37
I am using this plugin with Java 7. However, it seems like your plugin has been compiled with Java 8. I get the following error message:
java.lang.UnsupportedClassVersionError: edu/sc/seis/macAppBundle/MacBundlePlugin: Unsupported major.minor version 52.0
Would you mind producing a new version of the plugin by setting the source and target compatibility in your build.gradle
file so it can be used with Java 7?
sourceCompatibility = 1.7
targetCompatibility = 1.7
What steps will reproduce the problem?
1. multi-module project, using macappbundle in subprojects
3. subproject folder names do not match the app name.
What is the expected output? What do you see instead?
in Info.plist the key CFBundleName should be the same as appName
currently its ${project.name}, which for subprojects is simply name of the
subfolder.
What version of the product are you using? On what operating system?
using version 1.0.5
Original issue reported on code.google.com by [email protected]
on 27 Sep 2012 at 1:44
It is inconsistent that appOutputDir is a path fragment but icon and
backgroundImg is a full path. Let's just let the user put the files anywhere
they want and keep it consistent.
Original issue reported on code.google.com by [email protected]
on 5 Oct 2012 at 6:08
Attachments:
The gradle application plugin copies src/dist files into the distribution/lib folder. It's be really super nice if macappbundle did the same. Then we can distribute to Windows and Mac with the same src file structure. For now I need to create my own task to run after createApp to do so.
I do my builds on Mac OS X, but as I'm asking others to contribute to the project, their builds are failing on Windows and Linux. I've been telling them to comment out the plugin configuration lines, but there has to be a better way.
I'm sure there's already a way to do it by reconfiguring the existing Gradle tasks. If I find it, I'll share it here. It should certainly be documented.
This is the string that is displayed in Finder as version info. Would be great
if one could set it.
Original issue reported on code.google.com by [email protected]
on 26 Mar 2015 at 8:26
This is a feature request :)
To help apps get accepted into the Mac App Store and run as standalone provide
an option to bundle the JRE similar to how the Oracle Java App Bundler does.
Original issue reported on code.google.com by [email protected]
on 16 Dec 2013 at 11:29
Hello,
I have a build.gradle that probably isn't standard (it works, but I am fairly new to gradle). My app generates Android and iOS apps from a library of content. So it has a lot of related resources needed for it.
So I have a whole directory structure that needs to copied to the Java directory. The code expects these resources to be together:
/bin/scripture-app-builder.jar
/bin/lib/x86_64/.dylib
/fonts/ (custom fonts)
/html/* (template html files)
/images/icons/*
/info/* (localization strings)
/ios/* (template iOS App)
/lib/* (android libraries)
/tools/* (related tools needed for building android app -- gradle, maven)
How do I override what gets copied to the Java directory? The only thing that is getting copied now is "release.jar" and I don't think it is the correct thing.
Thanks,
Chris
I've added the following to my build.gradle
file:
plugins {
id "edu.sc.seis.macAppBundle" version "2.1.4"
}
macAppBundle {
mainClassName = "..."
icon = "myApp.icns"
volumeName = "myApp"
dmgName = "myApp"
javaProperties.put("apple.laf.useScreenMenuBar", "true")
// Uncomment the next line to bundle the JRE with the Mac OS X application
//bundleJRE = true
}
When I run a gradlew build
, all tasks from your bundle are run, except codeSign
, createAppZip
, runSetFile
.
I never specified it anywhere that any of the tasks are run. The problem is that on Windows a gradlew build
tries to run createDmg and fails (naturally).
Why are any MacAppBundle tasks run when doing a gradlew build
?
Is there a way that none of the MacAppBundle tasks are run for a gradlew build
?
First off, I love your gradle plugin. It works great for me. The only part I haven't figured out yet is the best way to hook in my proguard step which is generating obfuscated and optimized jars. My proguard task takes the jar output from the jar task and generates new jars, but your createApp task (configureDistSpec) reads the output of the jar task. Any suggestions on the best way to get createApp to use the output of my proguard task instead of the jar task? Is there a different way I should hook in my step?
I'm actually running createDmg, so alternatively I could modify the jar between createApp and createDmg if there's a good way to do that instead of running proguard before createApp.
I'm new to gradle, so I apologize if this is an obvious question.
Thanks!
-Matt
system properties are defined within
<key>java</key>
<dict>
...
<Properties>
currently the macappbundle plugin allows a single property to be set:
apple.laf.useScreenMenuBar
yet macappbundle plugin should allow adding any number of custom properties
like, either apple specific:
apple.awt.textantialiasing
apple.awt.showGrowBox
(http://developer.apple.com/library/mac/#documentation/Java/Reference/Java_Prope
rtiesRef/Articles/JavaSystemProperties.html)
or java specific like
JFileChooser.appBundleIsTraversable
JFileChooser.packageIsTraversable
...
or actually any custom properties
Original issue reported on code.google.com by [email protected]
on 2 Oct 2012 at 12:13
Add some todo items for things to be fixed.
Original issue reported on code.google.com by [email protected]
on 5 Oct 2012 at 3:24
Attachments:
Would you mind providing the license for this plugin as separate file checked into the repo e.g. LICENSE.txt
or as part of the README.md
file?
Hi crotwell.
I assemble Mac OS .app application and now trying to switch from ant bundler task to your gradle one. In the ant task i have the next settings, which i can't find in your implementation:
<target name="bundleMac" depends="cleanTarget, checkProperties">
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="${basedir}/lib/appbundler-1.0.jar"/>
<bundleapp >
<classpath file="${buildDir}/libs/BuildUberJar.jar"/>
<classpath file="${libDir}/lib.dylib"/>
<classpath file="${libDir}/license.txt"/>
<classpath file="${resDir}/${splashImagePath}"/>
this classpath
property copies files from build resources to Contents/Java
bundled directory and would be used by the application at runtime.
There are 2 problems i see:
Java
directory it puts all the dependencies jars.Content
directory also Resources
subdirectory exists with my '128.icns' and some default en.lproj/Localizable.strings
messages ("JRELoadError", "MainClassNameRequired", "JavaDirectoryNotFound"). Why it's absent in this gradle task?See the classpath
description in (AppBundler documentation)[https://java.net/downloads/appbundler/appbundler.html]
Thanks.
The createApp task works when bundleJRE = false. My program runs and loads.
However, when bundleJRE = true it does not. It opens an OS X Error Dialog saying JRELoadError.
I'm not sure how to start troubleshooting this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.