8155959: Langtools ant build should support new Xpatch option format
authormcimadamore
Thu, 05 May 2016 11:18:13 +0100
changeset 37851 f2820cadfa38
parent 37850 24e70308f4ea
child 37852 4dd95b3cb2e8
8155959: Langtools ant build should support new Xpatch option format Summary: Switch ant build and IntelliJ project to use the new Xpatch syntax flavor Reviewed-by: jlahoda, jjg
langtools/make/build.xml
langtools/make/intellij/workspace.xml
langtools/make/launcher.sh-template
--- a/langtools/make/build.xml	Wed May 04 17:06:55 2016 +0200
+++ b/langtools/make/build.xml	Thu May 05 11:18:13 2016 +0100
@@ -83,6 +83,17 @@
     <property name="build.jtreg" location="${build.dir}/jtreg"/>
     <property name="build.prevsrc" location="${build.dir}/prevsrc"/>
 
+    <pathconvert property="modules.names" pathsep=",">
+        <globmapper from="${src.dir}/*" to="*" />
+        <dirset dir="${src.dir}" includes="*.*"/>
+    </pathconvert>
+
+    <pathconvert property="xpatch.rest" pathsep=" -Xpatch:">
+        <regexpmapper from="${file.separator}([^${file.separator}]+)$" to="\1=${build.modules}${file.separator}\1" />
+        <dirset dir="${src.dir}" includes="*.*"/>
+    </pathconvert>
+
+    <property name="xpatch.cmd" value="-Xpatch:${xpatch.rest}"/>
 
     <!-- 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
@@ -190,7 +201,7 @@
             <arg line="-source ${javac.source} -target ${javac.target}" />
             <arg value="-d" />
             <arg value="${build.modules}" />
-            <arg line="${javac.opts} -modulesourcepath ${src.dir}${file.separator}*${file.separator}share${file.separator}classes:${build.gensrc} -m java.compiler,jdk.compiler,jdk.javadoc,jdk.jdeps,jdk.jshell" />
+            <arg line="${javac.opts} -modulesourcepath ${src.dir}${file.separator}*${file.separator}share${file.separator}classes:${build.gensrc} -m ${modules.names}" />
         </exec>
         <delete>
             <fileset dir="${build.modules}" includes="**/module-info.class"/>
@@ -229,7 +240,7 @@
         <replace file=".idea/ant.xml" token="@IDEA_JTREG_HOME@" value="${idea.jtreg.home}"/>
         <replace file=".idea/ant.xml" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
         <replace file=".idea/workspace.xml" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
-        <replace file=".idea/workspace.xml" token="@FILE_SEP@" value="${file.separator}"/>
+        <replace file=".idea/workspace.xml" token="@XPATCH@" value="${xpatch.cmd}"/>
         <replace file=".idea/workspace.xml" token="@PATH_SEP@" value="${path.separator}"/>
         <mkdir dir=".idea/classes"/>
         <javac srcdir="make/intellij/src"
@@ -285,6 +296,7 @@
             <attribute name="bin.dir" default="${build.bin}"/>
             <attribute name="java" default="${launcher.java}"/>
             <attribute name="main.class" default="${tool.@{name}.main.class}"/>
+            <attribute name="xpatch" default="${xpatch.cmd}"/>
             <sequential>
                 <mkdir dir="@{bin.dir}"/>
                 <copy file="${make.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
@@ -292,6 +304,7 @@
                         <filter token="PROGRAM" value="@{main.class}"/>
                         <filter token="TARGET_JAVA" value="@{java}"/>
                         <filter token="PS" value="${path.separator}"/>
+                        <filter token="XPATCH" value="${xpatch.cmd}"/>
                     </filterset>
                 </copy>
                 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
@@ -330,7 +343,7 @@
                     jdk="@{jdk}"
                     agentvm="@{agentvm}" verbose="@{verbose}"
                     failonerror="false" resultproperty="jtreg.@{name}.result"
-                    vmoptions="${coverage.options} @{extra.jvmargs} -Xpatch:@{build.modules}">
+                    vmoptions="${coverage.options} @{extra.jvmargs} ${xpatch.cmd}">
                     <arg value="-debug:@{jpda.jvmargs}"/>
                     <arg line="@{keywords}"/>
                     <arg line="@{options}"/>
--- a/langtools/make/intellij/workspace.xml	Wed May 04 17:06:55 2016 +0200
+++ b/langtools/make/intellij/workspace.xml	Thu May 05 11:18:13 2016 +0100
@@ -10,7 +10,7 @@
     <!-- javac -->
     <configuration default="false" name="javac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
-      <option name="VM_PARAMETERS" value="-Xpatch:build@FILE_SEP@modules" />
+      <option name="VM_PARAMETERS" value="@XPATCH@" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
@@ -30,7 +30,7 @@
     <!-- javadoc -->
     <configuration default="false" name="javadoc" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javadoc.Main" />
-      <option name="VM_PARAMETERS" value="-Xpatch:build@FILE_SEP@modules" />
+      <option name="VM_PARAMETERS" value="@XPATCH@" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
@@ -50,7 +50,7 @@
     <!-- javap -->
     <configuration default="false" name="javap" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
-      <option name="VM_PARAMETERS" value="-Xpatch:build@FILE_SEP@modules" />
+      <option name="VM_PARAMETERS" value="@XPATCH@" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
@@ -70,7 +70,7 @@
     <!-- javah -->
     <configuration default="false" name="javah" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
-      <option name="VM_PARAMETERS" value="-Xpatch:build@FILE_SEP@modules" />
+      <option name="VM_PARAMETERS" value="@XPATCH@" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
@@ -90,7 +90,7 @@
     <!-- sjavac -->
     <configuration default="false" name="sjavac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
-      <option name="VM_PARAMETERS" value="-Xpatch:build@FILE_SEP@modules" />
+      <option name="VM_PARAMETERS" value="@XPATCH@" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
@@ -111,7 +111,7 @@
     <configuration default="false" name="jshell" type="Application" factoryName="Application">
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
       <option name="MAIN_CLASS_NAME" value="jdk.internal.jshell.tool.JShellTool" />
-      <option name="VM_PARAMETERS" value="-Xpatch:build@FILE_SEP@modules -XaddExports:jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED" />
+      <option name="VM_PARAMETERS" value="@XPATCH@ -XaddExports:jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/launcher.sh-template	Wed May 04 17:06:55 2016 +0200
+++ b/langtools/make/launcher.sh-template	Thu May 05 11:18:13 2016 +0100
@@ -25,17 +25,6 @@
 # questions.
 #
 
-mydir="`dirname $0`"
-case `uname -s` in
-    CYGWIN*)
-      mydir=`cygpath -m $mydir`
-      ;;
-esac
-mylib="$mydir/../modules"
-
-# patch langtools modules
-bcp=-Xpatch:"$mylib"
-
 # tools currently assumes that assertions are enabled in the launcher
 ea=-ea:com.sun.tools...
 
@@ -59,4 +48,4 @@
 unset DUALCASE
 
 IFS=$nl
-"#TARGET_JAVA#" $bcp ${ea} ${javaOpts} #PROGRAM# ${toolOpts}
+"#TARGET_JAVA#" "#XPATCH#" ${ea} ${javaOpts} #PROGRAM# ${toolOpts}