Skip to content

Commit c9f7d86

Browse files
fix: Java 13 is not supported, but it is not detected as such
Currently Java 13 is not supported, but if you have it installed, `nativescript-doctor` decides it is okay and allows you to build. At that point you receive non-descriptive error message. Fix the case by forbidding Java 13 and above until we support it.
1 parent f91056b commit c9f7d86

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/android-tools-info.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
3939
private static REQUIRED_BUILD_TOOLS_RANGE_PREFIX = ">=23";
4040
private static VERSION_REGEX = /((\d+\.){2}\d+)/;
4141
private static MIN_JAVA_VERSION = "1.8.0";
42+
private static MAX_JAVA_VERSION = "13.0.0";
4243

4344
private toolsInfo: NativeScriptDoctor.IAndroidToolsInfoData;
4445
public get androidHome(): string {
@@ -120,8 +121,8 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
120121
"^10.0.0": "4.1.0-2018.5.18.1"
121122
};
122123

123-
if (semver.lt(installedJavaCompilerSemverVersion, AndroidToolsInfo.MIN_JAVA_VERSION)) {
124-
warning = `Javac version ${installedJavaCompilerVersion} is not supported. You have to install at least ${AndroidToolsInfo.MIN_JAVA_VERSION}.`;
124+
if (semver.lt(installedJavaCompilerSemverVersion, AndroidToolsInfo.MIN_JAVA_VERSION) || semver.gte(installedJavaCompilerSemverVersion, AndroidToolsInfo.MAX_JAVA_VERSION)) {
125+
warning = `Javac version ${installedJavaCompilerVersion} is not supported. You have to install at least ${AndroidToolsInfo.MIN_JAVA_VERSION} and below ${AndroidToolsInfo.MAX_JAVA_VERSION}.`;
125126
} else {
126127
runtimeVersion = this.getRuntimeVersion({runtimeVersion, projectDir});
127128
if (runtimeVersion) {

test/android-tools-info.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,19 @@ describe("androidToolsInfo", () => {
9797
},
9898
{
9999
javacVersion: "1.7.0",
100-
warnings: ["Javac version 1.7.0 is not supported. You have to install at least 1.8.0."]
100+
warnings: ["Javac version 1.7.0 is not supported. You have to install at least 1.8.0 and below 13.0.0."]
101101
},
102102
{
103103
javacVersion: "1.7.0_132",
104-
warnings: ["Javac version 1.7.0_132 is not supported. You have to install at least 1.8.0."]
104+
warnings: ["Javac version 1.7.0_132 is not supported. You have to install at least 1.8.0 and below 13.0.0."]
105+
},
106+
{
107+
javacVersion: "13.0.0",
108+
warnings: ["Javac version 13.0.0 is not supported. You have to install at least 1.8.0 and below 13.0.0."]
109+
},
110+
{
111+
javacVersion: "14.1.0",
112+
warnings: ["Javac version 14.1.0 is not supported. You have to install at least 1.8.0 and below 13.0.0."]
105113
},
106114
{
107115
javacVersion: null,

0 commit comments

Comments
 (0)