Skip to content

Commit dad91d3

Browse files
Merge branch 'master' into kddimitrov/bump-version-084
2 parents 2f4be5f + 4e1e4c3 commit dad91d3

File tree

4 files changed

+31
-40
lines changed

4 files changed

+31
-40
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright (c) 2015-2018 Telerik EAD
189+
Copyright (c) 2015-2018 Progress Software Corporation
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

package.json

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@types/lodash": "^4.14.109",
3737
"@types/mocha": "^5.2.1",
3838
"@types/node": "6.0.46",
39+
"@types/semver": "^5.5.0",
3940
"@types/universal-analytics": "0.4.1",
4041
"cpx": "^1.5.0",
4142
"mocha": "^5.2.0",
@@ -140,10 +141,7 @@
140141
"platform": "ios",
141142
"appRoot": "${workspaceRoot}",
142143
"sourceMaps": true,
143-
"watch": true,
144-
"sourceMapPathOverrides": {
145-
"webpack:///*": "${workspaceRoot}/src/*"
146-
}
144+
"watch": true
147145
},
148146
{
149147
"name": "Attach on iOS",
@@ -152,10 +150,7 @@
152150
"platform": "ios",
153151
"appRoot": "${workspaceRoot}",
154152
"sourceMaps": true,
155-
"watch": false,
156-
"sourceMapPathOverrides": {
157-
"webpack:///*": "${workspaceRoot}/src/*"
158-
}
153+
"watch": false
159154
},
160155
{
161156
"name": "Launch on Android",
@@ -164,10 +159,7 @@
164159
"platform": "android",
165160
"appRoot": "${workspaceRoot}",
166161
"sourceMaps": true,
167-
"watch": true,
168-
"sourceMapPathOverrides": {
169-
"webpack:///*": "${workspaceRoot}/src/*"
170-
}
162+
"watch": true
171163
},
172164
{
173165
"name": "Attach on Android",
@@ -176,10 +168,7 @@
176168
"platform": "android",
177169
"appRoot": "${workspaceRoot}",
178170
"sourceMaps": true,
179-
"watch": false,
180-
"sourceMapPathOverrides": {
181-
"webpack:///*": "${workspaceRoot}/src/*"
182-
}
171+
"watch": false
183172
}
184173
],
185174
"configurationSnippets": [
@@ -193,10 +182,7 @@
193182
"platform": "ios",
194183
"appRoot": "^\"\\${workspaceRoot}\"",
195184
"sourceMaps": true,
196-
"watch": true,
197-
"sourceMapPathOverrides": {
198-
"webpack:///*": "${workspaceRoot}/src/*"
199-
}
185+
"watch": true
200186
}
201187
},
202188
{
@@ -209,10 +195,7 @@
209195
"platform": "android",
210196
"appRoot": "^\"\\${workspaceRoot}\"",
211197
"sourceMaps": true,
212-
"watch": true,
213-
"sourceMapPathOverrides": {
214-
"webpack:///*": "${workspaceRoot}/src/*"
215-
}
198+
"watch": true
216199
}
217200
},
218201
{
@@ -225,10 +208,7 @@
225208
"platform": "ios",
226209
"appRoot": "^\"\\${workspaceRoot}\"",
227210
"sourceMaps": true,
228-
"watch": false,
229-
"sourceMapPathOverrides": {
230-
"webpack:///*": "${workspaceRoot}/src/*"
231-
}
211+
"watch": false
232212
}
233213
},
234214
{
@@ -241,10 +221,7 @@
241221
"platform": "android",
242222
"appRoot": "^\"\\${workspaceRoot}\"",
243223
"sourceMaps": true,
244-
"watch": false,
245-
"sourceMapPathOverrides": {
246-
"webpack:///*": "${workspaceRoot}/src/*"
247-
}
224+
"watch": false
248225
}
249226
}
250227
],

src/debug-adapter/nativeScriptDebugAdapter.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter {
144144
args.webRoot = args.appRoot;
145145
}
146146

147+
if (!args.sourceMapPathOverrides) {
148+
args.sourceMapPathOverrides = { };
149+
}
150+
151+
if (!args.sourceMapPathOverrides['webpack:///*']) {
152+
const appDirPath = this.getAppDirPath(args.webRoot) || 'app';
153+
const fullAppDirPath = join(args.webRoot, appDirPath);
154+
155+
args.sourceMapPathOverrides['webpack:///*'] = `${fullAppDirPath}/*`;
156+
}
157+
147158
return args;
148159
}
149160

src/project/androidProject.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import { ChildProcess } from 'child_process';
22
import { EventEmitter } from 'events';
3+
import * as semver from 'semver';
34
import * as stream from 'stream';
45
import { NativeScriptCli } from './nativeScriptCli';
56
import { IDebugResult, Project } from './project';
67
import * as scanner from './streamScanner';
78

89
export class AndroidProject extends Project {
10+
private cliVersion: string;
911

1012
constructor(appRoot: string, cli: NativeScriptCli) {
1113
super(appRoot, cli);
14+
this.cliVersion = cli.executeGetVersion();
1215
}
1316

1417
public platformName(): string {
@@ -23,7 +26,7 @@ export class AndroidProject extends Project {
2326
const debugProcess: ChildProcess = super.executeDebugCommand(args);
2427
const tnsOutputEventEmitter = new EventEmitter();
2528

26-
this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter, true);
29+
this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter, false);
2730

2831
return { tnsProcess: debugProcess, tnsOutputEventEmitter };
2932
}
@@ -37,26 +40,26 @@ export class AndroidProject extends Project {
3740

3841
const debugProcess: ChildProcess = super.executeDebugCommand(args);
3942
const tnsOutputEventEmitter: EventEmitter = new EventEmitter();
43+
const shouldWaitAfterRestartMessage = semver.lt(semver.coerce(this.cliVersion), '5.1.0');
44+
const waitForRestartMessage = shouldWaitAfterRestartMessage || args.indexOf('--debug-brk') > -1;
4045

41-
this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter, false);
46+
this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter, waitForRestartMessage);
4247

4348
return { tnsProcess: debugProcess, tnsOutputEventEmitter };
4449
}
4550

46-
protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter, attach?: boolean): void {
51+
protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter, waitForRestartMessage?: boolean): void {
4752
super.configureReadyEvent(readableStream, eventEmitter);
48-
4953
let debugPort = null;
5054

5155
new scanner.StringMatchingScanner(readableStream).onEveryMatch(new RegExp('device: .* debug port: [0-9]+'), (match: scanner.IMatchFound) => {
5256
// device: {device-name} debug port: {debug-port}
5357
debugPort = parseInt((match.matches[0] as string).match('(?:debug port: )([\\d]{5})')[1], 10);
54-
if (attach) {
55-
// wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket
58+
if (!waitForRestartMessage) {
5659
setTimeout(() => { eventEmitter.emit('readyForConnection', debugPort); }, 1000);
5760
}
5861
});
59-
if (!attach) {
62+
if (waitForRestartMessage) {
6063
new scanner.StringMatchingScanner(readableStream).onEveryMatch('# NativeScript Debugger started #', (match: scanner.IMatchFound) => {
6164
// wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket
6265
setTimeout(() => { eventEmitter.emit('readyForConnection', debugPort); }, 1000);

0 commit comments

Comments
 (0)