changeset 8302:b246434a3e4a

made build-graal.xml be generated by mx
author Doug Simon <doug.simon@oracle.com>
date Fri, 15 Mar 2013 18:09:19 +0100
parents 950cc0d8bc7c
children bb9fba66b6ef
files make/build-graal.xml mx/commands.py mxtool/mx.py
diffstat 3 files changed, 110 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/make/build-graal.xml	Fri Mar 15 15:38:55 2013 +0100
+++ b/make/build-graal.xml	Fri Mar 15 18:09:19 2013 +0100
@@ -23,33 +23,54 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-
-<project name="graal" basedir="." default="main">
-  <property name="src.dir"     value="${gamma.dir}/graal"/>
+<project basedir="." default="main" name="graal">
+  <property name="src.dir" value="${gamma.dir}/graal"/>
   <property name="classes.dir" value="${shared.dir}/graal"/>
-  <property name="jar.dir"     value="${shared.dir}"/>
-  <property name="jar.file"    value="${jar.dir}/graal.jar"/>
-
-  <target name="main" depends="jar"/>
-
+  <property name="jar.dir" value="${shared.dir}"/>
+  <property name="jar.file" value="${jar.dir}/graal.jar"/>
+  <target depends="jar" name="main"/>
   <target name="compile">
     <mkdir dir="${classes.dir}"/>
-    <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on" includeantruntime="false">
-      <include name="com.oracle.graal.*/**"/>
-      <exclude name="com.oracle.graal.test/**"/>
-      <exclude name="com.oracle.graal.*.test/**"/>
-      <exclude name="com.oracle.graal.jtt/**"/>
+    <javac debug="on" destdir="${classes.dir}" includeantruntime="false">
+      <src path="${src.dir}/com.oracle.graal.api.meta"/>
+      <src path="${src.dir}/com.oracle.graal.api.code"/>
+      <src path="${src.dir}/com.oracle.graal.graph"/>
+      <src path="${src.dir}/com.oracle.graal.debug"/>
+      <src path="${src.dir}/com.oracle.graal.nodes"/>
+      <src path="${src.dir}/com.oracle.graal.phases"/>
+      <src path="${src.dir}/com.oracle.graal.phases.common"/>
+      <src path="${src.dir}/com.oracle.graal.virtual"/>
+      <src path="${src.dir}/com.oracle.graal.loop"/>
+      <src path="${src.dir}/com.oracle.graal.alloc"/>
+      <src path="${src.dir}/com.oracle.graal.asm"/>
+      <src path="${src.dir}/com.oracle.graal.lir"/>
+      <src path="${src.dir}/com.oracle.graal.compiler"/>
+      <src path="${src.dir}/com.oracle.graal.bytecode"/>
+      <src path="${src.dir}/com.oracle.graal.java"/>
+      <src path="${src.dir}/com.oracle.graal.word"/>
+      <src path="${src.dir}/com.oracle.graal.snippets"/>
+      <src path="${src.dir}/com.oracle.graal.api.runtime"/>
+      <src path="${src.dir}/com.oracle.graal.printer"/>
+      <src path="${src.dir}/com.oracle.graal.hotspot"/>
+      <src path="${src.dir}/com.oracle.graal.amd64"/>
+      <src path="${src.dir}/com.oracle.graal.asm.amd64"/>
+      <src path="${src.dir}/com.oracle.graal.lir.amd64"/>
+      <src path="${src.dir}/com.oracle.graal.compiler.amd64"/>
+      <src path="${src.dir}/com.oracle.graal.hotspot.amd64"/>
+      <src path="${src.dir}/com.oracle.graal.sparc"/>
+      <src path="${src.dir}/com.oracle.graal.asm.sparc"/>
+      <src path="${src.dir}/com.oracle.graal.lir.sparc"/>
+      <src path="${src.dir}/com.oracle.graal.compiler.sparc"/>
+      <src path="${src.dir}/com.oracle.graal.hotspot.sparc"/>
       <compilerarg value="-XDignore.symbol.file"/>
     </javac>
   </target>
-
-  <target name="jar" depends="compile">
+  <target depends="compile" name="jar">
     <mkdir dir="${jar.dir}"/>
-    <jar destfile="${jar.file}" basedir="${classes.dir}"/>
+    <jar basedir="${classes.dir}" destfile="${jar.file}"/>
   </target>
-
   <target name="clean">
     <delete dir="${classes.dir}"/>
-    <delete file="${jar.file}"/>
+    <delete file="${jar.filr}"/>
   </target>
 </project>
--- a/mx/commands.py	Fri Mar 15 15:38:55 2013 +0100
+++ b/mx/commands.py	Fri Mar 15 18:09:19 2013 +0100
@@ -52,31 +52,6 @@
 
 _make_eclipse_launch = False
 
-_copyrightTemplate = """/*
- * Copyright (c) {0}, 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.
- *
- * 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.
- */
-
-"""
-
 _minVersion = mx.JavaVersion('1.7.0_04')
 
 def _chmodDir(chmodFlags, dirname, fnames):
@@ -462,6 +437,71 @@
     build = _vmbuild if _vmSourcesAvailable else 'product'
     print join(_graal_home, 'jdk' + str(mx.java().version), build)
 
+def initantbuild(args):
+    """(re)generates an ant build file for producing graal.jar"""
+    parser=ArgumentParser(prog='mx initantbuild')
+    parser.add_argument('-f', '--buildfile', help='file to generate', default=join(_graal_home, 'make', 'build-graal.xml'))
+
+    args = parser.parse_args(args)
+    
+    out = mx.XMLDoc()
+    
+    out.comment("""
+ Copyright (c) 2013, 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.
+""")
+    
+    out.open('project', {'name' : 'graal', 'default' : 'main', 'basedir' : '.'})
+    out.element('property', {'name' : 'src.dir', 'value' : '${gamma.dir}/graal'})
+    out.element('property', {'name' : 'classes.dir', 'value' : '${shared.dir}/graal'})
+    out.element('property', {'name' : 'jar.dir', 'value' : '${shared.dir}'})
+    out.element('property', {'name' : 'jar.file', 'value' : '${jar.dir}/graal.jar'})
+    
+    out.element('target', {'name' : 'main', 'depends' : 'jar'})
+
+    out.open('target', {'name' : 'compile'})
+    out.element('mkdir', {'dir' : '${classes.dir}'})
+    out.open('javac', {'destdir' : '${classes.dir}', 'debug' : 'on', 'includeantruntime' : 'false', })
+    for p in mx.sorted_deps(mx.distribution('GRAAL').deps):
+        out.element('src', {'path' : '${src.dir}/' + p.name})
+    out.element('compilerarg', {'value' : '-XDignore.symbol.file'})
+    out.close('javac')
+    out.close('target')
+
+    out.open('target', {'name' : 'jar', 'depends' : 'compile'})
+    out.element('mkdir', {'dir' : '${jar.dir}'})
+    out.element('jar', {'destfile' : '${jar.file}', 'basedir' : '${classes.dir}'})
+    out.close('target')
+    
+    out.open('target', {'name' : 'clean'})
+    out.element('delete', {'dir' : '${classes.dir}'})
+    out.element('delete', {'file' : '${jar.filr}'})
+    out.close('target')
+
+    out.close('project')
+    
+    mx.update_file(args.buildfile, out.xml(indent='  ', newl='\n'))
+
 def build(args, vm=None):
     """build the VM binary
 
@@ -490,6 +530,8 @@
     else:
         assert vm == 'graal', vm
         buildSuffix = 'graal'
+        
+    initantbuild([])
 
     for build in builds:
         if build == 'ide-build-target':
@@ -1132,6 +1174,7 @@
         'clean': [clean, ''],
         'hsdis': [hsdis, '[att]'],
         'hcfdis': [hcfdis, ''],
+        'initantbuild' : [initantbuild, '[-options]'],
         'igv' : [igv, ''],
         'jdkhome': [jdkhome, ''],
         'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'],
--- a/mxtool/mx.py	Fri Mar 15 15:38:55 2013 +0100
+++ b/mxtool/mx.py	Fri Mar 15 18:09:19 2013 +0100
@@ -630,6 +630,9 @@
         e.ownerDocument = self
         return e
 
+    def comment(self, txt):
+        self.current.appendChild(self.createComment(txt))
+
     def open(self, tag, attributes={}, data=None):
         element = self.createElement(tag)
         for key, value in attributes.items():