Just chiming in on why Gradle doesn't allow you to set the working directory…

The JVM doesn't support changing the working directory mid process. It can be done with JNA/JNI (and Gradle does do this under certain circumstances), but it's problematic to use extensively. Regardless, relying on the working directory in any sense is inherently fragile.

Xavier Ducrohet <mailto:x...@android.com>
12 February 2014 4:57 am
We actually had a discussion about this recently.
The tooling api doesn't allow you to set the working dir so it's not possible.

Your build script really shouldn't make any assumption regarding the working directory.





--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!
--
You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Scott Barta <mailto:sba...@google.com>
12 February 2014 2:45 am
Is there some issue with your paths that it now can't find the command? Perhaps you should give it a fully-qualified path to the grunt executable. Also, do you have the same problems on all platforms?

When you execute Gradle tasks from Android Studio, it doesn't make an attempt to set the working directory, though I don't know that it's changed in recent versions -- that might also be something to investigate.



--
You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Matt Gaunt <mailto:matt.t.ga...@gmail.com>
12 February 2014 2:00 am
Hey everyone,

Since updating to 0.4, I've been able to run command line tools from gradle.

I used to have the following gradle build task:

|task buildWebApp(type:  Exec)  {
     executable=  Os.isFamily(Os.FAMILY_WINDOWS)  ?  "grunt.cmd"  :  "grunt"

     args=  ["build"]
}|

This would pick the appropriate grunt command and run it with the argument "build".

This worked without any kind of issue

In Android Studio 0.4, using Gradle 1.9 and it's no longer working. Instead I get the following error:

    Execution failed for task ':BrowserPages:buildWebApp'. A problem
    occurred starting process 'command 'grunt''

Normally at this point I would debug with gradlew, but running the following command, throws no errors:

    $ ./gradlew buildWebApp

I've also tried running the full task list to still not find any problems.

The way this is executed is from my main build.gradle file with this dependency

    copyWebApplication.dependsOn ':BrowserPages:buildWebApp'

Anyone have any ideas?

I've tried to run executable = "node" with arg = ["-v"] and get the same error where it can't find node. Node is globally accessible on my terminal, so I can only assume that the command is being run in a different environment to the terminal. There is the option for setting the environment on the task but I can't find any examples of how it should be used.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to