[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-discuss
Subject:    JDK IntelliJ project: beta version
From:       Maurizio Cimadamore <maurizio.cimadamore () oracle ! com>
Date:       2015-01-30 14:35:02
Message-ID: 54CB9696.4040604 () oracle ! com
[Download RAW message or body]

Hi guys,
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:

--with-ant-home <ANT_HOME>

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 
configurations).

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 ;-)

Thanks
Maurizio





["idea-v4.5.patch" (text/x-patch)]

diff -r 8720fa7696cb .hgignore
--- a/.hgignore	Mon Jan 26 10:28:53 2015 +0100
+++ b/.hgignore	Mon Jan 26 17:31:15 2015 +0000
@@ -4,4 +4,5 @@
 ^webrev
 ^.hgtip
 ^.bridge2
+^.idea
 .DS_Store
diff -r 8720fa7696cb make/idea/idea.gmk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/idea.gmk	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,15 @@
+include Makefile
+include make/CompileJavaModules.gmk
+
+ifeq ($(MODULES),)
+SEL_MODULES := $(JAVA_MODULES)
+else
+SEL_MODULES := $(MODULES)
+endif
+
+.PHONY: idea
+idea:
+	$(ECHO) "MODULE_ROOTS=\"$(strip $(foreach m, $(SEL_MODULES), $(foreach root, \
$($(m)_SRC), $(root))))\"" > $(OUT) +	$(ECHO) "MODULE_NAMES=\"$(strip $(foreach m, \
$(SEL_MODULES), $(m)))\"" >> $(OUT) +	$(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT)
+	$(ECHO) "CYGPATH=\"$(CYGPATH)\"" >> $(OUT)
diff -r 8720fa7696cb make/idea/idea.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/idea.sh	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,118 @@
+#!/bin/sh
+
+SCRIPT_DIR=`dirname $0`
+PWD=`pwd`
+SCRIPT_DIR=$PWD/$SCRIPT_DIR
+cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
+cd ../../; TOP=`pwd`; cd $PWD
+
+IDEA_OUTPUT=$TOP/.idea
+IDEA_TEMPLATE=$SCRIPT_DIR/template
+IML_TEMPLATE=$IDEA_TEMPLATE/jdk.iml
+ANT_TEMPLATE=$IDEA_TEMPLATE/ant.xml
+IDEA_IML=$IDEA_OUTPUT/jdk.iml
+IDEA_ANT=$IDEA_OUTPUT/ant.xml
+
+if [ ! -f "$IML_TEMPLATE" ] ; then
+  echo "FATAL: cannot find $IML_TEMPLATE" >&2; exit 1
+fi
+
+if [ ! -f "$ANT_TEMPLATE" ] ; then
+  echo "FATAL: cannot find $ANT_TEMPLATE" >&2; exit 1
+fi
+
+rm -rf $IDEA_OUTPUT
+cp -r "$SCRIPT_DIR/template" $IDEA_OUTPUT
+cd $TOP ; make -f $SCRIPT_DIR/idea.gmk -I make/common idea OUT=$IDEA_OUTPUT/env.cfg \
MODULES="$*" +cd $SCRIPT_DIR
+
+. $IDEA_OUTPUT/env.cfg
+
+# Expect MODULE_ROOTS, MODULE_NAMES, & BOOT_JDK to be set
+if [ "x$MODULE_ROOTS" = "x" ] ; then
+  echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1
+fi
+
+if [ "x$MODULE_NAMES" = "x" ] ; then
+  echo "FATAL: MODULE_NAMES is empty" >&2; exit 1
+fi
+
+if [ "x$BOOT_JDK" = "x" ] ; then
+  echo "FATAL: BOOT_JDK is empty" >&2; exit 1
+fi
+
+SOURCE_FOLDER="      <sourceFolder url=\"file://\$MODULE_DIR\$/####\" \
isTestSource=\"false\" />" +SOURCE_FOLDERS_DONE="false"
+
+addSourceFolder() {
+  root=$@
+  relativePath="`echo "$root" | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
+  folder="`echo "$SOURCE_FOLDER" | sed -e \
s@"\(.*/\)####\(.*\)"@"\1$relativePath\2"@`" +  printf "%s\n" "$folder" >> $IDEA_IML
+}
+
+### Generate project iml
+
+rm -f $IDEA_IML
+while IFS= read -r line
+do
+  if echo "$line" | egrep "^ .* <sourceFolder.*####" > /dev/null ; then
+    if [ "$SOURCE_FOLDERS_DONE" = "false" ] ; then 
+      SOURCE_FOLDERS_DONE="true"
+      for root in $MODULE_ROOTS; do
+         addSourceFolder $root
+      done
+    fi
+  else
+    printf "%s\n" "$line" >> $IDEA_IML
+  fi
+done < "$IML_TEMPLATE"
+
+
+MODULE_NAME="        <property name=\"module.name\" value=\"####\" />"
+
+addModuleName() {
+  mn="`echo "$MODULE_NAME" | sed -e s@"\(.*\)####\(.*\)"@"\1$MODULE_NAMES\2"@`"
+  printf "%s\n" "$mn" >> $IDEA_ANT
+}
+
+### Generate ant.xml
+
+rm -f $IDEA_ANT
+while IFS= read -r line
+do
+  if echo "$line" | egrep "^ .* <property name=\"module.name\"" > /dev/null ; then
+    addModuleName
+  else
+    printf "%s\n" "$line" >> $IDEA_ANT
+  fi
+done < "$ANT_TEMPLATE"
+
+### Compile the custom Logger
+
+CLASSES=$IDEA_OUTPUT/classes
+
+if [ "x$ANT_HOME" = "x" ] ; then
+   # try some common locations, before giving up
+   if [ -f "/usr/share/ant/lib/ant.jar" ] ; then
+     ANT_HOME="/usr/share/ant"
+   elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then
+     ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec"
+   else
+     echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1
+   fi
+fi
+CP=$ANT_HOME/lib/ant.jar
+rm -rf $CLASSES; mkdir $CLASSES
+
+if [ "x$CYGPATH" = "x" ] ; then ## CYGPATH may be set in env.cfg
+  JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java
+  JAVAC_CLASSES=$CLASSES
+  JAVAC_CP=$CP
+else
+  JAVAC_SOURCE_FILE=`cygpath -am $IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java`
+  JAVAC_CLASSES=`cygpath -am $CLASSES`
+  JAVAC_CP=`cygpath -am $CP`
+fi
+
+$BOOT_JDK/bin/javac -d $JAVAC_CLASSES -cp $JAVAC_CP $JAVAC_SOURCE_FILE
diff -r 8720fa7696cb make/idea/template/.name
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/.name	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,1 @@
+jdk
diff -r 8720fa7696cb make/idea/template/ant.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/ant.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AntConfiguration">
+    <buildFile url="file://$PROJECT_DIR$/.idea/build.xml">
+      <properties>
+        <property name="boot.java.home" value="$JDKPath$" />
+        <property name="target.java.home" value="$JDKPath$" />
+        <property name="jtreg.tests" value="$FilePath$" />
+        <property name="jtreg.home" value="###" />
+        <property name="jtreg.jpda.jvmargs" \
value="-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5900,suspend=y" \
/> +        <property name="module.name" value="java.base" />
+      </properties>
+      <executeOn event="afterCompilation" target="post-make" />
+    </buildFile>
+  </component>
+</project>
diff -r 8720fa7696cb make/idea/template/build.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/build.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,244 @@
+<!-- importing.xml -->
+<project name="jdk" basedir="..">
+
+    <script language="javascript" classpath=".idea/classes">
+        var JdkLogger = Java.type("idea.JdkIdeaAntLogger");
+        new JdkLogger(project)
+    </script>
+
+     <!-- java.marker is set to a marker file to check for within a Java install \
dir. +         The best file to check for across Solaris/Linux/Windows/MacOS is one \
of the +         executables; regrettably, that is OS-specific. -->
+    <condition property="java.marker" value="bin/java">
+        <os family="unix"/>
+    </condition>
+    <condition property="java.marker" value="bin/java.exe">
+        <os family="windows"/>
+    </condition>
+
+    <property name="test.dir" value="${basedir}/jdk/test"/>
+
+    <macrodef name="call-make">
+            <attribute name="dir"/>
+            <attribute name="args"/>
+            <sequential>
+                <exec executable="make" dir="@{dir}" failonerror="true">
+                    <arg line="@{args}"/>
+                    <env key="CLASSPATH" value = ""/>
+                </exec>
+            </sequential>
+        </macrodef>
+
+    <macrodef name="exec-target">
+        <attribute name="antfile" default="${ant.file}" />
+        <attribute name="target" />
+        <sequential>
+            <java classname="org.apache.tools.ant.Main" fork="true" spawn="true">
+                <arg value="-f"/>
+                <arg value="@{antfile}"/>  
+                <arg value="-Dboot.java.home=${boot.java.home}"/>
+                <arg value="-Dtarget.java.home=${target.java.home}"/>
+                <arg value="-Dbuild.target.dir=${build.target.dir}"/>
+                <arg value="-Djtreg.home=${jtreg.home}"/>
+                <arg value="-Djtreg.tests=${jtreg.tests}"/>
+                <arg value="-Djtreg.jpda.jvmargs=${jtreg.jpda.jvmargs}"/>
+                <arg value="-Djtreg.bcp.opt=${jtreg.bcp.opt}"/>
+                <arg value="@{target}"/>
+                <classpath>           
+                    <pathelement path="${java.class.path}"/>
+                </classpath>
+            </java>
+        </sequential>
+    </macrodef>
+
+    <target name="post-make" depends="build-module"/>
+
+    <!--
+        **** Global JDK Build Targets
+    -->
+
+    <target name="find-jdk-build-dir">
+        <echo message="base = ${basedir}"/>
+        <script language="javascript">
+            <![CDATA[
+                if (project.getProperty("build.target.dir") == null) {
+                    //look for a build.target.dir, under which the built JDK is \
stored (including +                    //langtools classes) first, look into the \
standard build directory +                    //(<jdk>/../build), to see if there is \
exactly one build configuration +                    //available:
+                    var System = Java.type("java.lang.System");
+                    var basedirPath = project.getProperty("basedir");
+                    var basedir = new java.io.File(basedirPath);
+                    var buildTargetDir = new java.io.File(basedir, "build");
+                    var buildTargetDirs = buildTargetDir.list();
+                    var foundTarget = null;
+
+                    if (buildTargetDirs != null) {
+                        for (var i = 0; i < buildTargetDirs.length; i++) {
+                            var currentTarget = new java.io.File(buildTargetDir, \
buildTargetDirs[i]); +                            if (new java.io.File(currentTarget, \
"spec.gmk").exists()) { +                                foundTarget = currentTarget;
+                                break;
+                            }
+                        }
+                    }
+
+                    //if there is not exactly one configuration available, try \
looking +                    //at target.java.home:
+                    if (foundTarget == null) {
+                        var targetJavaHome = \
project.getProperty("target.java.home"); +
+                        if (new java.io.File(targetJavaHome, \
"../../spec.gmk").exists()) { +                            foundTarget = new \
java.io.File(targetJavaHome, "../.."); +                        }
+                    }
+
+                    if (foundTarget != null) {
+                        project.setProperty("build.target.dir", foundTarget);
+                        var modulesDir = foundTarget + "/jdk/modules/";
+                        var moduleNames = project.getProperty("module.name").split(" \
"); +                        var bcp = "-Xbootclasspath/p:";
+                        var jtregBcpOpt = "";
+                        for (var i = 0; i < moduleNames.length; i++) {
+                            jtregBcpOpt = bcp + modulesDir + moduleNames[i] + " ";
+                        }
+                        project.setProperty("jtreg.bcp.opt", jtregBcpOpt);
+                    }
+                }
+            ]]>
+        </script>
+        <fail unless="build.target.dir">Cannot find build target directory.</fail>
+    </target>
+
+    <target name="clean" depends="-do-configure,find-jdk-build-dir">
+        <echo message="base = ${basedir}"/>
+        <call-make dir = "${build.target.dir}" args = "clean"/>
+    </target>
+    
+    <target name="-do-configure">
+        <echo message="base = ${basedir}"/>
+        <fail message="Not part of a full JDK forest">
+            <condition>
+                <not>
+                    <available file="${basedir}/configure" />
+                </not>
+            </condition>
+        </fail>
+        <exec executable="sh" dir="${basedir}" failonerror="true">
+            <arg line="configure --with-boot-jdk=${boot.java.home}"/>
+        </exec>
+    </target>
+
+    <target name="images" depends = "find-jdk-build-dir">
+        <call-make dir = "${build.target.dir}" args = "images"/>
+    </target>
+
+    <target name="check-env">
+        <exec executable="env" dir="${basedir}"/>
+    </target>
+
+    <target name="build-module" depends = "find-jdk-build-dir">
+        <call-make dir = "${build.target.dir}" args = "${module.name}"/>
+    </target>
+
+    <target name="jtreg-debug" depends="build-module,-def-jtreg">
+        <exec-target target="jtreg-debug-internal"/>
+    </target>
+
+    <target name="jtreg-debug-internal" depends="-def-jtreg">
+        <jtreg-tool name="all" tests="${jtreg.tests}" \
jpda.jvmargs="${jtreg.jpda.jvmargs}"/> +    </target>
+
+    <target name="jtreg" depends="build-module,-def-jtreg">
+        <jtreg-tool name="all" tests="${jtreg.tests}"/>
+    </target>
+
+    <target name="-check-jtreg.home" depends="-def-check">
+        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
+    </target>
+
+    <target name="-check-boot.java.home" depends="-def-check">
+        <check name="bootstrap java" property="boot.java.home" \
marker="${java.marker}"/> +    </target>
+
+    <target name="-check-target.java.home" depends="-def-check">
+        <check name="target java" property="target.java.home" \
marker="${java.marker}"/> +    </target>
+
+    <target name="-def-check">
+        <macrodef name="check">
+            <attribute name="name"/>
+            <attribute name="property"/>
+            <attribute name="marker" default=""/>
+            <sequential>
+                <fail message="Cannot locate @{name}: please set @{property} to its \
location"> +                    <condition>
+                        <not>
+                            <isset property="@{property}"/>
+                        </not>
+                    </condition>
+                </fail>
+                <fail message="@{name} is not installed in ${@{property}}">
+                    <condition>
+                        <and>
+                            <not>
+                                <equals arg1="@{marker}" arg2=""/>
+                            </not>
+                            <not>
+                                <available file="${@{property}}/@{marker}"/>
+                            </not>
+                        </and>
+                    </condition>
+                </fail>
+            </sequential>
+        </macrodef>
+    </target>
+
+    <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home">
+        <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
+            <classpath>
+                <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
+                <pathelement location="${jtreg.home}/lib/javatest.jar"/>
+            </classpath>
+        </taskdef>
+        <macrodef name="jtreg-tool">
+            <attribute name="name"/>
+            <attribute name="tests"/>
+            <attribute name="jdk" default="${target.java.home}"/>
+            <attribute name="samevm" default="true"/>
+            <attribute name="verbose" default="${default.jtreg.verbose}"/>
+            <attribute name="options" default="${other.jtreg.options}"/>
+            <attribute name="keywords" default="-keywords:!ignore"/>
+            <attribute name="jpda.jvmargs" default=""/>
+            <attribute name="extra.jvmargs" default=""/>
+            <sequential>
+                <property name="coverage.options" value=""/>              <!-- \
default --> +                <property name="coverage.classpath" value=""/>           \
<!-- default --> +                <property name="default.jtreg.verbose" \
value="summary"/>  <!-- default --> +                <property \
name="other.jtreg.options" value=""/>           <!-- default --> +                \
<property name="build.jtreg.dir" value="${build.target.dir}/jtreg"/> +                \
<jtreg +                    dir="${test.dir}"
+                    workDir="${build.jtreg.dir}/@{name}/work"
+                    reportDir="${build.jtreg.dir}/@{name}/report"
+                    jdk="@{jdk}"
+                    samevm="@{samevm}" verbose="@{verbose}"
+                    failonerror="false" resultproperty="jtreg.@{name}.result"
+                    javacoptions="-g"
+                    vmoptions="${coverage.options} \
-Xbootclasspath/p:${coverage.classpath} ${jtreg.bcp.opt} @{jpda.jvmargs} \
@{extra.jvmargs}"> +                    <arg line="@{keywords}"/>
+                    <arg line="@{options}"/>
+                    <arg line="@{tests}"/>
+                </jtreg>
+                <!-- the next two properties are for convenience, when only
+                     a single instance of jtreg will be invoked. -->
+                <condition property="jtreg.passed">
+                    <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
+                </condition>
+                <property name="jtreg.report" \
value="${build.jtreg.dir}/@{name}/report"/> +            </sequential>
+        </macrodef>
+        <property name="jtreg.defined" value="true"/>
+    </target>
+</project>
+
diff -r 8720fa7696cb make/idea/template/compiler.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/compiler.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <option name="DEFAULT_COMPILER" value="Javac" />
+    <excludeFromCompile>
+      <directory url="file://$PROJECT_DIR$/jdk/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/langtools/src" \
includeSubdirectories="true" /> +      <directory url="file://$PROJECT_DIR$/jaxp/src" \
includeSubdirectories="true" /> +      <directory \
url="file://$PROJECT_DIR$/jaxws/src" includeSubdirectories="true" /> +      \
<directory url="file://$PROJECT_DIR$/corba/src" includeSubdirectories="true" /> +     \
<directory url="file://$PROJECT_DIR$/nashorn/src" includeSubdirectories="true" /> +   \
<directory url="file://$PROJECT_DIR$/build" includeSubdirectories="true" /> +      \
<directory url="file://$PROJECT_DIR$/jdk/test" includeSubdirectories="true" /> +      \
<directory url="file://$PROJECT_DIR$/jaxp/test" includeSubdirectories="true" /> +     \
<directory url="file://$PROJECT_DIR$/langtools/test" includeSubdirectories="true" /> \
+      <directory url="file://$PROJECT_DIR$/langtools" includeSubdirectories="true" \
/> +    </excludeFromCompile>
+    <resourceExtensions />
+    <wildcardResourcePatterns>
+      <entry name="!?*.java" />
+      <entry name="!?*.form" />
+      <entry name="!?*.class" />
+      <entry name="!?*.groovy" />
+      <entry name="!?*.scala" />
+      <entry name="!?*.flex" />
+      <entry name="!?*.kt" />
+      <entry name="!?*.clj" />
+    </wildcardResourcePatterns>
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="false">
+        <processorPath useClasspath="true" />
+      </profile>
+    </annotationProcessing>
+  </component>
+</project>
\ No newline at end of file
diff -r 8720fa7696cb make/idea/template/copyright/profiles_settings.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/copyright/profiles_settings.xml	Mon Jan 26 17:31:15 2015 \
+0000 @@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+  <settings default="" />
+</component>
diff -r 8720fa7696cb make/idea/template/jdk.iml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/jdk.iml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/####" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/jdk/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/langtools/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/corba/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/jaxp/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/jaxws/test" isTestSource="true" />
+    </content>    
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="inheritedJdk" />
+  </component>
+</module>
diff -r 8720fa7696cb make/idea/template/misc.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/misc.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="EntryPointsManager">
+    <entry_points version="2.0" />
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" \
assert-keyword="true" jdk-15="true"> +    <output \
url="file://$PROJECT_DIR$/build/idea/out" /> +  </component>
+</project>
diff -r 8720fa7696cb make/idea/template/modules.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/modules.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/jdk.iml" \
filepath="$PROJECT_DIR$/.idea/jdk.iml" /> +    </modules>
+  </component>
+</project>
+
diff -r 8720fa7696cb make/idea/template/scopes/scope_settings.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/scopes/scope_settings.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+  <state>
+    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+  </state>
+</component>
diff -r 8720fa7696cb make/idea/template/src/idea/JdkIdeaAntLogger.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/src/idea/JdkIdeaAntLogger.java	Mon Jan 26 17:31:15 2015 \
+0000 @@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package idea;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
+
+import java.util.EnumSet;
+import java.util.Stack;
+
+import static org.apache.tools.ant.Project.*;
+
+/**
+ * This class is used to wrap the IntelliJ ant logger in order to provide more \
meaningful + * output when building langtools. The basic ant output in IntelliJ can \
be quite cumbersome to + * work with, as it provides two separate views: (i) a tree \
view, which is good to display build task + * in a hierarchical fashion as they are \
processed; and a (ii) plain text view, which gives you + * the full ant output. The \
main problem is that javac-related messages are buried into the + * ant output (which \
is made very verbose by IntelliJ in order to support the tree view). It is + * not \
easy to figure out which node to expand in order to see the error message; switching \
+ * to plain text doesn't help either, as now the output is totally flat. + *
+ * This logger class removes a lot of verbosity from the IntelliJ ant logger by not \
propagating + * all the events to the IntelliJ's logger. In addition, certain events \
are handled in a custom + * fashion, to generate better output during the build.
+ */
+public final class JdkIdeaAntLogger extends DefaultLogger {
+
+    /**
+     * This is just a way to pass in customized binary string predicates;
+     *
+     * TODO: replace with @code{BiPredicate<String, String>} and method reference \
when moving to 8 +     */
+    enum StringBinaryPredicate {
+        CONTAINS() {
+            @Override
+            boolean apply(String s1, String s2) {
+                return s1.contains(s2);
+            }
+        },
+        STARTS_WITH {
+            @Override
+            boolean apply(String s1, String s2) {
+                return s1.startsWith(s2);
+            }
+        },
+        MATCHES {
+            @Override
+            boolean apply(String s1, String s2) {
+                return s1.matches(s2);
+            }
+        };
+
+        abstract boolean apply(String s1, String s2);
+    }
+
+    /**
+     * Various kinds of ant messages that we shall intercept
+     */
+    enum MessageKind {
+
+        /** a make error */
+        MAKE_ERROR(StringBinaryPredicate.CONTAINS, MSG_ERR, "error:", \
"compiler.err"), +        /** a make warning */
+        MAKE_WARNING(StringBinaryPredicate.CONTAINS, MSG_WARN, "warning:", \
"compiler.warn"), +        /** a make note */
+        MAKE_NOTE(StringBinaryPredicate.CONTAINS, MSG_INFO, "note:", \
"compiler.note"), +        /** std make output */
+        MAKE_OTHER(StringBinaryPredicate.MATCHES, MSG_INFO, ".*"),
+        /** a javac crash */
+        JAVAC_CRASH(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "An exception has \
occurred in the compiler"), +        /** jtreg test success */
+        JTREG_TEST_PASSED(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "Passed: "),
+        /** jtreg test failure */
+        JTREG_TEST_FAILED(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "FAILED: "),
+        /** jtreg test error */
+        JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: ");
+
+        StringBinaryPredicate sbp;
+        int priority;
+        String[] keys;
+
+        MessageKind(StringBinaryPredicate sbp, int priority, String... keys) {
+            this.sbp = sbp;
+            this.priority = priority;
+            this.keys = keys;
+        }
+
+        /**
+         * Does a given message string matches this kind?
+         */
+        boolean matches(String s) {
+            for (String key : keys) {
+                if (sbp.apply(s, key)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * This enum is used to represent the list of tasks we need to keep track of \
during logging. +     */
+    enum Task {
+        /** javac task - invoked during compilation */
+        MAKE("exec", MessageKind.MAKE_ERROR, MessageKind.MAKE_WARNING, \
MessageKind.MAKE_NOTE, +                       MessageKind.MAKE_OTHER, \
MessageKind.JAVAC_CRASH), +        /** jtreg task - invoked during test execution */
+        JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, \
MessageKind.JTREG_TEST_ERROR), +        /** initial synthetic task when the logger is \
created */ +        ROOT("") {
+            @Override
+            boolean matches(String s) {
+                return false;
+            }
+        },
+        /** synthetic task catching any other tasks not in this list */
+        ANY("") {
+            @Override
+            boolean matches(String s) {
+                return true;
+            }
+        };
+
+        String taskName;
+        MessageKind[] msgs;
+
+        Task(String taskName, MessageKind... msgs) {
+            this.taskName = taskName;
+            this.msgs = msgs;
+        }
+
+        boolean matches(String s) {
+            return s.equals(taskName);
+        }
+    }
+
+    /**
+     * This enum is used to represent the list of targets we need to keep track of \
during logging. +     * A regular expression is used to match a given target name.
+     */
+    enum Target {
+        /** jtreg target - executed when launching tests */
+        JTREG("jtreg") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Running jtreg tests: " + \
e.getProject().getProperty("jtreg.tests"); +            }
+        },
+        /** build selected modules */
+        BUILD_MODULE("build-module") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Building modules: " + \
e.getProject().getProperty("module.name") + "..."; +            }
+        },
+        /** build images */
+        BUILD_IMAGES("images") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Building images...";
+            }
+        },
+        /** build images */
+        CONFIGURE("-do-configure") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Configuring build...";
+            }
+        },
+        /** synthetic target catching any other target not in this list */
+        ANY("") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Executing Ant target(s): " + \
e.getProject().getProperty("ant.project.invoked-targets"); +            }
+            @Override
+            boolean matches(String msg) {
+                return true;
+            }
+        };
+
+        String targetRegex;
+
+        Target(String targetRegex) {
+            this.targetRegex = targetRegex;
+        }
+
+        boolean matches(String msg) {
+            return msg.matches(targetRegex);
+        }
+
+        abstract String getDisplayMessage(BuildEvent e);
+    }
+
+    /**
+     * A custom build event used to represent status changes which should be \
notified inside +     * Intellij
+     */
+    static class StatusEvent extends BuildEvent {
+
+        /** the target to which the status update refers */
+        Target target;
+
+        StatusEvent(BuildEvent e, Target target) {
+            super(new StatusTask(e, target.getDisplayMessage(e)));
+            this.target = target;
+            setMessage(getTask().getTaskName(), 2);
+        }
+
+        /**
+         * A custom task used to channel info regarding a status change
+         */
+        static class StatusTask extends org.apache.tools.ant.Task {
+            StatusTask(BuildEvent event, String msg) {
+                setProject(event.getProject());
+                setOwningTarget(event.getTarget());
+                setTaskName(msg);
+            }
+        }
+    }
+
+    /** wrapped ant logger (IntelliJ's own logger) */
+    DefaultLogger logger;
+
+    /** flag - is this the first target we encounter? */
+    boolean firstTarget = true;
+
+    /** flag - should subsequenet failures be suppressed ? */
+    boolean suppressTaskFailures = false;
+
+    /** flag - have we ran into a javac crash ? */
+    boolean crashFound = false;
+
+    /** stack of status changes associated with pending targets */
+    Stack<StatusEvent> statusEvents = new Stack<>();
+
+    /** stack of pending tasks */
+    Stack<Task> tasks = new Stack<>();
+
+    public JdkIdeaAntLogger(Project project) {
+        for (Object o : project.getBuildListeners()) {
+            if (o instanceof DefaultLogger) {
+                this.logger = (DefaultLogger)o;
+                project.removeBuildListener((BuildListener)o);
+                project.addBuildListener(this);
+            }
+        }
+        tasks.push(Task.ROOT);
+    }
+
+    @Override
+    public void buildStarted(BuildEvent event) {
+        //do nothing
+    }
+
+    @Override
+    public void buildFinished(BuildEvent event) {
+        //do nothing
+    }
+
+    @Override
+    public void targetStarted(BuildEvent event) {
+        EnumSet<Target> statusKinds = firstTarget ?
+                EnumSet.allOf(Target.class) :
+                EnumSet.complementOf(EnumSet.of(Target.ANY));
+
+        String targetName = event.getTarget().getName();
+
+        for (Target statusKind : statusKinds) {
+            if (statusKind.matches(targetName)) {
+                StatusEvent statusEvent = new StatusEvent(event, statusKind);
+                statusEvents.push(statusEvent);
+                logger.taskStarted(statusEvent);
+                firstTarget = false;
+                return;
+            }
+        }
+    }
+
+    @Override
+    public void targetFinished(BuildEvent event) {
+        if (!statusEvents.isEmpty()) {
+            StatusEvent lastEvent = statusEvents.pop();
+            if (lastEvent.target.matches(event.getTarget().getName())) {
+                logger.taskFinished(lastEvent);
+            }
+        }
+    }
+
+    @Override
+    public void taskStarted(BuildEvent event) {
+        String taskName = event.getTask().getTaskName();
+        System.err.println("task started " + taskName);
+        for (Task task : Task.values()) {
+            if (task.matches(taskName)) {
+                tasks.push(task);
+                return;
+            }
+        }
+    }
+
+    @Override
+    public void taskFinished(BuildEvent event) {
+        if (tasks.peek() == Task.ROOT) {
+            //we need to 'close' the root task to get nicer output
+            logger.taskFinished(event);
+        } else if (!suppressTaskFailures && event.getException() != null) {
+            //the first (innermost) task failure should always be logged
+            event.setMessage(event.getException().toString(), 0);
+            event.setException(null);
+            //note: we turn this into a plain message to avoid stack trace being \
logged by Idea +            logger.messageLogged(event);
+            suppressTaskFailures = true;
+        }
+        tasks.pop();
+    }
+
+    @Override
+    public void messageLogged(BuildEvent event) {
+        String msg = event.getMessage();
+
+        boolean processed = false;
+
+        if (!tasks.isEmpty()) {
+            Task task = tasks.peek();
+            for (MessageKind messageKind : task.msgs) {
+                if (messageKind.matches(msg)) {
+                    event.setMessage(msg, messageKind.priority);
+                    processed = true;
+                    if (messageKind == MessageKind.JAVAC_CRASH) {
+                        crashFound = true;
+                    }
+                    break;
+                }
+            }
+        }
+
+        if (event.getPriority() == MSG_ERR || crashFound) {
+            //we log errors regardless of owning task
+            logger.messageLogged(event);
+            suppressTaskFailures = true;
+        } else if (processed) {
+            logger.messageLogged(event);
+        }
+    }
+}
diff -r 8720fa7696cb make/idea/template/vcs.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/vcs.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="hg4idea" />
+	<mapping directory="$PROJECT_DIR$/jdk" vcs="hg4idea" />
+	<mapping directory="$PROJECT_DIR$/langtools" vcs="hg4idea" />
+	<mapping directory="$PROJECT_DIR$/hotspot" vcs="hg4idea" />
+	<mapping directory="$PROJECT_DIR$/nashorn" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/jaxp" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/jaxws" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/corba" vcs="hg4idea" />
+  </component>
+</project>
+
diff -r 8720fa7696cb make/idea/template/workspace.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/workspace.xml	Mon Jan 26 17:31:15 2015 +0000
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <ignored path="jdk.iws" />
+    <ignored path="$PROJECT_DIR$/build/idea/out/" />
+    <ignored path=".idea/" />
+  </component>
+  <component name="RunManager">    
+    <configuration default="false" name="jtreg (debug)" type="Remote" \
factoryName="Remote" singleton="true"> +      <option name="USE_SOCKET_TRANSPORT" \
value="true" /> +      <option name="SERVER_MODE" value="true" />
+      <option name="SHMEM_ADDRESS" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5900" />
+      <RunnerSettings RunnerId="Debug">
+        <option name="DEBUG_PORT" value="5900" />
+        <option name="TRANSPORT" value="0" />
+        <option name="LOCAL" value="false" />
+      </RunnerSettings>
+      <ConfigurationWrapper RunnerId="Debug" />
+      <method>
+        <option name="AntTarget" enabled="true" \
antfile="file://$PROJECT_DIR$/.idea/build.xml" target="jtreg-debug" /> +      \
</method> +    </configuration>
+    <configuration default="false" name="jtreg" type="AntRunConfiguration" \
factoryName="Ant Target"> +      <antsettings \
antfile="file://$PROJECT_DIR$/.idea/build.xml" target="jtreg" /> +      \
<RunnerSettings RunnerId="AntRunConfigurationRunner" /> +      <ConfigurationWrapper \
RunnerId="AntRunConfigurationRunner" /> +      <method>
+        <option name="Make" enabled="false" />
+      </method>
+    </configuration>
+  </component>
+  <component name="StructureViewFactory">
+    <option name="ACTIVE_ACTIONS" value=",ALPHA_COMPARATOR" />
+  </component>
+  <component name="antWorkspaceConfiguration">
+    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+    <option name="FILTER_TARGETS" value="false" />
+    <buildFile url="file://$PROJECT_DIR$/.idea/build.xml">
+      <runInBackground value="false" />
+      <targetFilters>
+        <filter targetName="post-make" isVisible="false" />
+        <filter targetName="clean" isVisible="true" />
+        <filter targetName="-do-configure" isVisible="false" />
+        <filter targetName="images" isVisible="true" />
+        <filter targetName="build-module" isVisible="true" />
+        <filter targetName="jtreg-debug" isVisible="false" />
+        <filter targetName="jtreg-debug-internal" isVisible="false" />
+        <filter targetName="jtreg" isVisible="false" />
+        <filter targetName="-check-jtreg.home" isVisible="false" />
+        <filter targetName="-def-check" isVisible="false" />
+        <filter targetName="-def-jtreg" isVisible="false" />
+        <filter targetName="-check-boot.java.home" isVisible="false" />
+        <filter targetName="-check-target.java.home" isVisible="false" />
+        <filter targetName="find-jdk-build-dir" isVisible="false" />
+        <filter targetName="check-env" isVisible="false" />
+      </targetFilters>
+      <treeView value="false" />
+      <expanded value="true" />
+    </buildFile>
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="PackagesPane" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource />
+      <sortByType />
+    </navigator>
+    <panes>
+      <pane id="ProjectPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="jdk" />
+              <option name="myItemType" \
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> +           \
</PATH_ELEMENT> +          </PATH>
+        </subPane>
+      </pane>
+      <pane id="PackagesPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="jdk" />
+              <option name="myItemType" \
value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" /> +           \
</PATH_ELEMENT> +            <PATH_ELEMENT>
+              <option name="myItemId" value="jdk" />
+              <option name="myItemType" \
value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" /> +            \
</PATH_ELEMENT> +          </PATH>
+        </subPane>
+      </pane>
+      <pane id="Scope" />
+    </panes>
+  </component>
+</project>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic