Changes the behavior of goal idea to create a subdirectory named for the project name.

Review Request #1019 — Created Sept. 11, 2014 and submitted

zundel
pants
zundel/idea-project-dir-fix
564, 571
d7c9603...
pants-reviews
ity, jsirois

IntelliJ will fail to load the first time if you change the name and try to write the project into
the same directory as an existing project.

Also, enhanced the integration check to examine the contents of the project file when launching "hello"

Manually confirmed the error "Cannot load module file '/Users/zundel/Development/java/squarepants/idea/foo4568.iml':
File /Users/zundel/Development/java/squarepants/idea/foo4568.iml does not exist
Would you like to remove module 'foo4568' from the project?"

does not occur any more when you change the project name.

ZU
  1. 
      
  2. Before:

    --idea-project-dir=/tmp/foo --idea-project-name=bar

    /tmp/foo/bar.ipr
    /tmp/foo/bar.iml

    After this change makes your project show up under:

    /tmp/foo/bar/bar.ipr
    /tmp/foo/bar/bar/iml

    Besides the fact that intelliJ was failing if you changed --idea-project-name in the first case, I think this makes sense as there are a bunch of auxilliary files created in the same directory.

    One thing to look out for: This change is at the 'ide_gen' level so will also impact other IDEs besides IntelliJ. I can go back and try to make it IntelliJ specific, but that would be hairy: in the default case when you don't specify --idea-project-dir it already tacks on the project name...

    1. Interestingly, this works fine:

      $ ./pants goal idea testprojects/:: examples/:: --no-pantsrc --idea-project-dir=idea-project-dir --idea-project-name=a --no-idea-open
      $ ./pants goal idea testprojects/:: examples/:: --no-pantsrc --idea-project-dir=idea-project-dir --idea-project-name=b --no-idea-open
      $ ./pants goal idea testprojects/:: examples/:: --no-pantsrc --idea-project-dir=idea-project-dir --idea-project-name=c --no-idea-open
      $ open idea-project-dir/a.ipr
      $ open idea-project-dir/b.ipr
      $ open idea-project-dir/c.ipr
      

      Nevertheless, the libs dirs are shared / over-written which is a non-starter so this fix is needed anyhow:

      $ ls idea-project-dir/
      a.iml  a.ipr  a.iws  b.iml  b.ipr  c.iml  c.ipr  external-libjavadoc  external-libs  external-libsources  internal-libs  internal-libsources  out
      
  3. 
      
JS
  1. 
      
  2. Perhaps "Always tack on the project name to the work dir so each project gets its own linked jars, etc." since that issue is even more fundamental.

  3. This would be a good use of a defaulted kwarg in the method signature.

  4. 
      
ZU
ZU
Review request changed

Status: Closed (submitted)

Change Summary:

commit ba650cc
Loading...