Skip to content

Commit f2d6824

Browse files
Merge pull request #23 from NativeScript/vladimirov/fix-tools-checks
Fix some failures
2 parents d45cffd + 6667032 commit f2d6824

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

lib/android-tools-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as path from "path";
88

99
export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
1010
private static ANDROID_TARGET_PREFIX = "android";
11-
private static SUPPORTED_TARGETS = ["android-17", "android-18", "android-19", "android-21", "android-22", "android-23", "android-24", "android-25"];
11+
private static SUPPORTED_TARGETS = ["android-17", "android-18", "android-19", "android-21", "android-22", "android-23", "android-24", "android-25", "android-26"];
1212
private static MIN_REQUIRED_COMPILE_TARGET = 22;
1313
private static REQUIRED_BUILD_TOOLS_RANGE_PREFIX = ">=23";
1414
private static VERSION_REGEX = /((\d+\.){2}\d+)/;

lib/helpers.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ export class Helpers {
2222
return this.hostInfo.isWindows ? this.cmdQuote(value) : this.bashQuote(value);
2323
}
2424

25+
public appendZeroesToVersion(version: string, requiredVersionLength: number): string {
26+
const zeroesToAppend = requiredVersionLength - version.split(".").length;
27+
for (let index = 0; index < zeroesToAppend; index++) {
28+
version += ".0";
29+
}
30+
31+
return version;
32+
}
33+
2534
private bashQuote(s: string): string {
2635
if (s[0] === "'" && s[s.length - 1] === "'") {
2736
return s;

lib/sys-info.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,10 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
313313
public getXcprojInfo(): Promise<NativeScriptDoctor.IXcprojInfo> {
314314
return this.getValueForProperty(() => this.xcprojInfoCache, async (): Promise<NativeScriptDoctor.IXcprojInfo> => {
315315
const cocoaPodsVersion = await this.getCocoaPodsVersion();
316-
const xcodeVersion = await this.getXcodeVersion();
316+
let xcodeVersion = await this.getXcodeVersion();
317+
if (xcodeVersion) {
318+
xcodeVersion = this.helpers.appendZeroesToVersion(xcodeVersion, 3);
319+
}
317320

318321
// CocoaPods with version lower than 1.0.0 don't support Xcode 7.3 yet
319322
// https://github.com/CocoaPods/CocoaPods/issues/2530#issuecomment-210470123

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"typescript": "2.0.3"
4141
},
4242
"dependencies": {
43-
"bluebird": "3.4.6",
4443
"osenv": "0.1.3",
4544
"semver": "5.3.0",
4645
"temp": "0.8.3",

test/sys-info.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ describe("SysInfo unit tests", () => {
333333
});
334334
});
335335

336+
describe("getXcprojInfo", () => {
337+
it("does not fail when cocoapods version is below 1.0.0 and Xcode version contains only two digits", async () => {
338+
childProcessResult.podVersion = { result: setStdOut("0.39.0") };
339+
childProcessResult.xCodeVersion = { result: setStdOut("Xcode 8.3") };
340+
sysInfo = mockSysInfo(childProcessResult, { isWindows: false, isDarwin: true, dotNetVersion });
341+
const result = await sysInfo.getXcprojInfo();
342+
assert.deepEqual(result, { shouldUseXcproj: true, xcprojAvailable: false });
343+
});
344+
});
345+
336346
const testData: ICLIOutputVersionTestCase[] = [
337347
{
338348
testedProperty: "nativeScriptCliVersion",

0 commit comments

Comments
 (0)