crotwell / gradle-macappbundle

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

How to use with Proguard with createApp #27

Closed ketbra closed 9 years ago

ketbra commented 9 years ago

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

crotwell commented 9 years ago

You can certainly put a task in between those two tasks in Gradle by doing something like createDmg.dependsOn(copyProguardJarsToAppTask) copyProguardJarsToAppTask.dependsOn(proguardTask) proguardTask.dependsOn(createApp)

then you would just need to write the copy task to update the jars in the App from whereever proguard puts them.

Have a look at chapter 6 of the Gradle user guide: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:task_dependencies

I am going to close this issue, but let me know if you can't solve this without modifications to the plugin and I will revisit.

Good luck Philip

ketbra commented 9 years ago

That worked perfectly. Thank you!!!