RFR 8210226: Add support for multiple project folders to idea.sh
Hi, this patch adds proper support for -o option to the idea.sh script, which allows to place the .idea folder under any given output folder (not necessarily the JDK root). To be able to do this, I had to revampo the logic for template substitution in idea.sh, as it was growing too brittle. I now have a much more declarative logic, where replacements can be added by calling the add_replacement function. This allows to replace a lot of the previous code with very simple and self-explanatory calls to that routine. This piece was necessary, as we needed to replace a lot of references to the idea variable $PROJECT_DIR with the new template variable ###ROOT_DIR### (otherwise the project is ill-formed, since $PROJECT_DIR merely points at the folder containing the .idea project folder). Webrev: http://cr.openjdk.java.net/~mcimadamore/8210226/ Cheers Maurizio
Looks good to me. /Erik On 2018-08-30 08:12, Maurizio Cimadamore wrote:
Hi, this patch adds proper support for -o option to the idea.sh script, which allows to place the .idea folder under any given output folder (not necessarily the JDK root).
To be able to do this, I had to revampo the logic for template substitution in idea.sh, as it was growing too brittle. I now have a much more declarative logic, where replacements can be added by calling the add_replacement function. This allows to replace a lot of the previous code with very simple and self-explanatory calls to that routine.
This piece was necessary, as we needed to replace a lot of references to the idea variable $PROJECT_DIR with the new template variable ###ROOT_DIR### (otherwise the project is ill-formed, since $PROJECT_DIR merely points at the folder containing the .idea project folder).
Webrev:
http://cr.openjdk.java.net/~mcimadamore/8210226/
Cheers Maurizio
On 2018-08-30 17:12, Maurizio Cimadamore wrote:
Hi, this patch adds proper support for -o option to the idea.sh script, which allows to place the .idea folder under any given output folder (not necessarily the JDK root).
To be able to do this, I had to revampo the logic for template substitution in idea.sh, as it was growing too brittle. I now have a much more declarative logic, where replacements can be added by calling the add_replacement function. This allows to replace a lot of the previous code with very simple and self-explanatory calls to that routine.
This piece was necessary, as we needed to replace a lot of references to the idea variable $PROJECT_DIR with the new template variable ###ROOT_DIR### (otherwise the project is ill-formed, since $PROJECT_DIR merely points at the folder containing the .idea project folder).
Webrev:
Looks good to me, with the caveat that I do not fully understand the idea project generator. /Magnus
Thanks for the reviews; once again, when doing some more testing I discovered some issues which had to do with coexistence with the intellij jtreg plugin. The bottom of the issue is that certain IDE owned ant variable (such as $ModuleFileDir$) are only set when clicking on certain IDE actions, but not on other. This leads to a very messy behavior, where certain times the IDE will fail to build the project if the build is triggered implicitly (e.g. upon running a jtreg test from the IDE). I now got rid of references to such variables and replaced it with references to a new IDEA_DIR template variable, whose addition in the idea.sh script is straighforward. To make sure that I got all bases covered, I tested in the following fashion 1) create a project for java.base and jdk.compiler module in the root folder - verify that source files belonging to either of the above modules can be opened inside the IDE - verify that jtreg tests can be run from the IDE (and that it triggers 'make images' correctly) - verify that the build/rebuild buttons of the IDE also work - check consistency of IDE setting by inspecting various menus (e.g. Project structure and Project settings) 2) create a project for java.desktop in a folder called desktop (e.g. using -o desktop), then check again: - verify that source files belonging to the java.desktop module can be opened inside the IDE - verify that jtreg tests can be run from the IDE (and that it triggers 'make images' correctly) - verify that the build/rebuild buttons of the IDE also work - check consistency of IDE setting by inspecting various menus (e.g. Project structure and Project settings) This all worked as expected. Webrev: http://cr.openjdk.java.net/~mcimadamore/8210226_v2/ Sorry for the review churn! Maurizio On 30/08/18 16:12, Maurizio Cimadamore wrote:
Hi, this patch adds proper support for -o option to the idea.sh script, which allows to place the .idea folder under any given output folder (not necessarily the JDK root).
To be able to do this, I had to revampo the logic for template substitution in idea.sh, as it was growing too brittle. I now have a much more declarative logic, where replacements can be added by calling the add_replacement function. This allows to replace a lot of the previous code with very simple and self-explanatory calls to that routine.
This piece was necessary, as we needed to replace a lot of references to the idea variable $PROJECT_DIR with the new template variable ###ROOT_DIR### (otherwise the project is ill-formed, since $PROJECT_DIR merely points at the folder containing the .idea project folder).
Webrev:
http://cr.openjdk.java.net/~mcimadamore/8210226/
Cheers Maurizio
Looks ok to me (and same caveat as Magnus). /Erik On 2018-08-31 06:59, Maurizio Cimadamore wrote:
Thanks for the reviews; once again, when doing some more testing I discovered some issues which had to do with coexistence with the intellij jtreg plugin.
The bottom of the issue is that certain IDE owned ant variable (such as $ModuleFileDir$) are only set when clicking on certain IDE actions, but not on other. This leads to a very messy behavior, where certain times the IDE will fail to build the project if the build is triggered implicitly (e.g. upon running a jtreg test from the IDE).
I now got rid of references to such variables and replaced it with references to a new IDEA_DIR template variable, whose addition in the idea.sh script is straighforward.
To make sure that I got all bases covered, I tested in the following fashion
1) create a project for java.base and jdk.compiler module in the root folder - verify that source files belonging to either of the above modules can be opened inside the IDE - verify that jtreg tests can be run from the IDE (and that it triggers 'make images' correctly) - verify that the build/rebuild buttons of the IDE also work - check consistency of IDE setting by inspecting various menus (e.g. Project structure and Project settings)
2) create a project for java.desktop in a folder called desktop (e.g. using -o desktop), then check again: - verify that source files belonging to the java.desktop module can be opened inside the IDE - verify that jtreg tests can be run from the IDE (and that it triggers 'make images' correctly) - verify that the build/rebuild buttons of the IDE also work - check consistency of IDE setting by inspecting various menus (e.g. Project structure and Project settings)
This all worked as expected.
Webrev:
http://cr.openjdk.java.net/~mcimadamore/8210226_v2/
Sorry for the review churn!
Maurizio
On 30/08/18 16:12, Maurizio Cimadamore wrote:
Hi, this patch adds proper support for -o option to the idea.sh script, which allows to place the .idea folder under any given output folder (not necessarily the JDK root).
To be able to do this, I had to revampo the logic for template substitution in idea.sh, as it was growing too brittle. I now have a much more declarative logic, where replacements can be added by calling the add_replacement function. This allows to replace a lot of the previous code with very simple and self-explanatory calls to that routine.
This piece was necessary, as we needed to replace a lot of references to the idea variable $PROJECT_DIR with the new template variable ###ROOT_DIR### (otherwise the project is ill-formed, since $PROJECT_DIR merely points at the folder containing the .idea project folder).
Webrev:
http://cr.openjdk.java.net/~mcimadamore/8210226/
Cheers Maurizio
participants (3)
-
Erik Joelsson
-
Magnus Ihse Bursie
-
Maurizio Cimadamore