Mercurial > hg > graal-compiler
changeset 21098:5d09e1eda922
Only extract service files for Graal services
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Thu, 23 Apr 2015 13:31:20 +0200 |
parents | 391f94d4d23f |
children | 3f51d02e536f |
files | mx/mx_graal.py |
diffstat | 1 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mx/mx_graal.py Thu Apr 23 14:48:52 2015 +0200 +++ b/mx/mx_graal.py Thu Apr 23 13:31:20 2015 +0200 @@ -594,6 +594,30 @@ shutil.move(tmp, dstLib) os.chmod(dstLib, permissions) +def _isGraalService(className, graalJars): + javap = mx.java().javap + output = subprocess.check_output([javap, '-cp', os.pathsep.join(graalJars), className], stderr=subprocess.STDOUT) + lines = output.split(os.linesep) + decl = 'public interface ' + className + for line in lines: + if line.startswith(decl): + declLine = line.strip() + break + if not declLine: + mx.abort('Could not find interface for service ' + className + ':\n' + output) + afterName = declLine[len(decl):] + if not afterName.startswith(' extends '): + return False + superInterfaces = afterName[len(' extends '):-len(' {')].split(',') + if 'com.oracle.graal.api.runtime.Service' in superInterfaces: + return True + for superInterface in superInterfaces: + if '<' in superInterface: + superInterface = superInterface[:superInterface.index('<')] + if _isGraalService(superInterface, graalJars): + return True + return False + def _updateGraalServiceFiles(jdkDir): jreGraalDir = join(jdkDir, 'jre', 'lib', 'graal') graalJars = [join(jreGraalDir, e) for e in os.listdir(jreGraalDir) if e.startswith('graal') and e.endswith('.jar')] @@ -609,7 +633,9 @@ continue serviceName = basename(member) # we don't handle directories - assert serviceName + assert serviceName and member == 'META-INF/services/' + serviceName + if not _isGraalService(serviceName, graalJars): + continue target = join(jreGraalServicesDir, serviceName) lines = [] with zf.open(member) as serviceFile: