From 7bad4221bd48ef9c9ca8e83289ad2587ae9b3e41 Mon Sep 17 00:00:00 2001
From: Gilles Duboscq <gilles.m.duboscq@oracle.com>
Date: Tue, 10 Apr 2018 14:41:40 +0200
Subject: [PATCH] Adapt to vm changes

---
 mx.fastr/mx_fastr_dists.py | 141 ++++++++++++++++++++-----------------
 1 file changed, 75 insertions(+), 66 deletions(-)

diff --git a/mx.fastr/mx_fastr_dists.py b/mx.fastr/mx_fastr_dists.py
index 95b5b3ff45..d42408a885 100644
--- a/mx.fastr/mx_fastr_dists.py
+++ b/mx.fastr/mx_fastr_dists.py
@@ -26,6 +26,9 @@ import mx_fastr
 import os, string, shutil
 from os.path import join, basename, isfile
 
+_fastr_suite = mx.suite('fastr')
+
+
 class FastRProjectAdapter(mx.ArchivableProject):
     def __init__(self, suite, name, deps, workingSets, theLicense, **args):
         mx.ArchivableProject.__init__(self, suite, name, deps, workingSets, theLicense)
@@ -80,7 +83,7 @@ class ReleaseBuildTask(mx.NativeBuildTask):
             return
         # copy the release directories
         output_dir = self.subject.dir
-        fastr_dir = mx_fastr._fastr_suite.dir
+        fastr_dir = _fastr_suite.dir
         for d in ['bin', 'include', 'library', 'etc', 'share', 'doc']:
             target_dir = join(output_dir, d)
             if os.path.exists(target_dir):
@@ -198,87 +201,93 @@ class FastRArchiveParticipant:
 
 
 def mx_post_parse_cmd_line(opts):
-    for dist in mx_fastr._fastr_suite.dists:
+    for dist in _fastr_suite.dists:
         if isinstance(dist, mx.JARDistribution):
             dist.set_archiveparticipant(FastRArchiveParticipant(dist))
 
 
 def mx_register_dynamic_suite_constituents(register_project, register_distribution):
     rffi = mx.get_env('FASTR_RFFI', '')
-    fastr_release_distribution = mx.JARDistribution(suite=mx_fastr._fastr_suite,
-                                                    name="FASTR_RELEASE" + rffi,
-                                                    subDir=None,
-                                                    path="mxbuild/dists/<os>/<arch>/{rffi}/fastr-release.jar".format(rffi=rffi),
-                                                    sourcesPath=None,
-                                                    deps=["com.oracle.truffle.r.release"],
-                                                    mainClass=None,
-                                                    excludedLibs=[],
-                                                    distDependencies=[],
-                                                    javaCompliance=None,
-                                                    platformDependent=True,
-                                                    theLicense=None)
+    fastr_release_distribution = mx.JARDistribution(
+        suite=_fastr_suite,
+        name="FASTR_RELEASE" + rffi,
+        subDir=None,
+        path="mxbuild/dists/<os>/<arch>/{rffi}/fastr-release.jar".format(rffi=rffi),
+        sourcesPath=None,
+        deps=["com.oracle.truffle.r.release"],
+        mainClass=None,
+        excludedLibs=[],
+        distDependencies=[],
+        javaCompliance=None,
+        platformDependent=True,
+        theLicense=None
+    )
     fastr_release_distribution.description = "a binary release of FastR"
 
-    fastr_graalvm_release = mx.NativeTARDistribution(suite=mx_fastr._fastr_suite,
-                                                     name="FASTR_GRAALVM_RELEASE" + rffi,
-                                                     deps=["com.oracle.truffle.r.release"],
-                                                     path=None,
-                                                     excludedLibs=[],
-                                                     platformDependent=True,
-                                                     theLicense=None,
-                                                     relpath=True,
-                                                     output=None)
+    fastr_graalvm_release = mx.NativeTARDistribution(
+        suite=_fastr_suite,
+        name="FASTR_GRAALVM_RELEASE" + rffi,
+        deps=["com.oracle.truffle.r.release"],
+        path=None,
+        excludedLibs=[],
+        platformDependent=True,
+        theLicense=None,
+        relpath=True,
+        output=None
+    )
 
     register_distribution(fastr_release_distribution)
     register_distribution(fastr_graalvm_release)
 
     if mx.get_env('FASTR_RELEASE') == 'true':
-        fastr_graalvm_release_support = mx.LayoutTARDistribution(suite=mx_fastr._fastr_suite,
-                                                                 name="FASTR_GRAALVM_SUPPORT" + rffi,
-                                                                 deps=[],
-                                                                 layout={
-                                                                     "./": [
-                                                                         {
-                                                                             "source_type": "extracted-dependency",
-                                                                             "dependency": "FASTR_GRAALVM_RELEASE" + rffi,
-                                                                             "path": "*",
-                                                                             "exclude": [
-                                                                                 "COPYRIGHT",
-                                                                                 "LICENSE",
-                                                                                 "README.md",
-                                                                                 "bin/Rscript",
-                                                                                 "bin/fastr_jars",
-                                                                                 "bin/exec/R",
-                                                                             ],
-                                                                         },
-                                                                         {
-                                                                             "source_type": "extracted-dependency",
-                                                                             "dependency": "FASTR_GRAALVM_RELEASE" + rffi,
-                                                                             "path": "bin/fastr_jars/*",
-                                                                             "exclude": [
-                                                                                 "bin/fastr_jars/fastr.jar",
-                                                                                 "bin/fastr_jars/truffle*",
-                                                                                 "bin/fastr_jars/graal-sdk*",
-                                                                             ],
-                                                                         },
-                                                                         "dependency:fastr:GNUR",
-                                                                     ],
-                                                                     "COPYRIGHT_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE{rffi}/COPYRIGHT".format(rffi=rffi),
-                                                                     "LICENSE_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE{rffi}/LICENSE".format(rffi=rffi),
-                                                                     "README_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE{rffi}/README.md".format(rffi=rffi),
-                                                                     "bin/Rscript": "file:com.oracle.truffle.r.release/src/Rscript_legacy",
-                                                                     "bin/exec/R": "file:com.oracle.truffle.r.release/src/R_legacy",
-                                                                     "R-3.4.0.tar.gz" : "dependency:fastr:GNUR",
-                                                                     "legacy/": "dependency:fastr:FASTR_LEGACY_LAUNCHER",
-                                                                 },
-                                                                 path=None,
-                                                                 platformDependent=True,
-                                                                 theLicense=None)
+        fastr_graalvm_release_support = mx.LayoutTARDistribution(
+            suite=_fastr_suite,
+            name="FASTR_GRAALVM_SUPPORT" + rffi,
+            deps=[],
+            layout={
+                "./": [
+                    {
+                        "source_type": "extracted-dependency",
+                        "dependency": "FASTR_GRAALVM_RELEASE" + rffi,
+                        "path": "*",
+                        "exclude": [
+                            "COPYRIGHT",
+                            "LICENSE",
+                            "README.md",
+                            "bin/Rscript",
+                            "bin/fastr_jars",
+                            "bin/exec/R",
+                        ],
+                    },
+                    {
+                        "source_type": "extracted-dependency",
+                        "dependency": "FASTR_GRAALVM_RELEASE" + rffi,
+                        "path": "bin/fastr_jars/*",
+                        "exclude": [
+                            "bin/fastr_jars/fastr.jar",
+                            "bin/fastr_jars/truffle*",
+                            "bin/fastr_jars/graal-sdk*",
+                        ],
+                    },
+                    "dependency:fastr:GNUR",
+                ],
+                "COPYRIGHT_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE{rffi}/COPYRIGHT".format(rffi=rffi),
+                "LICENSE_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE{rffi}/LICENSE".format(rffi=rffi),
+                "README_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE{rffi}/README.md".format(rffi=rffi),
+                "bin/Rscript": "file:com.oracle.truffle.r.release/src/Rscript_legacy",
+                "bin/exec/R": "file:com.oracle.truffle.r.release/src/R_legacy",
+                "R-3.4.0.tar.gz" : "dependency:fastr:GNUR",
+                "legacy/": "dependency:fastr:FASTR_LEGACY_LAUNCHER",
+            },
+            path=None,
+            platformDependent=True,
+            theLicense=None
+        )
         fastr_graalvm_release_support.description = "FastR support distribution for the GraalVM"
         register_distribution(fastr_graalvm_release_support)
 
 
-mx_sdk.register_component(mx_sdk.GraalVmLanguage(
+mx_sdk.register_graalvm_component(mx_sdk.GraalVmLanguage(
     name='FastR',
     id='R',
     documentation_files=['extracted-dependency:fastr:FASTR_GRAALVM_SUPPORT/README_FASTR'],
@@ -293,4 +302,4 @@ mx_sdk.register_component(mx_sdk.GraalVmLanguage(
         'link:<support>/bin/Rscript',
         'link:<support>/bin/exec/R',
     ],
-))
+), _fastr_suite)
-- 
GitLab