Java 8 compatibility
Stefan Marr
java at stefan-marr.de
Fri Apr 24 09:06:26 UTC 2015
Hi Thomas:
> On 04 Apr 2015, at 23:59, Thomas Wuerthinger <thomas.wuerthinger at oracle.com> wrote:
>
> We would be interested in a patch like you specify below. The only hard requirement we have is that our gate checks (“mx gate”) need to continue to make sure that projects related to the Truffle API can be built with Java 7.
I would propose something like the patch below.
The idea is to have an additional flag, perhaps `--release`, which is used to enforce the Java compliance levels strictly.
I guess, it would also be necessary for the gate command to set the do_release flag to true implicitly.
So, the main result of this change is that a casual user can build Graal and Truffle easily with only a single JDK available.
I tested it with JDK8u45, and Graal, Truffle, as well as IGV work nicely.
Would that be something that could make it into Graal?
Best regards
Stefan
diff --git a/mx/mx_graal.py b/mx/mx_graal.py
index 8b33dcf..8ca4636 100644
--- a/mx/mx_graal.py
+++ b/mx/mx_graal.py
@@ -2570,6 +2570,7 @@ def mx_init(suite):
mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>')
mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"')
mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"')
+ mx.add_argument('--release', action='store_true', dest='do_release', help='Enforce Java version compliance for release build')
commands.update({
'export': [export, '[-options] [zipfile]'],
diff --git a/mxtool/mx.py b/mxtool/mx.py
index 0a12e8a..38fe930 100755
--- a/mxtool/mx.py
+++ b/mxtool/mx.py
@@ -209,7 +209,7 @@ class Distribution:
elif dep.isProject():
p = dep
- if self.javaCompliance:
+ if self.javaCompliance and _opts.do_release:
if p.javaCompliance > self.javaCompliance:
abort("Compliance level doesn't match: Distribution {0} requires {1}, but {2} is {3}.".format(self.name, self.javaCompliance, p.name, p.javaCompliance))
@@ -310,9 +310,11 @@ class Project(Dependency):
# Verify that a JDK exists for this project if its compliance level is
# less than the compliance level of the default JDK
jdk = java(self.javaCompliance)
- if jdk is None and self.javaCompliance < java().javaCompliance:
+ if jdk is None and self.javaCompliance < java().javaCompliance and _opts.do_release:
abort('Cannot find ' + str(self.javaCompliance) + ' JDK required by ' + name + '. ' +
'Specify it with --extra-java-homes option or EXTRA_JAVA_HOMES environment variable.')
+ elif not _opts.do_release:
+ self.javaCompliance = java().javaCompliance
# Create directories for projects that don't yet exist
if not exists(d):
--
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/
More information about the graal-dev
mailing list