Skip to content

Commit 5d69a49

Browse files
author
Dimitar Tachev
authored
Merge pull request #5036 from NativeScript/tachev/merge-r-into-m
Merge release into master
2 parents 75c9ea0 + 48f5135 commit 5d69a49

23 files changed

+221
-68
lines changed

CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
NativeScript CLI Changelog
22
================
33

4+
6.1.2 (2019, September 18)
5+
==
6+
7+
### Fixed
8+
* [Fixed #5018](https://github.com/NativeScript/nativescript-cli/issues/5018): Track runtime versions on add and on build, run, deploy
9+
10+
11+
6.1.1 (2019, September 17)
12+
==
13+
14+
### Fixed
15+
16+
* [Fixed #5015](https://github.com/NativeScript/nativescript-cli/pull/5015): CLI passes `--preserve-symlinks` to the webpack itself, not to the Node.js
17+
* [Fixed #4893](https://github.com/NativeScript/nativescript-cli/issues/4893): `tns preview` crashes when scanning on devices with different platforms
18+
* [Fixed #4939](https://github.com/NativeScript/nativescript-cli/issues/4939): Xcode 11 warning: `CFBundleIdentifier value must be the same as PRODUCT_BUNDLE_IDENTIFIER`
19+
20+
6.1.0 (2019, September 04)
21+
==
22+
23+
### New
24+
25+
* [Implemented #4229](https://github.com/NativeScript/nativescript-cli/issues/4229): Do not display command usage help after execution is started
26+
* [Implemented #4909](https://github.com/NativeScript/nativescript-cli/issues/4909): Support for Xcode 11 and iOS 13
27+
* [Implemented #4926](https://github.com/NativeScript/nativescript-cli/issues/4926): Android SDK 29 support
28+
* [Implemented #4947](https://github.com/NativeScript/nativescript-cli/issues/4947): Add tracking for both React NativeScript and Svelte Native projects
29+
* [Implemented #4966](https://github.com/NativeScript/nativescript-cli/issues/4966): Support LiveSync to iOS Wi-Fi devices
30+
* [Implemented #4974](https://github.com/NativeScript/nativescript-cli/issues/4974): Ask the users why they've uninstalled NativeScript CLI
31+
* [Implemented #4976](https://github.com/NativeScript/nativescript-cli/issues/4976): Handle changes in iOS and Android Runtime 6.1.0 logging
32+
* [Implemented #4980](https://github.com/NativeScript/nativescript-cli/issues/4980): Update message for subscribing to NativeScript newsletter
33+
* [Implemented #4992](https://github.com/NativeScript/nativescript-cli/pull/4992): Allow tns to be able to use npm configuration properly
34+
35+
### Fixed
36+
37+
* [Fixed #4936](https://github.com/NativeScript/nativescript-cli/issues/4936): HMR not recovering after exception in Angular lazy routes
38+
* [Fixed #4958](https://github.com/NativeScript/nativescript-cli/issues/4958): `tns doctor` fails when setup is not correct and user selects to fix it manually
39+
* [Fixed #4971](https://github.com/NativeScript/nativescript-cli/issues/4971): Not needed checks are executed on `pod install`
40+
441
6.0.3 (2019, August 05)
542
==
643
* [Fixed #4914](https://github.com/NativeScript/nativescript-cli/issues/4914): livesync not working with command tns test android

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ The <code>--insecure</code> flag allows you to perform insecure SSL connections
143143
#### Limitations
144144

145145
* You can provide the `<Username>` and `<Password>` attributes only on Windows systems.
146-
* Proxy settings for the npm and the Android Gradle need to be configured separately. For more information, see the following articles:
146+
* Proxy settings for the npm, the Android Gradle and (optional) Docker need to be configured separately. For more information, see the following articles:
147147
* [Configure the npm proxy](https://docs.npmjs.com/misc/config#https-proxy)
148148
* [Configure the Android Gradle proxy](https://docs.gradle.org/3.3/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy)
149+
* [Configure the Docker proxy](https://docs.docker.com/network/proxy/)
149150

150151
### Display Current Proxy Settings
151152

docs/man_pages/general/proxy-set.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ General | `$ tns proxy set [<Url> <% if(isWindows) {%>[<Username> [<Password>]]<
3131
### Command Limitations
3232

3333
* You can set credentials only on Windows systems.
34-
* Proxy settings for npm and (Android) Gradle need to be set separately.
34+
* Proxy settings for npm, (Android) Gradle and (optional) Docker need to be set separately.
3535
* configuring `npm` proxy - https://docs.npmjs.com/misc/config#https-proxy
3636
* (Android) configuring Gradle proxy - set global configuration in the user directory - _<USER_HOME>/.gradle/gradle.properties_ - https://docs.gradle.org/3.3/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy
37+
* configuring Docker proxy - https://docs.docker.com/network/proxy/
3738

3839
### Related Commands
3940

lib/bootstrap.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ $injector.require("gradleCommandService", "./services/android/gradle-command-ser
1515
$injector.require("gradleBuildService", "./services/android/gradle-build-service");
1616
$injector.require("gradleBuildArgsService", "./services/android/gradle-build-args-service");
1717
$injector.require("iOSEntitlementsService", "./services/ios-entitlements-service");
18+
$injector.require("iOSNativeTargetService", "./services/ios-native-target-service");
1819
$injector.require("iOSExtensionsService", "./services/ios-extensions-service");
1920
$injector.require("iOSWatchAppService", "./services/ios-watch-app-service");
2021
$injector.require("iOSProjectService", "./services/ios-project-service");

lib/constants.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ export const enum TrackActionNames {
186186
AcceptTracking = "Accept Tracking",
187187
Performance = "Performance",
188188
PreviewAppData = "Preview App Data",
189-
UninstallCLI = "Uninstall CLI"
189+
UninstallCLI = "Uninstall CLI",
190+
UsingRuntimeVersion = "Using Runtime Version",
191+
AddPlatform = "Add Platform"
190192
}
191193

192194
export const AnalyticsEventLabelDelimiter = "__";

lib/controllers/deploy-controller.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export class DeployController {
1111

1212
const executeAction = async (device: Mobile.IDevice) => {
1313
const deviceDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);
14-
await this.$prepareController.prepare(deviceDescriptor.buildData);
14+
const prepareData = {
15+
...deviceDescriptor.buildData,
16+
nativePrepare: { skipNativePrepare: !!deviceDescriptor.skipNativePrepare }
17+
};
18+
await this.$prepareController.prepare(prepareData);
1519
const packageFilePath = await deviceDescriptor.buildAction();
1620
await this.$deviceInstallAppService.installOnDevice(device, { ...deviceDescriptor.buildData, buildForDevice: !device.isEmulator }, packageFilePath);
1721
};

lib/controllers/prepare-controller.ts

+40-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import * as choki from "chokidar";
22
import { hook } from "../common/helpers";
3-
import { performanceLog } from "../common/decorators";
3+
import { performanceLog, cache } from "../common/decorators";
44
import { EventEmitter } from "events";
55
import * as path from "path";
6-
import { PREPARE_READY_EVENT_NAME, WEBPACK_COMPILATION_COMPLETE, PACKAGE_JSON_FILE_NAME, PLATFORMS_DIR_NAME } from "../constants";
7-
6+
import { PREPARE_READY_EVENT_NAME, WEBPACK_COMPILATION_COMPLETE, PACKAGE_JSON_FILE_NAME, PLATFORMS_DIR_NAME, TrackActionNames, AnalyticsEventLabelDelimiter } from "../constants";
87
interface IPlatformWatcherData {
98
hasWebpackCompilerProcess: boolean;
109
nativeFilesWatcher: choki.FSWatcher;
@@ -27,12 +26,14 @@ export class PrepareController extends EventEmitter {
2726
private $projectChangesService: IProjectChangesService,
2827
private $projectDataService: IProjectDataService,
2928
private $webpackCompilerService: IWebpackCompilerService,
30-
private $watchIgnoreListService: IWatchIgnoreListService
29+
private $watchIgnoreListService: IWatchIgnoreListService,
30+
private $analyticsService: IAnalyticsService
3131
) { super(); }
3232

3333
public async prepare(prepareData: IPrepareData): Promise<IPrepareResultData> {
3434
const projectData = this.$projectDataService.getProjectData(prepareData.projectDir);
3535

36+
await this.trackRuntimeVersion(prepareData.platform, projectData);
3637
await this.$pluginsService.ensureAllDependenciesAreInstalled(projectData);
3738

3839
return this.prepareCore(prepareData, projectData);
@@ -127,6 +128,21 @@ export class PrepareController extends EventEmitter {
127128
}
128129

129130
private async startNativeWatcherWithPrepare(platformData: IPlatformData, projectData: IProjectData, prepareData: IPrepareData): Promise<boolean> {
131+
let newNativeWatchStarted = false;
132+
let hasNativeChanges = false;
133+
134+
if (prepareData.watchNative) {
135+
newNativeWatchStarted = await this.startNativeWatcher(platformData, projectData);
136+
}
137+
138+
if (newNativeWatchStarted) {
139+
hasNativeChanges = await this.$prepareNativePlatformService.prepareNativePlatform(platformData, projectData, prepareData);
140+
}
141+
142+
return hasNativeChanges;
143+
}
144+
145+
private async startNativeWatcher(platformData: IPlatformData, projectData: IProjectData): Promise<boolean> {
130146
if (this.watchersData[projectData.projectDir][platformData.platformNameLowerCase].nativeFilesWatcher) {
131147
return false;
132148
}
@@ -155,9 +171,7 @@ export class PrepareController extends EventEmitter {
155171

156172
this.watchersData[projectData.projectDir][platformData.platformNameLowerCase].nativeFilesWatcher = watcher;
157173

158-
const hasNativeChanges = await this.$prepareNativePlatformService.prepareNativePlatform(platformData, projectData, prepareData);
159-
160-
return hasNativeChanges;
174+
return true;
161175
}
162176

163177
@hook('watchPatterns')
@@ -186,5 +200,24 @@ export class PrepareController extends EventEmitter {
186200
this.persistedData.push(filesChangeEventData);
187201
}
188202
}
203+
204+
@cache()
205+
private async trackRuntimeVersion(platform: string, projectData: IProjectData): Promise<void> {
206+
let runtimeVersion: string = null;
207+
try {
208+
const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
209+
const runtimeVersionData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
210+
runtimeVersion = runtimeVersionData && runtimeVersionData.version;
211+
} catch (err) {
212+
this.$logger.trace(`Unable to get runtime version for project directory: ${projectData.projectDir} and platform ${platform}. Error is: `, err);
213+
}
214+
215+
if (runtimeVersion) {
216+
await this.$analyticsService.trackEventActionInGoogleAnalytics({
217+
action: TrackActionNames.UsingRuntimeVersion,
218+
additionalData: `${platform.toLowerCase()}${AnalyticsEventLabelDelimiter}${runtimeVersion}`
219+
});
220+
}
221+
}
189222
}
190223
$injector.register("prepareController", PrepareController);

lib/controllers/preview-app-controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
9999
data.env = data.env || {};
100100
data.env.externals = this.$previewAppPluginsService.getExternalPlugins(device);
101101

102-
const prepareData = this.$prepareDataService.getPrepareData(data.projectDir, device.platform.toLowerCase(), { ...data, nativePrepare: { skipNativePrepare: true }, watch: true });
102+
const prepareData = this.$prepareDataService.getPrepareData(data.projectDir, device.platform.toLowerCase(), { ...data, nativePrepare: { skipNativePrepare: true }, watch: true, watchNative: false });
103103
await this.$prepareController.prepare(prepareData);
104104

105105
try {

lib/data/prepare-data.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export class PrepareData extends ControllerDataBase {
55
public hmr: boolean;
66
public env: any;
77
public watch?: boolean;
8+
public watchNative: boolean = true;
89

910
constructor(public projectDir: string, public platform: string, data: any) {
1011
super(projectDir, platform, data);
@@ -16,6 +17,9 @@ export class PrepareData extends ControllerDataBase {
1617
hmr: data.hmr || data.useHotModuleReload
1718
};
1819
this.watch = data.watch;
20+
if (_.isBoolean(data.watchNative)) {
21+
this.watchNative = data.watchNative;
22+
}
1923
}
2024
}
2125

lib/definitions/prepare.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ declare global {
77
hmr: boolean;
88
env: any;
99
watch?: boolean;
10+
watchNative: boolean
1011
}
1112

1213
interface IiOSCodeSigningData {

lib/definitions/project.d.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,26 @@ interface ICocoaPodsPlatformManager {
458458
replacePlatformRow(podfileContent: string, podfilePath: string): { replacedContent: string, podfilePlatformData: IPodfilePlatformData };
459459
}
460460

461+
declare const enum BuildNames {
462+
debug = "Debug",
463+
release = "Release"
464+
}
465+
466+
interface IXcodeTargetBuildConfigurationProperty {
467+
name: string;
468+
value: any;
469+
buildNames?: BuildNames[];
470+
}
471+
461472
/**
462473
* Describes a service used to add and remove iOS extension
463474
*/
464-
interface IIOSExtensionsService {
465-
addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise<boolean>;
466-
removeExtensions(options: IRemoveExtensionsOptions): void;
475+
interface IIOSNativeTargetService {
476+
addTargetToProject(targetRootPath: string, targetFolder: string, targetType: string, project: IXcode.project, platformData: IPlatformData, parentTarget?: string): IXcode.target;
477+
prepareSigning(targetUuids: string[], projectData:IProjectData, projectPath: string): void;
478+
getTargetDirectories(folderPath: string): string[];
479+
setXcodeTargetBuildConfigurationProperties(properties: IXcodeTargetBuildConfigurationProperty[], targetName: string, project: IXcode.project): void
480+
setConfigurationsFromJsonFile(jsonPath: string, targetUuid: string, targetName: string, project: IXcode.project): void
467481
}
468482

469483
/**

lib/services/ios-extensions-service.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import * as path from "path";
2-
import { NativeTargetServiceBase } from "./ios-native-target-service-base";
32
import { IOSNativeTargetProductTypes, IOSNativeTargetTypes } from "../constants";
43

5-
export class IOSExtensionsService extends NativeTargetServiceBase implements IIOSExtensionsService {
4+
export class IOSExtensionsService implements IIOSExtensionsService {
65
constructor(protected $fs: IFileSystem,
76
protected $pbxprojDomXcode: IPbxprojDomXcode,
8-
protected $xcode: IXcode) {
9-
super($fs, $pbxprojDomXcode, $xcode);
7+
protected $xcode: IXcode,
8+
private $iOSNativeTargetService: IIOSNativeTargetService) {
109
}
1110

1211
public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise<boolean> {
@@ -17,29 +16,29 @@ export class IOSExtensionsService extends NativeTargetServiceBase implements IIO
1716
}
1817
const project = new this.$xcode.project(pbxProjPath);
1918
project.parseSync();
20-
this.getTargetDirectories(extensionsFolderPath)
19+
this.$iOSNativeTargetService.getTargetDirectories(extensionsFolderPath)
2120
.forEach(extensionFolder => {
22-
const target = this.addTargetToProject(extensionsFolderPath, extensionFolder, IOSNativeTargetTypes.appExtension, project, platformData);
21+
const target = this.$iOSNativeTargetService.addTargetToProject(extensionsFolderPath, extensionFolder, IOSNativeTargetTypes.appExtension, project, platformData);
2322
this.configureTarget(extensionFolder, path.join(extensionsFolderPath, extensionFolder), target, project, projectData);
2423
targetUuids.push(target.uuid);
2524
addedExtensions = true;
2625
});
2726

2827
this.$fs.writeFile(pbxProjPath, project.writeSync({omitEmptyValues: true}));
29-
this.prepareSigning(targetUuids, projectData, pbxProjPath);
28+
this.$iOSNativeTargetService.prepareSigning(targetUuids, projectData, pbxProjPath);
3029

3130
return addedExtensions;
3231
}
3332

3433
private configureTarget(extensionName: string, extensionPath: string, target: IXcode.target, project: IXcode.project, projectData: IProjectData) {
3534
const extJsonPath = path.join(extensionPath, "extension.json");
3635

37-
this.setXcodeTargetBuildConfigurationProperties(
36+
this.$iOSNativeTargetService.setXcodeTargetBuildConfigurationProperties(
3837
[{name: "PRODUCT_BUNDLE_IDENTIFIER", value: `${projectData.projectIdentifiers.ios}.${extensionName}`}],
3938
extensionName,
4039
project);
4140

42-
this.setConfigurationsFromJsonFile(extJsonPath, target.uuid, extensionName, project);
41+
this.$iOSNativeTargetService.setConfigurationsFromJsonFile(extJsonPath, target.uuid, extensionName, project);
4342
}
4443

4544
public removeExtensions({pbxProjPath}: IRemoveExtensionsOptions): void {

lib/services/ios-native-target-service-base.ts renamed to lib/services/ios-native-target-service.ts

+16-26
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,27 @@
11
import * as path from "path";
22

3-
export enum BuildNames {
4-
debug = "Debug",
5-
release = "Release"
6-
}
7-
8-
export interface IXcodeTargetBuildConfigurationProperty {
9-
name: string;
10-
value: any;
11-
buildNames?: BuildNames[];
12-
}
13-
14-
export abstract class NativeTargetServiceBase {
3+
export class IOSNativeTargetService implements IIOSNativeTargetService {
154
constructor(protected $fs: IFileSystem,
16-
protected $pbxprojDomXcode: IPbxprojDomXcode,
17-
protected $xcode: IXcode) {
5+
protected $pbxprojDomXcode: IPbxprojDomXcode) {
186
}
197

20-
protected addTargetToProject(extensionsFolderPath: string, extensionFolder: string, targetType: string, project: IXcode.project, platformData: IPlatformData, parentTarget?: string): IXcode.target {
21-
const extensionPath = path.join(extensionsFolderPath, extensionFolder);
22-
const extensionRelativePath = path.relative(platformData.projectRoot, extensionPath);
23-
const files = this.$fs.readDirectory(extensionPath)
8+
public addTargetToProject(targetRootPath: string, targetFolder: string, targetType: string, project: IXcode.project, platformData: IPlatformData, parentTarget?: string): IXcode.target {
9+
const targetPath = path.join(targetRootPath, targetFolder);
10+
const targetRelativePath = path.relative(platformData.projectRoot, targetPath);
11+
const files = this.$fs.readDirectory(targetPath)
2412
.filter(filePath => !filePath.startsWith("."))
25-
.map(filePath => path.join(extensionPath, filePath));
26-
const target = project.addTarget(extensionFolder, targetType, extensionRelativePath, parentTarget);
13+
.map(filePath => path.join(targetPath, filePath));
14+
const target = project.addTarget(targetFolder, targetType, targetRelativePath, parentTarget);
2715
project.addBuildPhase([], 'PBXSourcesBuildPhase', 'Sources', target.uuid);
2816
project.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', target.uuid);
2917
project.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', target.uuid);
3018

31-
project.addPbxGroup(files, extensionFolder, extensionPath, null, { isMain: true, target: target.uuid, filesRelativeToProject: true });
32-
project.addToHeaderSearchPaths(extensionPath, target.pbxNativeTarget.productName);
19+
project.addPbxGroup(files, targetFolder, targetPath, null, { isMain: true, target: target.uuid, filesRelativeToProject: true });
20+
project.addToHeaderSearchPaths(targetPath, target.pbxNativeTarget.productName);
3321
return target;
3422
}
3523

36-
protected prepareSigning(targetUuids: string[], projectData:IProjectData, projectPath: string) {
24+
public prepareSigning(targetUuids: string[], projectData: IProjectData, projectPath: string): void {
3725
const xcode = this.$pbxprojDomXcode.Xcode.open(projectPath);
3826
const signing = xcode.getSigning(projectData.projectName);
3927
if (signing !== undefined) {
@@ -52,7 +40,7 @@ export abstract class NativeTargetServiceBase {
5240
xcode.save();
5341
}
5442

55-
protected getTargetDirectories(folderPath: string): string[] {
43+
public getTargetDirectories(folderPath: string): string[] {
5644
return this.$fs.readDirectory(folderPath)
5745
.filter(fileName => {
5846
const filePath = path.join(folderPath, fileName);
@@ -62,7 +50,7 @@ export abstract class NativeTargetServiceBase {
6250
});
6351
}
6452

65-
protected setXcodeTargetBuildConfigurationProperties(properties: IXcodeTargetBuildConfigurationProperty[], targetName: string, project: IXcode.project): void {
53+
public setXcodeTargetBuildConfigurationProperties(properties: IXcodeTargetBuildConfigurationProperty[], targetName: string, project: IXcode.project): void {
6654
properties.forEach(property => {
6755
const buildNames = property.buildNames || [BuildNames.debug, BuildNames.release];
6856
buildNames.forEach((buildName) => {
@@ -71,7 +59,7 @@ export abstract class NativeTargetServiceBase {
7159
});
7260
}
7361

74-
protected setConfigurationsFromJsonFile(jsonPath: string, targetUuid: string, targetName: string, project: IXcode.project) {
62+
public setConfigurationsFromJsonFile(jsonPath: string, targetUuid: string, targetName: string, project: IXcode.project): void {
7563
if (this.$fs.exists(jsonPath)) {
7664
const configurationJson = this.$fs.readJson(jsonPath) || {};
7765

@@ -94,3 +82,5 @@ export abstract class NativeTargetServiceBase {
9482
}
9583
}
9684
}
85+
86+
$injector.register("iOSNativeTargetService", IOSNativeTargetService);

0 commit comments

Comments
 (0)