Set different jvmArgs for window and linux run script

The application plugin provides solution for set java options by applicationDefaultJvmArgs. But in ouer case we need to use APP_HOME variable value to prepare absolute path for javaagent.

Unfortunately linux and windwos have a different syntax for access to variables. Is there a solution for set different applicationDefaultJvmArgs depends of platform? Maybe extending application plugin api of windowsApplicationDefaultJvmArgs, unitxApplicationDefaultJvmArgs will be acceptable?

Does anyone have an idea how we can do it? :slight_smile:

Can anybody help? This is a strong blocker for us.

I think, the best we can do is to move APP_HOME from https://github.com/gradle/gradle/blob/478a891a864c8749c194d42c52973cb1c8dfa8a7/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt#L65 to the top and place it after APP_BASE_NAME and then move DEFAUL_JVM_OPTS after all APP_* definitions.
We can do the same thing for Windows easy https://github.com/gradle/gradle/blob/478a891a864c8749c194d42c52973cb1c8dfa8a7/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/windowsStartScript.txt#L18
Then we could use APP_HOME in plugins that populates DEFAULT_JVM_OPTS, using one if for WIndows/Linux https://github.com/gradle/gradle/blob/478a891a864c8749c194d42c52973cb1c8dfa8a7/subprojects/plugins/src/main/java/org/gradle/api/internal/plugins/StartScriptTemplateBindingFactory.java#L66

You can provide your own start script templates to work around your isse. See the DSL guide for CreateStartScripts.

@kamilchm - How do you want use APP_HOME in DEFAULT_JVM_OPTS? Windows and Linux have different syntax for access varible.

@bmuschko - Yes. Of course we can provide own script template. But that will be a huge interference to application plugin. And can break plugins compatibility in the future. We are looking for more soft solution.

Not sure what you mean by “huge interference to application plugin”. Providing a custom template is part of the official public API and will not change “just like that”.