Skip to content

Commit

Permalink
mx.fastr: remove unnecessary delegation to mx_fastr_dists
Browse files Browse the repository at this point in the history
  • Loading branch information
Mick Jordan committed Sep 13, 2016
1 parent 14e928f commit 13b57ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.
26 changes: 1 addition & 25 deletions mx.fastr/mx_fastr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import mx_gate
import mx_fastr_pkgs
import mx_fastr_dists
from mx_fastr_dists import FastRNativeProject, FastRTestNativeProject, FastRReleaseProject #pylint: disable=unused-import
import os

'''
Expand Down Expand Up @@ -500,31 +501,6 @@ def rcmplib(args):
cp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites()])
mx.run_java(['-cp', cp, 'com.oracle.truffle.r.test.tools.cmpr.CompareLibR'] + cmpArgs)

class FastRNativeProject(mx_fastr_dists.DelFastRNativeProject):
'''
Custom class for building the com.oracle.truffle.r.native project.
Delegates to mx_fastr_dists.DelFastRNativeProject to keep this file uncluttered
'''
def __init__(self, suite, name, deps, workingSets, theLicense, **args):
mx_fastr_dists.DelFastRNativeProject.__init__(self, suite, name, deps, workingSets, theLicense)

class FastRTestNativeProject(mx_fastr_dists.DelFastRTestNativeProject):
'''
Custom class for building the com.oracle.truffle.r.test.native project.
Delegates to mx_fastr_dists.DelFastRTestNativeProject to keep this file uncluttered
'''
def __init__(self, suite, name, deps, workingSets, theLicense, **args):
mx_fastr_dists.DelFastRTestNativeProject.__init__(self, suite, name, deps, workingSets, theLicense)

class FastRReleaseProject(mx_fastr_dists.DelFastRReleaseProject):
'''
Custom class for creating the FastR release project, which supports the
FASTR_RELEASE distribution.
Delegates to mx_fastr_dists.DelFastRReleaseProject to keep this file uncluttered
'''
def __init__(self, suite, name, deps, workingSets, theLicense, **args):
mx_fastr_dists.DelFastRReleaseProject.__init__(self, suite, name, deps, workingSets, theLicense)

def mx_post_parse_cmd_line(opts):
mx_fastr_dists.mx_post_parse_cmd_line(opts)

Expand Down
21 changes: 17 additions & 4 deletions mx.fastr/mx_fastr_dists.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _get_files(self, d, results, filterfun=None):
results.append(join(root, f))


class DelFastRNativeProject(FastRProjectAdapter):
class FastRNativeProject(FastRProjectAdapter):
'''
Custom class for building the com.oracle.truffle.r.native project.
The customization is to support the creation of an exact FASTR_NATIVE_DEV distribution.
Expand Down Expand Up @@ -111,7 +111,7 @@ def is_ddot_o(f):

return results

class DelFastRTestNativeProject(FastRProjectAdapter):
class FastRTestNativeProject(FastRProjectAdapter):
'''
Custom class for building the com.oracle.truffle.r.native project.
The customization is to support the creation of an exact FASTR_NATIVE_DEV distribution.
Expand Down Expand Up @@ -147,7 +147,7 @@ def getResults(self):
results.append(join(self.dir, 'urand', 'lib', 'liburand.so'))
return results

class DelFastRReleaseProject(FastRProjectAdapter):
class FastRReleaseProject(FastRProjectAdapter):
'''
Custom class for creating the FastR release project, which supports the
FASTR_RELEASE distribution.
Expand All @@ -159,6 +159,7 @@ def getResults(self):
results = []
for rdir in ['bin', 'lib', 'library', 'etc', 'share', 'doc']:
self._get_files(rdir, results)
results.append(join(self.dir, 'LICENSE.FASTR'))
return results

def getBuildTask(self, args):
Expand Down Expand Up @@ -186,6 +187,18 @@ def build(self):
if os.path.exists(target_dir):
shutil.rmtree(target_dir)
shutil.copytree(join(fastr_dir, d), target_dir)

# copyrights
copyrights_dir = join(fastr_dir,'mx.fastr', 'copyrights')
with open(join(output_dir, 'LICENSE.FASTR'), 'w') as outfile:
for copyright_file in os.listdir(copyrights_dir):
basename = os.path.basename(copyright_file)
if not basename.endswith('copyright.star') and not basename.endswith('copyright.hash'):
continue
with open(join(copyrights_dir, copyright_file)) as infile:
data = infile.read()
outfile.write(data)

# canonicalize R_HOME_DIR in bin/R
bin_dir = join(output_dir, 'bin')
rcmd = join(bin_dir, 'R')
Expand Down Expand Up @@ -256,7 +269,7 @@ def __opened__(self, arc, srcArc, services):
# Since we have already encapsulated the class files in 'jjars/fastr.jar' we
# suppress their inclusion here by resetting the deps filed. A bit of a hack.
if self.dist.name == "FASTR_RELEASE":
assert isinstance(self.dist.deps[0], DelFastRReleaseProject)
assert isinstance(self.dist.deps[0], FastRReleaseProject)
self.dist.deps[0].deps = []

def __add__(self, arcname, contents):
Expand Down

0 comments on commit 13b57ed

Please sign in to comment.