kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
171 stars 57 forks source link

How to midify assembleDIST task? #404

Open ThomasDaheim opened 5 years ago

ThomasDaheim commented 5 years ago

Since I now have a working version of run and debug tasks thanksto https://github.com/kelemen/netbeans-gradle-project/issues/403 I would now need to extend the assembleDist task as well. In ordr to run my project under windows I need something like

:execute
@rem Setup the command line

@rem: add all jars under lib at once to avoid endless long classpath
set CLASSPATH=%APP_HOME%"\lib\*"

@rem Execute GPXEditor
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GPX_EDITOR_OPTS% -classpath "%CLASSPATH%" --module-path %PATH_TO_FX% --add-modules=javafx.controls,javafx.graphics,javafx.base,javafx.fxml,javafx.web,javafx.swing --add-exports=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.util=ALL-UNNAMED --add-exports=javafx.base/com.sun.javafx.reflect=ALL-UNNAMED --add-exports=javafx.base/com.sun.javafx.beans=ALL-UNNAMED --add-exports=javafx.base/com.sun.javafx.collections=ALL-UNNAMED --add-exports=javafx.base/com.sun.javafx.logging=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.prism=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED --add-exports=javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED --add-exports=javafx.media/com.sun.media.jfxmedia.events=ALL-UNNAMED --add-exports=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.scene.traversal=ALL-UNNAMED tf.gpx.edit.main.GPXEditorManager %CMD_LINE_ARGS%

So I need to change two things in the .bat file:

  1. set CLASSPATH=%APP_HOME%"\lib\*" - otherwise the line gets to long for cmd processing
  2. add all the --module-path, --add-modules, --add-exports that I have added to the run and debug tasks here as well

How would I go ahead and do that in build.gradle?

kelemen commented 5 years ago

The application plugin does it by creating a startScripts task which can be completely customized. Its API doc has an example on how to create such a task (completely customizable). Then you can just depend on it and configure your distribution to put those script files into the archives.

ThomasDaheim commented 5 years ago

Thanks, will have to play around with this a bit.