2424 */
2525package org .graalvm .compiler .hotspot ;
2626
27- import java .io .IOException ;
28- import java .io .UncheckedIOException ;
29- import java .nio .file .Files ;
30- import java .nio .file .Paths ;
3127import java .util .Formatter ;
3228import java .util .HashMap ;
3329import java .util .Map ;
@@ -54,21 +50,13 @@ public static class Version {
5450 private final int minor ;
5551 private final int build ;
5652
57- static Version parse (String vmVersion , Map < String , String > props ) {
53+ static Version parse (String vmVersion ) {
5854 Matcher m = Pattern .compile (".*-jvmci-(\\ d+)\\ .(\\ d+)-b(\\ d+).*" ).matcher (vmVersion );
5955 if (m .matches ()) {
6056 try {
6157 int major = Integer .parseInt (m .group (1 ));
6258 int minor = Integer .parseInt (m .group (2 ));
6359 int build = Integer .parseInt (m .group (3 ));
64- String jvmciVersionFile = props .get ("JVMCIVersionCheck.jvmci.version.file" );
65- if (jvmciVersionFile != null ) {
66- try {
67- Files .write (Paths .get (jvmciVersionFile ), String .format ("%d,%d,%d" , major , minor , build ).getBytes ());
68- } catch (IOException e ) {
69- throw new UncheckedIOException (e );
70- }
71- }
7260 return new Version (major , minor , build );
7361 } catch (NumberFormatException e ) {
7462 // ignore
@@ -163,9 +151,9 @@ private JVMCIVersionCheck(Map<String, String> props, String javaSpecVersion, Str
163151 this .vmVersion = vmVersion ;
164152 }
165153
166- static void check (Map <String , String > props , boolean exitOnFailure ) {
154+ static void check (Map <String , String > props , boolean exitOnFailure , boolean quiet ) {
167155 JVMCIVersionCheck checker = new JVMCIVersionCheck (props , props .get ("java.specification.version" ), props .get ("java.vm.version" ));
168- checker .run (exitOnFailure , JVMCI_MIN_VERSION );
156+ checker .run (exitOnFailure , JVMCI_MIN_VERSION , quiet );
169157 }
170158
171159 /**
@@ -176,10 +164,10 @@ public static void check(Map<String, String> props,
176164 String javaSpecVersion ,
177165 String javaVmVersion , boolean exitOnFailure ) {
178166 JVMCIVersionCheck checker = new JVMCIVersionCheck (props , javaSpecVersion , javaVmVersion );
179- checker .run (exitOnFailure , minVersion );
167+ checker .run (exitOnFailure , minVersion , true );
180168 }
181169
182- private void run (boolean exitOnFailure , Version minVersion ) {
170+ private void run (boolean exitOnFailure , Version minVersion , boolean quiet ) {
183171 if (javaSpecVersion .compareTo ("11" ) < 0 ) {
184172 failVersionCheck (exitOnFailure , "Graal requires JDK 11 or later.%n" );
185173 } else {
@@ -192,8 +180,11 @@ private void run(boolean exitOnFailure, Version minVersion) {
192180 }
193181 if (vmVersion .contains ("-jvmci-" )) {
194182 // A "labsjdk"
195- Version v = Version .parse (vmVersion , props );
183+ Version v = Version .parse (vmVersion );
196184 if (v != null ) {
185+ if (!quiet ) {
186+ System .out .println (String .format ("%d,%d,%d" , v .major , v .minor , v .build ));
187+ }
197188 if (v .isLessThan (minVersion )) {
198189 failVersionCheck (exitOnFailure , "The VM does not support the minimum JVMCI API version required by Graal: %s < %s.%n" , v , minVersion );
199190 }
@@ -216,6 +207,6 @@ public static void main(String[] args) {
216207 for (String name : sprops .stringPropertyNames ()) {
217208 props .put (name , sprops .getProperty (name ));
218209 }
219- check (props , true );
210+ check (props , true , false );
220211 }
221212}
0 commit comments