# HG changeset patch # User Thomas Wuerthinger # Date 1433333742 -7200 # Node ID 696baf53a985e2653aaaab9771e07fd81a682f15 # Parent ca140f8c35bedbc847ac99c82fc42a4cac7ea032# Parent dd987b035a0b7d46d8fc6f0cf65fa14488a3d924 Merge. diff -r ca140f8c35be -r 696baf53a985 graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java --- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Wed Jun 03 14:08:29 2015 +0200 +++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Wed Jun 03 14:15:42 2015 +0200 @@ -40,8 +40,8 @@ if (access != null) { GraalRuntime rt = access.getRuntime(); // The constant is patched in-situ by the build system - System.setProperty("graal.version", "@@graal.version@@".trim()); - assert !System.getProperty("graal.version").startsWith("@@") && !System.getProperty("graal.version").endsWith("@@") : "Graal version string constant was not patched by build system"; + System.setProperty("graal.version", "@@@@@@@@@@@@@@@@graal.version@@@@@@@@@@@@@@@@".trim()); + assert !System.getProperty("graal.version").startsWith("@@@@@@@@@@@@@@@@") && !System.getProperty("graal.version").endsWith("@@@@@@@@@@@@@@@@") : "Graal version string constant was not patched by build system"; return rt; } return new InvalidGraalRuntime(); diff -r ca140f8c35be -r 696baf53a985 mx/mx_graal.py --- a/mx/mx_graal.py Wed Jun 03 14:08:29 2015 +0200 +++ b/mx/mx_graal.py Wed Jun 03 14:15:42 2015 +0200 @@ -620,16 +620,23 @@ def _patchGraalVersionConstant(dist): """ - Patches the constant "@@graal.version@@" in the constant pool of Graal.class + Patches the constant "@@@@@@@@@@@@@@@@graal.version@@@@@@@@@@@@@@@@" in the constant pool of Graal.class with the computed Graal version string. """ zf = zipfile.ZipFile(dist.path, 'r') graalClassfilePath = 'com/oracle/graal/api/runtime/Graal.class' graalClassfile = zf.read(graalClassfilePath) - versionSpec = '{:' + str(len('@@graal.version@@')) + '}' + placeholder = '@@@@@@@@@@@@@@@@graal.version@@@@@@@@@@@@@@@@' + placeholderLen = len(placeholder) + versionSpec = '{:' + str(placeholderLen) + '}' versionStr = versionSpec.format(graal_version()) - if '@@graal.version@@' not in graalClassfile: - assert versionStr in graalClassfile, 'could not find "@@graal.version@@" or "' + versionStr + '" constant in ' + dist.path + '!' + graalClassfilePath + + if len(versionStr) > placeholderLen: + # Truncate the version string if necessary + assert versionStr.startswith('unknown'), versionStr + versionStr = versionStr[:placeholderLen] + if placeholder not in graalClassfile: + assert versionStr in graalClassfile, 'could not find "' + placeholder + '" or "' + versionStr + '" constant in ' + dist.path + '!' + graalClassfilePath zf.close() return False @@ -637,7 +644,7 @@ zfOut = zipfile.ZipFile(zfOutPath, 'w') for zi in zf.infolist(): if zi.filename == graalClassfilePath: - data = graalClassfile.replace('@@graal.version@@', versionStr) + data = graalClassfile.replace(placeholder, versionStr) else: data = zf.read(zi) zfOut.writestr(zi, data)