changeset 4178:d1b26c17910a

Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 02 Jan 2012 21:52:23 +0100
parents c843578c269d
children 816a4408a853
files mx/commands.py mx/projects mxtool/mx.py
diffstat 3 files changed, 27 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Mon Jan 02 17:47:48 2012 +0100
+++ b/mx/commands.py	Mon Jan 02 21:52:23 2012 +0100
@@ -152,10 +152,13 @@
         'xalan'
     ]
     
-    dacapo = mx.check_get_env('DACAPO_CP')
+    dacapo = mx.get_env('DACAPO_CP')
+    if dacapo is None:
+        dacapo = _graal_home + r'/lib/dacapo-9.12-bach.jar'
+    
     if not isfile(dacapo) or not dacapo.endswith('.jar'):
         mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
-            
+        
     vmOpts = ['-Xms1g', '-Xmx2g', '-cp', dacapo]
 
     selected = []
@@ -597,6 +600,6 @@
         mx.abort('Requires Java version 1.7 or greater, got version ' + version)
 
     if (_vmSourcesAvailable):
-        global _vmbuild
-        if not opts.vmbuild is None:
+        if hasattr(opts, 'vmbuild'):
+            global _vmbuild
             _vmbuild = opts.vmbuild
--- a/mx/projects	Mon Jan 02 17:47:48 2012 +0100
+++ b/mx/projects	Mon Jan 02 21:52:23 2012 +0100
@@ -27,6 +27,7 @@
 # Values can use environment variables with the syntax used in a Bash shell script.
 #
 
+
 library@JDK_TOOLS@path=${JAVA_HOME}/lib/tools.jar
 library@JDK_TOOLS@optional=true
 
@@ -37,6 +38,9 @@
 library@CHECKSTYLE@path=lib/checkstyle-5.5-all.jar
 library@CHECKSTYLE@urls=jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/5.5/checkstyle-5.5-bin.zip/download!/checkstyle-5.5/checkstyle-5.5-all.jar
 
+library@DACAPO@path=lib/dacapo-9.12-bach.jar
+library@DACAPO@urls=http://dfn.dl.sourceforge.net/project/dacapobench/9.12-bach/dacapo-9.12-bach.jar
+
 # graal.hotspot
 project@com.oracle.max.graal.hotspot@subDir=graal
 project@com.oracle.max.graal.hotspot@sourceDirs=src
--- a/mxtool/mx.py	Mon Jan 02 17:47:48 2012 +0100
+++ b/mxtool/mx.py	Mon Jan 02 21:52:23 2012 +0100
@@ -214,6 +214,7 @@
             path = join(self.suite.dir, path)
         if resolve and self.mustExist and not exists(path):
             assert not len(self.urls) == 0, 'cannot find required library  ' + self.name + " " + path;
+            print('Downloading ' + self.name + ' from ' + str(self.urls))
             download(path, self.urls)
         return path
         
@@ -290,6 +291,7 @@
             urls = pop_list(attrs, 'urls')
             l = Library(self, name, path, mustExist, urls)
             l.__dict__.update(attrs)
+            l.get_path(True)
             self.libs.append(l)
         
     def _load_commands(self, mxDir):
@@ -629,11 +631,18 @@
     """
     Gets an environment variable, aborting with a useful message if it is not set.
     """
-    value = os.environ.get(key)
+    value = get_env(key)
     if value is None:
         abort('Required environment variable ' + key + ' must be set')
     return value
 
+def get_env(key):
+    """
+    Gets an environment variable.
+    """
+    value = os.environ.get(key)
+    return value
+
 def log(msg=None):
     """
     Write a message to the console.
@@ -719,12 +728,12 @@
             
                 zf = zipfile.ZipFile(zipdata, 'r')
                 data = zf.read(entry)
-                with open(path, 'w') as f:
+                with open(path, 'wb') as f:
                     f.write(data)
             else:
                 with contextlib.closing(url_open(url)) as f:
                     data = f.read()
-                with open(path, 'w') as f:
+                with open(path, 'wb') as f:
                     f.write(data)
             return
         except IOError as e:
@@ -849,7 +858,7 @@
             built.add(p.name)
 
             argfileName = join(p.dir, 'javafilelist.txt')
-            argfile = open(argfileName, 'w')
+            argfile = open(argfileName, 'wb')
             argfile.write('\n'.join(javafilelist))
             argfile.close()
             
@@ -1139,8 +1148,6 @@
                 _loadSuite(path)
                 
     cwdMxDir = join(os.getcwd(), 'mx')
-    if exists(cwdMxDir) and isdir(cwdMxDir):
-        _loadSuite(os.getcwd(), True)
             
     opts, commandAndArgs = _argParser._parse_cmd_line()
     
@@ -1148,6 +1155,9 @@
     _opts = opts
     _java = JavaConfig(opts)
     
+    if exists(cwdMxDir) and isdir(cwdMxDir):
+        _loadSuite(os.getcwd(), True)
+    
     for s in suites():
         if s.commands is not None and hasattr(s.commands, 'mx_post_parse_cmd_line'):
             s.commands.mx_post_parse_cmd_line(opts)