External tool behaves differently in a run config

I'm trying to configure Idea to work with a simple helloJni project and I'm facing trouble. This morning, after realizing that Idea doesn't run the native compiler as part of its make process, I decided to add an external tool definition to assist in the development of my hellojni project. I configured an ndk-build tool definition as follows:

  <tool name="ndk-build" description="Native builder" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="true" showConsoleOnStdErr="true" synchronizeAfterRun="true">
    <exec>
      <option name="COMMAND" value="$USER_HOME$/android-ndk-r8b/ndk-build" />
      <option name="PARAMETERS" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>


This works just fine when run from the menu, however when I add it to a run configuration to fire just before the Cmd+F9 Make command I get erors in my console:
/Users/cliff/android-ndk-r8b/ndk-build
Android NDK: Your Android application project path contains spaces: '/Applications/Developer . 12.app'    
/Users/cliff/android-ndk-r8b/build/core/build-local.mk:137: *** Android NDK: Aborting.    .  Stop.
Android NDK: The Android NDK build cannot work here. Please move your project to a different location.    

Process finished with exit code 2
This makes no sense as my project is not located in a path with space, my project is located in: ~/dev/Android-Learning/hello-jni
The only thing I could imagine is that the external tool is somehow setting the working directory incorrectly or secrectly passing an extra parameter somewhere but I don't know how/why. Can somebody help?
4 comments
Comment actions Permalink

I've confirmed that Idea is overridding the working folder set on the external tool when launched as part of a run config. I've filed a bug report http://youtrack.jetbrains.com/issue/IDEA-98767 to reflect my discovery.

0
Comment actions Permalink

You can set the working dir to use in the run configuration. There is a "Working Directory" text field on the configuration tab. It defaults to the module directory (or what ever is set in the "Defaults" section). Try either blanking that out, or setting it to the necessary directory.

0
Comment actions Permalink

Thanks Mark, but I've already done that. If you look at the bug report I filed you will see the problem. The working directory is ignored when the external tool is run as part of a run configuration.

0
Comment actions Permalink

Wow, I'm just now noticing that the parameters are also ignored when running the tool as part of a run config! This is a pretty serious issue.

0

Please sign in to leave a comment.