From 1c87385affed1187a6424c1f1414639794cc685e Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Sat, 21 Jul 2018 11:34:29 +0100 Subject: [PATCH] Proof of concept: support compilation from tarball Signed-off-by: Stefan Marr --- mx.py | 8 +++++--- mx_tar_vcs.py | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 mx_tar_vcs.py diff --git a/mx.py b/mx.py index c64843e6..eb4ea9de 100755 --- a/mx.py +++ b/mx.py @@ -132,6 +132,8 @@ def no_suite_discovery(func): import mx_benchplot import mx_downstream import mx_subst +import mx_tar_vcs + from mx_javamodules import JavaModuleDescriptor, make_java_module, get_java_module_info, lookup_package @@ -4751,7 +4753,7 @@ def cleanForbidden(self): class VC(object): __metaclass__ = ABCMeta """ - base class for all supported Distriuted Version Constrol abstractions + base class for all supported Distributed Version Control abstractions :ivar str kind: the VC type identifier :ivar str proper_name: the long name descriptor of the VCS @@ -7667,7 +7669,7 @@ def parse_specification(import_dict, context, importer, dynamicImport=False): if version_from and version: abort("In import for '{}': 'version' and 'versionFrom' can not be both set".format(name), context=context) if version is None and version_from is None: - if not (in_subdir and (importer.vc_dir != importer.dir or isinstance(importer, BinarySuite))): + if not (in_subdir and (importer.vc_dir != importer.dir or isinstance(importer, BinarySuite) or isinstance(importer.vc, mx_tar_vcs.TarVC))): abort("In import for '{}': No version given and not a 'subdir' suite of the same repository".format(name), context=context) if importer.isSourceSuite(): suite_dir = join(importer.vc_dir, name) @@ -17863,7 +17865,7 @@ def main(): _opts.__dict__['very_verbose'] = '-V' in sys.argv _opts.__dict__['warn'] = '--no-warning' not in sys.argv global _vc_systems - _vc_systems = [HgConfig(), GitConfig(), BinaryVC()] + _vc_systems = [HgConfig(), GitConfig(), BinaryVC(), mx_tar_vcs.TarVC()] global _mx_suite _mx_suite = MXSuite() diff --git a/mx_tar_vcs.py b/mx_tar_vcs.py new file mode 100644 index 00000000..fe1d68ef --- /dev/null +++ b/mx_tar_vcs.py @@ -0,0 +1,27 @@ +import time + + +class TarVC(object): + """ Proof of concept for building from a tarball. """ + + def check(self, abortOnError=True): + return self + + def root(self, directory, abortOnError=True): + # TODO: figure out how to do this without hard coding. Some meta data? + if directory.endswith("/compiler"): + return directory[:-len("/compiler")] + if directory.endswith("/truffle"): + return directory[:-len("/truffle")] + if directory.endswith("/tools"): + return directory[:-len("/tools")] + if directory.endswith("/sdk"): + return directory[:-len("/sdk")] + + return directory + + def release_version_from_tags(self, vcdir, prefix, snapshotSuffix='dev', abortOnError=True): + return None + + def parent(self, vcdir, abortOnError=True): + return 'unknown-{0}'.format(time.strftime('%Y-%m-%d_%H-%M-%S_%Z'))