To easily conditionalize some execution behavior, I can do the following

   tasks.run {
        if(findProperty('JviDebugSettings')) {
            systemProperties['com.raelity.jvi.DEBUG'] = 'true'
            enableAssertions = true
        }
   }

and then in NetBeans' BuildActions can add "-PJviDebugSettings[=x]". But I'll probably find it easier to put this into gradle.properties myself considering the large number of NetBeans actions that would want this property. I tried various combinations of setting the property and coercing findProperty(), for example

   JviDebugSettings=true
   if(findProperty('JviDebugSettings') as boolean) {

but didn't find an obvious way to use a value for the property to set meaningful true/false. (so back to old "C" style #ifdef mindset)

BTW, it's interesting how NB saves these actions in gradle.properties.

-ernie

On 9/6/22 8:04 AM, László Kishalmi wrote:
Actually we have a pretty good UI for custom actions. Though passing JVM arguments to a build is a sensitive topic mostly due to the daemon execution model.

The way you set up the run task in your project is a good way to do that.

On Tue, Sep 6, 2022 at 4:10 AM Neil C Smith <neilcsm...@apache.org> wrote:

    On Mon, 5 Sept 2022 at 19:56, Ernie Rael <err...@raelity.com> wrote:
    >
    > On 9/4/22 4:47 PM, Ernie Rael wrote:
    > > Just converted an ancient project from ant to gradle. With ant
    and I did
    > >
    > > project.properties:run.jvmargs=-Dcom.raelity.jvi.DEBUG\=true -ea
    > >
    > > With gradle I tried, on the "Main Project"
    >
    > I was hoping to find a way to *do it from NetBeans*,
    >
    > but the following in build.gradle works for now
    >
    >     tasks.run {
    >          systemProperties['com.raelity.jvi.DEBUG'] = 'true'
    >          enableAssertions = true
    >     }
    >

    I guess similar to Maven support, Run Gradle / Tasks ... then remember
    as?  If you can work out the syntax.

    Not sure if I've missed it, but Gradle doesn't seem to have a way to
    add (not edit) custom actions in the project properties UI?

    Neil

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
    For additional commands, e-mail: users-h...@netbeans.apache.org

    For further information about the NetBeans mailing lists, visit:
    https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to