Skip to content

chore: merge release in master #3343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
37c6e97
Safeguard bundle option check (#3256)
Mitko-Kerezov Dec 11, 2017
decd306
Add Node.js 9 as verified (#3255)
rosen-vladimirov Dec 11, 2017
13cd37f
Use proxy-lib package when working behind proxy (#3253)
rosen-vladimirov Dec 11, 2017
4451e6d
Remove moment as dependency (#3259)
rosen-vladimirov Dec 11, 2017
3e24cb0
Respect `--bundle` option in run command (#3260)
Mitko-Kerezov Dec 11, 2017
137d67a
Merge pull request #3263 from NativeScript/vladimirov/cherry-pick-fixes
rosen-vladimirov Dec 11, 2017
48275a6
Clean app directory when bundle flag is switched (#3265) (#3266)
rosen-vladimirov Dec 12, 2017
9eb3a22
Always clean platforms/app when --bundle is passed (#3269) (#3270)
rosen-vladimirov Dec 13, 2017
f0ba14e
Fix EMFILE error when running on Android (#3277) (#3278)
rosen-vladimirov Dec 20, 2017
f13fb20
fix(prepare): clean appresources after bundle flag is passed (#3296)
Plamen5kov Jan 3, 2018
84a2bd3
chore: bump version
Plamen5kov Jan 4, 2018
96f476c
Generate debug port in range for Chrome DevTools websocket - iOS (#3275)
petekanev Jan 5, 2018
b27a519
Fix debug device/web socket closing (#2897)
TsvetanMilanov Jan 5, 2018
a37df65
Version bump.
Jan 8, 2018
f0b02b9
Revert version to 3.4.1 (#3307)
Jan 8, 2018
8cc23e4
fix(ios-inspector): Correctly update cached inspector package to late…
Jan 8, 2018
f1d2334
Update proxy-lib to 0.4.0 (#3311)
rosen-vladimirov Jan 9, 2018
970e800
Cherry-pick commits for 3.4.1 release (#3310)
rosen-vladimirov Jan 9, 2018
d7da531
Allow using Android SDK 27 (#3313)
rosen-vladimirov Jan 10, 2018
f0d4908
change log for 3.4.1 (#3315)
miroslavaivanova Jan 11, 2018
53de0ec
Do not use spinner in CI environment (#3316)
rosen-vladimirov Jan 23, 2018
b0d4b66
Set version to 3.4.2 (#3333)
rosen-vladimirov Jan 24, 2018
1658629
Fix livesync + debug on iOS Simulator (#3334)
rosen-vladimirov Jan 24, 2018
0126afc
Fix multiple typescript/sass watchers (#3332)
Mitko-Kerezov Jan 24, 2018
eea1373
feat(build): introduce cleanApp hook
Mitko-Kerezov Jan 26, 2018
e7039a0
fix(debug): debug-brk option does not work for iOS Simulator (#3340)
rosen-vladimirov Jan 30, 2018
6c8c0cc
Merge remote-tracking branch 'origin/release' into vladimirov/merge-r…
rosen-vladimirov Jan 30, 2018
6947611
Update common lib to latest branch
rosen-vladimirov Jan 30, 2018
4128c89
Update source-map-support version so unit tests can pass on Windows 10
rosen-vladimirov Jan 30, 2018
d50b25e
Merge pull request #3339 from NativeScript/kerezov/introduce-cleanapp…
Mitko-Kerezov Jan 31, 2018
7b8acfd
Update to latest common lib
rosen-vladimirov Jan 31, 2018
a594679
Merge remote-tracking branch 'origin/release' into vladimirov/merge-r…
rosen-vladimirov Jan 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PublicAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ Provides methods for debugging applications on devices. The service is also even
* Usage:
```JavaScript
tns.debugService.on("connectionError", errorData => {
console.log(`Unable to start debug operation on device ${errorData.deviceId}. Error is: ${errorData.message}.`);
console.log(`Unable to start debug operation on device ${errorData.deviceIdentifier}. Error is: ${errorData.message}.`);
});
```

Expand Down Expand Up @@ -522,7 +522,7 @@ interface IDebugOptions {
* Usage:
```JavaScript
tns.debugService.on("connectionError", errorData => {
console.log(`Unable to start debug operation on device ${errorData.deviceId}. Error is: ${errorData.message}.`);
console.log(`Unable to start debug operation on device ${errorData.deviceIdentifier}. Error is: ${errorData.message}.`);
});

const debugData = {
Expand Down Expand Up @@ -903,4 +903,4 @@ CLI is designed as command line tool and when it is used as a library, it does n
For example the `$options` injected module contains information about all `--` options passed on the terminal. When the CLI is used as a library, the options are not populated. Before adding method to public API, make sure its implementation does not rely on `$options`.

More information how to add a method to public API is available [here](https://github.com/telerik/mobile-cli-lib#how-to-make-a-method-public).
After that add each method that you've exposed to the tests in `tests/nativescript-cli-lib.ts` file. There you'll find an object describing each publicly available module and the methods that you can call.
After that add each method that you've exposed to the tests in `tests/nativescript-cli-lib.ts` file. There you'll find an object describing each publicly available module and the methods that you can call.
6 changes: 5 additions & 1 deletion lib/android-tools-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { appendZeroesToVersion } from './common/helpers';

export class AndroidToolsInfo implements IAndroidToolsInfo {
private static ANDROID_TARGET_PREFIX = "android";
private static SUPPORTED_TARGETS = ["android-17", "android-18", "android-19", "android-21", "android-22", "android-23", "android-24", "android-25", "android-26"];
private static SUPPORTED_TARGETS = ["android-17", "android-18", "android-19", "android-21", "android-22", "android-23", "android-24", "android-25", "android-26", "android-27"];
private static MIN_REQUIRED_COMPILE_TARGET = 22;
private static REQUIRED_BUILD_TOOLS_RANGE_PREFIX = ">=23";
private static VERSION_REGEX = /((\d+\.){2}\d+)/;
Expand Down Expand Up @@ -306,6 +306,10 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
if (this.androidHome && requiredAppCompatRange) {
const pathToAppCompat = path.join(this.androidHome, "extras", "android", "m2repository", "com", "android", "support", "appcompat-v7");
selectedAppCompatVersion = this.getMatchingDir(pathToAppCompat, requiredAppCompatRange);
if (!selectedAppCompatVersion) {
// get latest matching version, as there's no available appcompat versions for latest SDK versions.
selectedAppCompatVersion = this.getMatchingDir(pathToAppCompat, "*");
}
}

this.$logger.trace(`Selected AppCompat version is: ${selectedAppCompatVersion}`);
Expand Down
2 changes: 1 addition & 1 deletion lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ interface IAndroidToolsInfoData {

interface ISocketProxyFactory extends NodeJS.EventEmitter {
createTCPSocketProxy(factory: () => Promise<any>): Promise<any>;
createWebSocketProxy(factory: () => Promise<any>): Promise<any>;
createWebSocketProxy(factory: () => Promise<any>, deviceIdentifier: string): Promise<any>;
}

interface IiOSNotification {
Expand Down
2 changes: 1 addition & 1 deletion lib/definitions/livesync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface ILiveSyncProcessInfo {
timer: NodeJS.Timer;
watcherInfo: {
watcher: IFSWatcher,
pattern: string | string[]
patterns: string[]
};
actionsChain: Promise<any>;
isStopped: boolean;
Expand Down
3 changes: 2 additions & 1 deletion lib/device-sockets/ios/socket-proxy-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class SocketProxyFactory extends EventEmitter implements ISocketProxyFact
return server;
}

public async createWebSocketProxy(factory: () => Promise<net.Socket>): Promise<ws.Server> {
public async createWebSocketProxy(factory: () => Promise<net.Socket>, deviceIdentifier: string): Promise<ws.Server> {
// NOTE: We will try to provide command line options to select ports, at least on the localhost.
const localPort = await this.$net.getAvailablePortInRange(41000);

Expand All @@ -92,6 +92,7 @@ export class SocketProxyFactory extends EventEmitter implements ISocketProxyFact
try {
_socket = await factory();
} catch (err) {
err.deviceIdentifier = deviceIdentifier;
this.$logger.trace(err);
this.emit(CONNECTION_ERROR_EVENT_NAME, err);
this.$errors.failWithoutHelp("Cannot connect to device socket.");
Expand Down
3 changes: 1 addition & 2 deletions lib/services/doctor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { EOL } from "os";
import * as semver from "semver";
import * as path from "path";
import * as helpers from "../common/helpers";
const clui = require("clui");

class DoctorService implements IDoctorService {
private static PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
Expand Down Expand Up @@ -166,7 +165,7 @@ class DoctorService implements IDoctorService {
};
this.$fs.writeJson(path.join(projDir, "package.json"), packageJsonData);

const spinner = new clui.Spinner("Installing iOS runtime.");
const spinner = this.$progressIndicator.getSpinner("Installing iOS runtime.");
try {
spinner.start();
await this.$npm.install("tns-ios", projDir, {
Expand Down
24 changes: 19 additions & 5 deletions lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
constructor(protected device: Mobile.IDevice,
protected $devicesService: Mobile.IDevicesService,
private $platformService: IPlatformService,
private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices,
private $iOSEmulatorServices: Mobile.IiOSSimulatorService,
private $childProcess: IChildProcess,
private $hostInfo: IHostInfo,
private $logger: ILogger,
Expand All @@ -32,7 +32,8 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
private $iOSNotification: IiOSNotification,
private $iOSSocketRequestExecutor: IiOSSocketRequestExecutor,
private $processService: IProcessService,
private $socketProxyFactory: ISocketProxyFactory) {
private $socketProxyFactory: ISocketProxyFactory,
private $net: INet) {
super(device, $devicesService);
this.$processService.attachToProcessExitSignals(this, this.debugStop);
this.$socketProxyFactory.on(CONNECTION_ERROR_EVENT_NAME, (e: Error) => this.emit(CONNECTION_ERROR_EVENT_NAME, e));
Expand Down Expand Up @@ -145,6 +146,8 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
}
});

await this.waitForBackendPortToBeOpened(debugData.deviceIdentifier);

return this.wireDebuggerClient(debugData, debugOptions);
}

Expand All @@ -153,11 +156,21 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS

const attachRequestMessage = this.$iOSNotification.getAttachRequest(debugData.applicationIdentifier);

const iOSEmulator = <Mobile.IiOSSimulatorService>this.$iOSEmulatorServices;
await iOSEmulator.postDarwinNotification(attachRequestMessage);
const iOSEmulatorService = <Mobile.IiOSSimulatorService>this.$iOSEmulatorServices;
await iOSEmulatorService.postDarwinNotification(attachRequestMessage);
await this.waitForBackendPortToBeOpened(debugData.deviceIdentifier);
return result;
}

private async waitForBackendPortToBeOpened(deviceIdentifier: string): Promise<void> {
const portListens = await this.$net.waitForPortToListen({ port: inspectorBackendPort, timeout: 10000, interval: 200 });
if (!portListens) {
const error = <Mobile.IDeviceError>new Error("Unable to connect to application. Ensure application is running on simulator.");
error.deviceIdentifier = deviceIdentifier;
throw error;
}
}

private async deviceDebugBrk(debugData: IDebugData, debugOptions: IDebugOptions): Promise<string> {
await this.$devicesService.initialize({ platform: this.platform, deviceId: debugData.deviceIdentifier });
const action = async (device: iOSDevice.IOSDevice): Promise<string> => {
Expand Down Expand Up @@ -212,7 +225,8 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
this.$logger.info("'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.");
}

this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device));
const deviceIdentifier = device ? device.deviceInfo.identifier : debugData.deviceIdentifier;
this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device), deviceIdentifier);
return this.getChromeDebugUrl(debugOptions, this._socketProxy.options.port);
}
}
Expand Down
7 changes: 2 additions & 5 deletions lib/services/livesync/ios-device-livesync-service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as helpers from "../../common/helpers";
import * as constants from "../../constants";
import * as minimatch from "minimatch";
import * as net from "net";
Expand Down Expand Up @@ -30,10 +29,8 @@ export class IOSDeviceLiveSyncService extends DeviceLiveSyncServiceBase implemen

if (this.device.isEmulator) {
await this.$iOSEmulatorServices.postDarwinNotification(this.$iOSNotification.getAttachRequest(projectId));
try {
this.socket = await helpers.connectEventuallyUntilTimeout(() => net.connect(IOSDeviceLiveSyncService.BACKEND_PORT), 5000);
} catch (e) {
this.$logger.debug(e);
this.socket = await this.$iOSEmulatorServices.connectToPort({ port: IOSDeviceLiveSyncService.BACKEND_PORT });
if (!this.socket) {
return false;
}
} else {
Expand Down
14 changes: 7 additions & 7 deletions lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,21 +513,21 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
}

private async startWatcher(projectData: IProjectData, liveSyncData: ILiveSyncInfo): Promise<void> {
const pattern = [APP_FOLDER_NAME];
const patterns = [APP_FOLDER_NAME];

if (liveSyncData.watchAllFiles) {
const productionDependencies = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir);
pattern.push(PACKAGE_JSON_FILE_NAME);
patterns.push(PACKAGE_JSON_FILE_NAME);

// watch only production node_module/packages same one prepare uses
for (const index in productionDependencies) {
pattern.push(productionDependencies[index].directory);
patterns.push(productionDependencies[index].directory);
}
}

const currentWatcherInfo = this.liveSyncProcessesInfo[liveSyncData.projectDir].watcherInfo;

if (!currentWatcherInfo || currentWatcherInfo.pattern !== pattern) {
const areWatcherPatternsDifferent = () => _.xor(currentWatcherInfo.patterns, patterns).length;
if (!currentWatcherInfo || areWatcherPatternsDifferent()) {
if (currentWatcherInfo) {
currentWatcherInfo.watcher.close();
}
Expand Down Expand Up @@ -630,7 +630,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
ignored: ["**/.*", ".*"] // hidden files
};

const watcher = choki.watch(pattern, watcherOptions)
const watcher = choki.watch(patterns, watcherOptions)
.on("all", async (event: string, filePath: string) => {
clearTimeout(timeoutTimer);

Expand All @@ -650,7 +650,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
}
});

this.liveSyncProcessesInfo[liveSyncData.projectDir].watcherInfo = { watcher, pattern };
this.liveSyncProcessesInfo[liveSyncData.projectDir].watcherInfo = { watcher, patterns };
this.liveSyncProcessesInfo[liveSyncData.projectDir].timer = timeoutTimer;

this.$processService.attachToProcessExitSignals(this, () => {
Expand Down
5 changes: 3 additions & 2 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { AppFilesUpdater } from "./app-files-updater";
import { attachAwaitDetach } from "../common/helpers";
import * as temp from "temp";
temp.track();
const clui = require("clui");

const buildInfoFileName = ".nsbuildinfo";

Expand All @@ -25,6 +24,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
constructor(private $devicesService: Mobile.IDevicesService,
private $preparePlatformNativeService: IPreparePlatformService,
private $preparePlatformJSService: IPreparePlatformService,
private $progressIndicator: IProgressIndicator,
private $errors: IErrors,
private $fs: IFileSystem,
private $logger: ILogger,
Expand Down Expand Up @@ -115,7 +115,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
npmOptions["version"] = version;
}

const spinner = new clui.Spinner("Installing " + packageToInstall);
const spinner = this.$progressIndicator.getSpinner("Installing " + packageToInstall);
const projectDir = projectData.projectDir;
const platformPath = path.join(projectData.platformsDir, platform);

Expand Down Expand Up @@ -560,6 +560,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
return null;
}

@helpers.hook('cleanApp')
public async cleanDestinationApp(platformInfo: IPreparePlatformInfo): Promise<void> {
await this.ensurePlatformInstalled(platformInfo.platform, platformInfo.platformTemplate, platformInfo.projectData, platformInfo.config);

Expand Down
Loading