changeset 22018:11ed27b2abe8

remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
author Doug Simon <doug.simon@oracle.com>
date Wed, 17 Jun 2015 15:28:45 +0200
parents 66dd063eb6a0
children 07cfd3d7072b
files mx.graal/.project mx.graal/.pydevproject mx.graal/eclipse-settings/org.eclipse.core.resources.prefs mx.graal/eclipse-settings/org.eclipse.jdt.apt.core.prefs mx.graal/eclipse-settings/org.eclipse.jdt.core.prefs mx.graal/eclipse-settings/org.eclipse.jdt.ui.prefs mx.graal/mx_graal.py mx.graal/mx_graal_makefile.py mx.graal/outputparser.py mx.graal/sanitycheck.py mx.graal/suite.py mxtool/mx.py
diffstat 2 files changed, 17 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mx.graal/mx_graal.py	Wed Jun 17 13:56:55 2015 +0200
+++ b/mx.graal/mx_graal.py	Wed Jun 17 15:28:45 2015 +0200
@@ -38,8 +38,8 @@
 import fnmatch
 import mx_graal_makefile
 
-# This works because when mx loads this file, it makes sure __file__ gets an absolute path
-_graal_home = dirname(dirname(__file__))
+_suite = mx.suite('graal')
+_graal_home = _suite.dir
 
 """ Used to distinguish an exported GraalVM (see 'mx export'). """
 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src'))
@@ -123,7 +123,7 @@
     if _vm:
         return _vm
     vm = mx.get_env('DEFAULT_VM')
-    envPath = join(_graal_home, 'mx', 'env')
+    envPath = join(_suite.mxDir, 'env')
     if vm and 'graal' in vm:
         if exists(envPath):
             with open(envPath) as fp:
@@ -762,7 +762,7 @@
         mx.log(textwrap.fill(buildVars[n], initial_indent='    ', subsequent_indent='    ', width=200))
 
     mx.log('')
-    mx.log('Note that these variables can be given persistent values in the file ' + join(_graal_home, 'mx', 'env') + ' (see \'mx about\').')
+    mx.log('Note that these variables can be given persistent values in the file ' + join(_suite.mxDir, 'env') + ' (see \'mx about\').')
 
 cached_graal_version = None
 
@@ -1064,7 +1064,7 @@
     _updateInstalledJVMCIOptionsFile(jdk)
     mx.expand_project_in_args(args)
     if _make_eclipse_launch:
-        mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
+        mx.make_eclipse_launch(_suite, args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
     if _jacoco == 'on' or _jacoco == 'append':
         jacocoagent = mx.library("JACOCOAGENT", True)
         # Exclude all compiler tests and snippets
@@ -2066,7 +2066,7 @@
     # Ensure the mx injected dependencies are up to date
     makejmhdeps(['-p'] + (['-s', args.settings] if args.settings else []))
 
-    timestamp = mx.TimeStampFile(join(_graal_home, 'mx', 'jmh', jmhPath.replace(os.sep, '_') + '.timestamp'))
+    timestamp = mx.TimeStampFile(join(_suite.mxDir, 'jmh', jmhPath.replace(os.sep, '_') + '.timestamp'))
     mustBuild = args.clean
     if not mustBuild:
         try:
@@ -2116,7 +2116,7 @@
 
     benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')]
     jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')]
-    jmhOutDir = join(_graal_home, 'mx', 'jmh')
+    jmhOutDir = join(_suite.mxDir, 'jmh')
     if not exists(jmhOutDir):
         os.makedirs(jmhOutDir)
     jmhOut = join(jmhOutDir, 'jmh.out')
--- a/mxtool/mx.py	Wed Jun 17 13:56:55 2015 +0200
+++ b/mxtool/mx.py	Wed Jun 17 15:28:45 2015 +0200
@@ -1013,12 +1013,12 @@
         self.primary = primary
         self.requiredMxVersion = None
         self.name = _suitename(mxDir)  # validated in _load_projects
+        _suites[self.name] = self
         if load:
             # just check that there are no imports
             self._load_imports()
             self._load_env()
             self._load_commands()
-        _suites[self.name] = self
 
     def __str__(self):
         return self.name
@@ -3847,7 +3847,7 @@
     launchFile = join(eclipseLaunches, name + '.launch')
     return update_file(launchFile, launch), launchFile
 
-def make_eclipse_launch(javaArgs, jre, name=None, deps=None):
+def make_eclipse_launch(suite, javaArgs, jre, name=None, deps=None):
     """
     Creates an Eclipse launch configuration file for running/debugging a Java command.
     """
@@ -3909,7 +3909,7 @@
     launch.close('launchConfiguration')
     launch = launch.xml(newl='\n', standalone='no') % slm.xml(escape=True, standalone='no')
 
-    eclipseLaunches = join('mx', 'eclipse-launches')
+    eclipseLaunches = join(suite.mxDir, 'eclipse-launches')
     if not exists(eclipseLaunches):
         os.makedirs(eclipseLaunches)
     return update_file(join(eclipseLaunches, name + '.launch'), launch)
@@ -5676,11 +5676,9 @@
 def _suitename(mxDir):
     base = os.path.basename(mxDir)
     parts = base.split('.')
-    # temporary workaround until mx.graal exists
-    if len(parts) == 1:
-        return 'graal'
-    else:
-        return parts[1]
+    assert len(parts) == 2
+    assert parts[0] == 'mx'
+    return parts[1]
 
 def _is_suite_dir(d, mxDirName=None):
     """
@@ -5688,11 +5686,10 @@
     If mxDirName is None, matches any suite name, otherwise checks for exactly that suite.
     """
     if os.path.isdir(d):
-        for f in os.listdir(d):
-            if (mxDirName == None and (f == 'mx' or fnmatch.fnmatch(f, 'mx.*'))) or f == mxDirName:
-                mxDir = join(d, f)
-                if exists(mxDir) and isdir(mxDir) and (exists(join(mxDir, 'suite.py'))):
-                    return mxDir
+        for f in [mxDirName] if mxDirName else [e for e in os.listdir(d) if e.startswith('mx.')]:
+            mxDir = join(d, f)
+            if exists(mxDir) and isdir(mxDir) and (exists(join(mxDir, 'suite.py'))):
+                return mxDir
 
 def _check_primary_suite():
     if _primary_suite is None: