cmd/gogio: add support for OpenJDK to java version detection

When the `d8` command from the Android SDK fails because of an incompatible
java version, the error message is cryptic. Before reporting the errors, we
attempt to detect incompatible versions and report a clearer error. This change
adds support for OpenJDK as well as other vendors to the detection logic.

Fixes: https://todo.sr.ht/~eliasnaur/gio/342
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-01-15 18:29:38 +01:00
parent c4f98d3c1e
commit 2879fe8b41
+2 -1
View File
@@ -595,8 +595,9 @@ func determineJDKVersion() (int, int, bool) {
if err != nil {
return 0, 0, false
}
var vendor string
var major, minor int
_, err = fmt.Sscanf(string(out), "java version \"%d.%d", &major, &minor)
_, err = fmt.Sscanf(string(out), "%s version \"%d.%d", &vendor, &major, &minor)
return major, minor, err == nil
}