JDK IntelliJ project: beta version
maurizio.cimadamore at oracle.com
Fri Jan 30 14:35:02 UTC 2015
over the last few weeks, Chris and I have been busy putting together a
configurable IntelliJ project for working on JDK. We decided that is now
time to share what we have, so that you guys could give it a try.
In order to use it, you must have a full JDK repository (i.e. forest)
somewhere in your local environment. The script will also assume that
you have already successfully ran the build 'configure' script. Simply
go there and apply the attached patch. You will see that the patch will
add some stuff under 'make/idea'.
Setting up a new project is simple; from the toplevel just run:
sh make/idea/idea.sh <MODULE-NAMES>
Where <MODULE-NAMES> denotes a space-separated list of module names
(i.e. "java.base jdk.compiler"); if you don't provide any module name,
the script will assume that you want to add all the modules as source
roots (which is fine too).
The script assumes you have Ant installed on some default location (it
infers such location correctly on both Mac and Linux) - should the Ant
lookup logic fail, you can help it out by running the build 'configure'
script with the following option:
And the idea.sh script will be able to pick that up.
Once the script completes, you should see a new (hidden) folder .idea
under the toplevel - that's your brand new project folder. This means
that you can now open the toplevel folder as an IntelliJ project.
The script does a good job at asking the build system which sources
should be added as root of your IntelliJ project; note that the answer
might depend on your OS, your HW - all things that the build system
knows very well. This means that the project you have just created will
be customized for your specific build configuration (we plan to add
options in the future to allow to create projects for custom
All main build commands can be accessed under the Build menu (it might
be necessary to click on the menu a couple of times because of an
IntelliJ glitch when loading the project Ant file for the first time).
You should see a new entry in the build menu named 'jdk' - which has
three options underneath:
* clean --> clean the build and rerun configure
* build-module --> build modules selected as input in the above script
* images --> do a full image build
To be able to index files correctly and also to run JDK tests, you will
have to set your Project JDK - which can be done by clicking on the top
right button (just beside the search button). Just set Project JDK to
point to a valid JDK installation and you are good to go. You should now
be able to select a 'Run' configuration on the top bar (by clicking on
the down arrow in the combo list). There are two configurations available:
* run jtreg test
* debug jtreg test
To run a jtreg test, first make sure that the 'java.target.home' ant
variable is set to some meaningful path (where a JDK image can be found)
then simply open the jtreg test, make sure the source has focus in the
IDE, then press the 'play' button besides the 'jtreg' configuration.
Alternatively, you can run jtreg tests on an entire folder - to do so,
just select the test folder you want to run tests on (to do so you might
need to switch to the Project View, by clicking on the list in the top
left - the default view is the Packages View). Make sure the folder is
selected in the panel and then click on 'play' - all tests in that
folder should be executed.
Debugging works more or less the same way; you select the test you want
to debug, make sure that you selected the 'jtreg (debug)' configuration,
and then click on the debug icon. This will currently only work with
'samevm' tests (testng work also well) - so if the test says something
other than samevm, you might need to modify the test to be able to
debug. Currently, test are not being added as source roots, which means
you could have issues when trying to set breakpoints in the test
themselves - although you should be able to set a breakpoint anywhere in
the source code of your selected modules.
I guess that's it - I hope you will find this useful (we certainly
did!); please let us know what we can do to improve this. Our plan is to
collect all feedback, then eventually push it in the JDK 9 repo.
I would like to thank bgoetz, jfrank, prappo, psandoz, rriggs and smarks
for providing some (very useful) initial feedback on the project. Also a
big thank to the IntelliJ team (esp. to Anna Kozlova) for helping us
finding the Right Way (TM) to do things ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 39719 bytes
Desc: not available
More information about the discuss