crotwell / gradle-macappbundle

A Gradle Plugin to create a Mac OSX .app application and dmg based on the project.
Apache License 2.0
95 stars 33 forks source link

Patch for /src/main/groovy/edu/sc/seis/gradle/macAppBundle/MacAppBundlePlugin.groovy #11

Closed GoogleCodeExporter closed 6 years ago

GoogleCodeExporter commented 9 years ago
Add some todo items for things to be fixed.

Original issue reported on code.google.com by aristede...@gmail.com on 5 Oct 2012 at 3:24

Attachments:

GoogleCodeExporter commented 9 years ago
I created this task using the google code online editing tool. Not nearly as 
nice as github.... So much easier to fork, comment and contribute over there.

Anyhow, there is some code cleanup you should consider:

1. you put too much stuff into doFirst
2. duplicate deletion of the dmg
3. ignore the dmg background completely
4. DMG is assembled in the same directory as the source files, causing an 
error. You need to use a temp directory

Also, why do you use "->project" everywhere? I am not familiar with that syntax.

Original comment by aristede...@gmail.com on 5 Oct 2012 at 3:41

GoogleCodeExporter commented 9 years ago
I will take a look at this patch in a bit. But the basic rational for both the 
doFirst and for the ->project syntax is to delay the evaluation of the 
variables until they are used. Otherwise any configuration the user does 
happens after the plugin is applied, meaning it has no effect. I do need to 
clean this up though as I have learned a few things about writing plugins since 
this code was written.

See this post for more info:
http://forums.gradle.org/gradle/topics/how_do_you_delay_configuration_of_a_task_
by_a_custom_plugin_using_the_extension_method

Original comment by crotwell@seis.sc.edu on 5 Oct 2012 at 1:48

GoogleCodeExporter commented 9 years ago
Maybe the problem is related to the way you instantiate the extension:

 MacAppBundlePluginExtension pluginExtension = new MacAppBundlePluginExtension()
project.extensions.macAppBundle = pluginExtension

should be

project.extensions.create("macAppBundle", MacAppBundlePluginExtension)

Currently you have a lot of inconsistency between what you put inside doFirst 
or what you use lazy gstrings for. I suspect that neither of those is hacks is 
really needed.

Original comment by a...@glebeschool.org.au on 8 Oct 2012 at 2:18

GoogleCodeExporter commented 9 years ago
The main thing here is the temp folder for assembly. Any change of merging that 
part?

Original comment by aristede...@gmail.com on 25 Oct 2012 at 10:33

GoogleCodeExporter commented 9 years ago

Can you tell me what the error is? It seems to work fine for me here.

Creating the DMG in another directory just to copy it to the output directory 
seems a waste unless it is really needed.

Original comment by crotwell@seis.sc.edu on 25 Oct 2012 at 12:51

GoogleCodeExporter commented 9 years ago
Sorry for the delay in responding. The issue happens when some problem causes 
the build to abort part way through. Then the next run will create an image 
with the previous image inside. Using a temp folder location is vastly safer 
and exactly what the temp folder is for. Since the temp folder is 99% of the 
time on the same disk, there is no "waste" and the move executes in 
milliseconds.

Original comment by aristede...@gmail.com on 1 Mar 2013 at 2:07

GoogleCodeExporter commented 9 years ago

Can you give me more information about the error? Gradle has pretty good up to 
date checks, and so if there are files that are wrong from a previous build, it 
sounds like I have missed something one of the task's inputs or outputs.

Perhaps using a temp folder would address this, but I would rather understand 
and fix the root cause instead of putting a band aide on it.

Original comment by crotwell@seis.sc.edu on 3 Mar 2013 at 3:23