Skip to content

Commit 74063f1

Browse files
Merge pull request #58 from NativeScript/vladimirov/java13
fix: Java 13 is not supported, but it is not detected as such
2 parents f91056b + e28b334 commit 74063f1

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

lib/android-tools-info.ts

+3-2
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) {

lib/sys-info.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,15 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
275275
try {
276276
const spawnResult = await this.childProcess.spawnFromEvent("pod", ["install"], "exit", { spawnOptions: { cwd: xcodeProjectDir } });
277277
if (spawnResult.exitCode) {
278+
this.fileSystem.deleteEntry(tempDirectory);
278279
return false;
279280
} else {
280-
return this.fileSystem.exists(path.join(xcodeProjectDir, "cocoapods.xcworkspace"));
281+
const exists = this.fileSystem.exists(path.join(xcodeProjectDir, "cocoapods.xcworkspace"));
282+
this.fileSystem.deleteEntry(tempDirectory);
283+
return exists;
281284
}
282285
} catch (err) {
286+
this.fileSystem.deleteEntry(tempDirectory);
283287
return null;
284288
}
285289
} else {

lib/wrappers/file-system.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as fs from "fs";
22
import * as path from "path";
33
import * as yauzl from "yauzl";
44
import * as util from "util";
5+
import * as shelljs from "shelljs";
56

67
const access = util.promisify(fs.access);
78
const mkdir = util.promisify(fs.mkdir);
@@ -58,6 +59,10 @@ export class FileSystem {
5859
const content = fs.readFileSync(filePath, options);
5960
return JSON.parse(content.toString());
6061
}
62+
63+
public deleteEntry(filePath: string): void {
64+
shelljs.rm("-rf", filePath);
65+
}
6166
}
6267

6368
function createParentDirsIfNeeded(filePath: string) {

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-doctor",
3-
"version": "1.12.0",
3+
"version": "1.13.0",
44
"description": "Library that helps identifying if the environment can be used for development of {N} apps.",
55
"main": "lib/index.js",
66
"types": "./typings/nativescript-doctor.d.ts",
@@ -28,6 +28,7 @@
2828
"@types/mocha": "2.2.32",
2929
"@types/rimraf": "2.0.2",
3030
"@types/semver": "5.5.0",
31+
"@types/shelljs": "0.8.6",
3132
"@types/temp": "0.8.29",
3233
"@types/winreg": "1.2.30",
3334
"@types/yauzl": "2.9.0",
@@ -49,8 +50,9 @@
4950
"lodash": "4.17.15",
5051
"osenv": "0.1.3",
5152
"semver": "5.5.1",
53+
"shelljs": "0.7.6",
5254
"temp": "0.8.3",
5355
"winreg": "1.2.2",
5456
"yauzl": "2.10.0"
5557
}
56-
}
58+
}

test/android-tools-info.ts

+10-2
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)