make/langtools/build.xml
changeset 47217 72e3ae9a25eb
parent 47216 71c04702a3d5
child 48406 26b47ea4c77d
equal deleted inserted replaced
47216:71c04702a3d5 47217:72e3ae9a25eb
    51  - global property definitions
    51  - global property definitions
    52  - primary top level targets (cleaning, building)
    52  - primary top level targets (cleaning, building)
    53  - utility definitions
    53  - utility definitions
    54  -->
    54  -->
    55 
    55 
    56 <project name="langtools" default="build" basedir="..">
    56 <project name="langtools" default="build" basedir="../..">
    57     <!--
    57     <!--
    58     **** Global property definitions.
    58     **** Global property definitions.
    59     -->
    59     -->
    60 
    60 
    61     <!-- The following locations can be used to override default property values. -->
    61     <!-- The following locations can be used to override default property values. -->
    62 
    62 
    63     <!-- Use this location for customizations specific to this instance of this workspace -->
    63     <!-- Use this location for customizations specific to this instance of this workspace -->
    64     <property file="build.properties"/>
    64     <property file="make/langtools/build.properties"/>
    65 
    65 
    66     <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
    66     <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
    67     <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
    67     <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
    68 
    68 
    69     <!-- Use this location for customizations common to all OpenJDK workspaces -->
    69     <!-- Use this location for customizations common to all OpenJDK workspaces -->
    70     <property file="${user.home}/.openjdk/build.properties"/>
    70     <property file="${user.home}/.openjdk/build.properties"/>
    71 
    71 
    72     <!-- Convenient shorthands for standard locations within the workspace. -->
    72     <!-- Convenient shorthands for standard locations within the workspace. -->
    73     <property name="src.dir" location="src"/>
    73     <property name="src.dir" location="src"/>
    74     <property name="test.dir" location="test"/>
    74     <property name="test.dir" location="test"/>
    75     <property name="make.dir" location="make"/>
    75     <property name="make.dir" location="make/langtools"/>
    76     <property name="make.conf.dir" location="${make.dir}/conf"/>
    76     <property name="make.conf.dir" location="${make.dir}/conf"/>
    77     <property name="make.tools.dir" location="${make.dir}/tools"/>
    77     <property name="make.tools.dir" location="${make.dir}/tools"/>
    78     <property name="build.dir" location="build"/>
    78     <property name="build.dir" location="build/langtools"/>
    79     <property name="build.modules" location="${build.dir}/modules"/>
    79     <property name="build.modules" location="${build.dir}/modules"/>
    80     <property name="build.gensrc" location="${build.dir}/gensrc"/>
    80     <property name="build.gensrc" location="${build.dir}/gensrc"/>
    81     <property name="build.tools" location="${build.dir}/toolclasses"/>
    81     <property name="build.tools" location="${build.dir}/toolclasses"/>
    82     <property name="build.bin" location="${build.dir}/bin"/>
    82     <property name="build.bin" location="${build.dir}/bin"/>
    83     <property name="build.jtreg" location="${build.dir}/jtreg"/>
    83     <property name="build.jtreg" location="${build.dir}/jtreg"/>
    84     <property name="build.prevsrc" location="${build.dir}/prevsrc"/>
    84     <property name="build.prevsrc" location="${build.dir}/prevsrc"/>
    85 
    85 
    86     <pathconvert property="modules.names" pathsep=",">
    86     <dirset id="src.module.dirset" dir="${src.dir}" includes="${module.names}"/>
    87         <globmapper from="${src.dir}/*" to="*" handledirsep="yes"/>
    87 
    88         <dirset dir="${src.dir}" includes="*.*"/>
    88     <pathconvert pathsep="," property="src.module.dirs" refid="src.module.dirset"/>
    89     </pathconvert>
    89 
    90 
    90     <pathconvert property="xpatch.rest" pathsep=" --patch-module=" refid="src.module.dirset">
    91     <pathconvert property="xpatch.rest" pathsep=" --patch-module=">
       
    92         <scriptmapper language="javascript">
    91         <scriptmapper language="javascript">
    93             fs = project.getProperty("file.separator");
    92             fs = project.getProperty("file.separator");
    94             path = project.getProperty("build.modules");
    93             path = project.getProperty("build.modules");
    95             mod = source.substr(source.lastIndexOf(fs)+1);
    94             mod = source.substr(source.lastIndexOf(fs)+1);
    96             self.addMappedName(mod + "=\"" + path + fs + mod + "\"");
    95             self.addMappedName(mod + "=\"" + path + fs + mod + "\"");
    97         </scriptmapper>
    96         </scriptmapper>
    98         <dirset dir="${src.dir}" includes="*.*"/>
       
    99     </pathconvert>
    97     </pathconvert>
   100 
    98 
   101     <pathconvert property="xpatch.noquotes.rest" pathsep=" --patch-module=">
    99     <pathconvert property="xpatch.noquotes.rest" pathsep=" --patch-module=" refid="src.module.dirset">
   102         <scriptmapper language="javascript">
   100         <scriptmapper language="javascript">
   103             fs = project.getProperty("file.separator");
   101             fs = project.getProperty("file.separator");
   104             path = project.getProperty("build.modules");
   102             path = project.getProperty("build.modules");
   105             mod = source.substr(source.lastIndexOf(fs)+1);
   103             mod = source.substr(source.lastIndexOf(fs)+1);
   106             self.addMappedName(mod + "=" + path + fs + mod);
   104             self.addMappedName(mod + "=" + path + fs + mod);
   107         </scriptmapper>
   105         </scriptmapper>
   108         <dirset dir="${src.dir}" includes="*.*"/>
       
   109     </pathconvert>
   106     </pathconvert>
   110 
   107 
   111     <property name="xpatch.cmd" value="--patch-module=${xpatch.rest}"/>
   108     <property name="xpatch.cmd" value="--patch-module=${xpatch.rest}"/>
   112     <property name="xpatch.noquotes.cmd" value="--patch-module=${xpatch.noquotes.rest}"/>
   109     <property name="xpatch.noquotes.cmd" value="--patch-module=${xpatch.noquotes.rest}"/>
   113 
   110 
   196         <mkdir dir="${build.prevsrc}"/>
   193         <mkdir dir="${build.prevsrc}"/>
   197     </target>
   194     </target>
   198 
   195 
   199     <target name="generate-sources-internal">
   196     <target name="generate-sources-internal">
   200         <basename property="module.name" file="${basedir}"/>
   197         <basename property="module.name" file="${basedir}"/>
       
   198         <mkdir dir="${build.gensrc}/${module.name}"/>
   201         <pparse destdir="${build.gensrc}/${module.name}" includes="${langtools.resource.includes}">
   199         <pparse destdir="${build.gensrc}/${module.name}" includes="${langtools.resource.includes}">
   202             <src path="./share/classes"/>
   200             <src path="./share/classes"/>
   203         </pparse>
   201         </pparse>
   204         <pcompile destdir="${build.gensrc}/${module.name}" includes="**/*.properties">
   202         <pcompile destdir="${build.gensrc}/${module.name}" includes="**/*.properties">
   205             <src path="./share/classes"/>
   203             <src path="./share/classes"/>
   206         </pcompile>
   204         </pcompile>
   207     </target>
   205     </target>
   208 
   206 
   209     <target name="generate-sources"  depends="-prepare-build,-def-pparse,-def-pcompile">
   207     <target name="generate-sources"  depends="-prepare-build,-def-pparse,-def-pcompile">
   210         <subant inheritall="true" target="generate-sources-internal" genericantfile="${make.dir}/build.xml">
   208         <subant inheritall="true" target="generate-sources-internal" genericantfile="${make.dir}/build.xml">
   211               <dirset dir="${src.dir}" includes="*.*"/>
   209               <dirset refid="src.module.dirset"/>
   212         </subant>
   210         </subant>
   213     </target>
   211     </target>
   214 
   212 
   215     <target name="build-all-classes" depends="generate-sources">
   213     <target name="build-all-classes" depends="generate-sources">
       
   214         <pathconvert property="xpatch.src.rest" pathsep=" --patch-module=" refid="src.module.dirset">
       
   215             <scriptmapper language="javascript">
       
   216                 fs = project.getProperty("file.separator");
       
   217                 path_src = project.getProperty("src.dir");
       
   218                 path_sep = project.getProperty("path.separator");
       
   219                 path_gensrc = project.getProperty("build.gensrc");
       
   220                 mod = source.substr(source.lastIndexOf(fs)+1);
       
   221                 self.addMappedName(mod + "=" + path_src + fs + mod + path_sep + path_gensrc + fs + mod);
       
   222             </scriptmapper>
       
   223         </pathconvert>
       
   224         <property name="xpatch.src.cmd" value="--patch-module=${xpatch.src.rest}"/>
       
   225         <pathconvert pathsep="," property="gensrc.module.dirs">
       
   226             <dirset dir="${build.gensrc}" includes="${module.names}"/>
       
   227         </pathconvert>
       
   228         <multirootfileset id="source.fileset" basedirs="${src.module.dirs},${gensrc.module.dirs}">
       
   229             <include name="**/*.java"/>
       
   230             <different targetdir="${build.prevsrc}" ignoreFileTimes="true"/>
       
   231         </multirootfileset>
       
   232         <pathconvert pathsep=" " property="source.files" refid="source.fileset"/>
       
   233         <echo file="${build.dir}/sources.txt">${source.files}</echo>
   216         <exec executable="${langtools.jdk.home}/bin/javac" failonerror="true">
   234         <exec executable="${langtools.jdk.home}/bin/javac" failonerror="true">
   217             <arg line="-source ${javac.source} -target ${javac.target}" />
   235             <arg line="-source ${javac.source} -target ${javac.target}" />
   218             <arg value="-d" />
   236             <arg value="-d" />
   219             <arg value="${build.modules}" />
   237             <arg value="${build.modules}" />
   220             <arg line="${javac.opts}" />
   238             <arg line="${javac.opts}" />
   221             <arg line="--module-source-path ${src.dir}${file.separator}*${file.separator}share${file.separator}classes${path.separator}${build.gensrc}" />
   239             <arg line="${xpatch.src.cmd}" />
   222             <arg line="-m ${modules.names}" />
   240             <arg line="--module-source-path ." />
       
   241             <arg line="@${build.dir}/sources.txt" />
   223         </exec>
   242         </exec>
       
   243         <delete file="${build.dir}/sources.txt"/>
   224         <delete>
   244         <delete>
   225             <fileset dir="${build.modules}" includes="**/module-info.class"/>
   245             <fileset dir="${build.modules}" includes="**/module-info.class"/>
   226         </delete>
   246         </delete>
       
   247         <!-- workaround for incremental compilation -->
       
   248         <copy todir="${build.prevsrc}" >
       
   249             <multirootfileset refid="source.fileset"/>
       
   250         </copy>
   227     </target>
   251     </target>
   228 
   252 
   229     <target name="build-all-tools" depends="build-all-classes, -def-build-tool">
   253     <target name="build-all-tools" depends="build-all-classes, -def-build-tool">
   230         <build-tool name="javac"/>
   254         <build-tool name="javac"/>
   231         <build-tool name="javadoc"/>
   255         <build-tool name="javadoc"/>
   245     -->
   269     -->
   246 
   270 
   247     <target name="idea" depends="-check-langtools.jdk.home">
   271     <target name="idea" depends="-check-langtools.jdk.home">
   248         <mkdir dir=".idea"/>
   272         <mkdir dir=".idea"/>
   249         <copy todir=".idea" >
   273         <copy todir=".idea" >
   250             <fileset dir="make/intellij">
   274             <fileset dir="${make.dir}/intellij">
   251                <exclude name="**/src/**"/>
   275                <exclude name="**/src/**"/>
   252                <exclude name="**/utils/**"/>
   276                <exclude name="**/utils/**"/>
   253             </fileset>
   277             </fileset>
   254         </copy>
   278         </copy>
   255         <condition property="idea.jtreg.home" value="${jtreg.home}" else = "[jtreg.home]">
   279         <condition property="idea.jtreg.home" value="${jtreg.home}" else = "[jtreg.home]">
   265         <replace file=".idea/misc.xml" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
   289         <replace file=".idea/misc.xml" token="@IDEA_TARGET_JDK@" value="${idea.target.jdk}"/>
   266         <replace file=".idea/misc.xml" token="@XPATCH@" value="${xpatch.cmd}"/>
   290         <replace file=".idea/misc.xml" token="@XPATCH@" value="${xpatch.cmd}"/>
   267         <mkdir dir=".idea/classes"/>
   291         <mkdir dir=".idea/classes"/>
   268         <javac source="${javac.build.source}"
   292         <javac source="${javac.build.source}"
   269                target="${javac.build.target}"
   293                target="${javac.build.target}"
   270                srcdir="make/intellij/src"
   294                srcdir="${make.dir}/intellij/src"
   271                destdir=".idea/classes"/>
   295                destdir=".idea/classes"/>
   272     </target>
   296     </target>
   273 
   297 
   274     <!--
   298     <!--
   275         **** Utility definitions
   299         **** Utility definitions