Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 264bde4

Browse files
Use Xcode's "Modern Build System" with NativeScript CLI 5.2.0+ #1133
1 parent 6e0c051 commit 264bde4

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

publish/scripts/installer.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ var fs = require('fs');
22
var path = require('path');
33
var prompt = require('prompt-lite');
44

5+
const { execSync } = require('child_process');
6+
const semver = require('semver');
7+
8+
// iOS modern build system is supported from version NativeScript (CLI) version 5.2.0
9+
const tnsVersionFull = execSync('tns --version', { encoding: 'ascii'});
10+
const supportsIOSModernBuildSystem = tnsVersionFull.indexOf("5.2.0-") > -1 || semver.gte(tnsVersionFull, "5.2.0");
11+
console.log({supportsIOSModernBuildSystem});
12+
13+
if (!supportsIOSModernBuildSystem) {
14+
console.log(`You're using NativeScript ${tnsVersionFull}.. which doesn't support the latest Firestore and in-app-messaging SDKs. Upgrade NativeScript to at least 5.2.0 if you need those!\n\n`);
15+
}
16+
517
// Default settings for a few prompts
618
var usingiOS = false, usingAndroid = false, externalPushClientOnly = false;
719

@@ -163,7 +175,7 @@ function promptQuestions() {
163175
default: 'n'
164176
}, {
165177
name: 'messaging',
166-
description: 'Are you using Firebase Messaging? (y/n)',
178+
description: 'Are you using Firebase Cloud Messaging? (y/n)',
167179
default: 'n'
168180
}, {
169181
name: 'crashlytics',
@@ -255,7 +267,7 @@ function promptQuestionsResult(result) {
255267
writePodFile(result);
256268
}
257269
writeBuildscriptHookForCrashlytics(isSelected(result.crashlytics));
258-
writeBuildscriptHookForFirestore(isSelected(result.firestore));
270+
writeBuildscriptHookForFirestore(isSelected(result.firestore) && !supportsIOSModernBuildSystem);
259271
}
260272

261273
if (usingAndroid) {
@@ -341,7 +353,8 @@ function writePodFile(result) {
341353
// The MLVision pod requires a minimum of iOS 9, otherwise the build will fail
342354
(isPresent(result.ml_kit) ? `` : `#`) + `platform :ios, '9.0'
343355
344-
pod 'Firebase/Core', '~> 5.15.0'
356+
# With NativeScript < 5.2 we can't bump Firebase/Core beyond 5.15.0, but with 5.2+ we can
357+
pod 'Firebase/Core', '~> ` + (supportsIOSModernBuildSystem ? '5.16.0' : '5.15.0') + `'
345358
346359
# Authentication
347360
` + (!isPresent(result.authentication) || isSelected(result.authentication) ? `` : `#`) + `pod 'Firebase/Auth'
@@ -350,7 +363,9 @@ pod 'Firebase/Core', '~> 5.15.0'
350363
` + (!isPresent(result.realtimedb) || isSelected(result.realtimedb) ? `` : `#`) + `pod 'Firebase/Database'
351364
352365
# Cloud Firestore (sticking to 0.14 for now because of build error - see https://github.com/firebase/firebase-ios-sdk/issues/2177)
353-
` + (isSelected(result.firestore) ? `` : `#`) + `pod 'FirebaseFirestore', '~> 0.14.0'
366+
` + (isSelected(result.firestore) && !supportsIOSModernBuildSystem ? `` : `#`) + `pod 'FirebaseFirestore', '~> 0.14.0'
367+
# .. unless the modern build system is supported, then we can use the latest version (NativeScript 5.2+)
368+
` + (isSelected(result.firestore) && supportsIOSModernBuildSystem ? `` : `#`) + `pod 'Firebase/Firestore'
354369
355370
# Remote Config
356371
` + (isSelected(result.remote_config) ? `` : `#`) + `pod 'Firebase/RemoteConfig'

src/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-plugin-firebase",
3-
"version": "7.7.0",
3+
"version": "8.0.0",
44
"description": "Fire. Base. Firebase!",
55
"main": "firebase",
66
"typings": "index.d.ts",
@@ -119,7 +119,8 @@
119119
"fs-extra": "~2.1.0",
120120
"nativescript-hook": "~0.2.4",
121121
"prompt-lite": "~0.1.0",
122-
"xcode": "~0.9.0"
122+
"xcode": "~0.9.0",
123+
"semver": "^5.0.0"
123124
},
124125
"devDependencies": {
125126
"rimraf": "^2.6.2",

0 commit comments

Comments
 (0)