Skip to content

Commit 88ad407

Browse files
committed
Merge branch 'master' into release
2 parents 40b48e0 + d9badf3 commit 88ad407

File tree

20 files changed

+232
-1009
lines changed

20 files changed

+232
-1009
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ before_install:
3333
- export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
3434
- export PATH=${PATH}:${ANDROID_NDK_HOME}
3535
script:
36-
- "./gradlew createPackage -i -PPACKAGE_VERSION=$PACKAGE_VERSION --stacktrace"
36+
- "./gradlew createPackage -i -PpreReleaseVersion=$PACKAGE_VERSION -PgitCommitVersion=$TRAVIS_COMMIT --stacktrace"
3737
- echo no | android create avd --force -n Arm21 -t android-21 -b armeabi-v7a -c 12M
3838
- emulator -avd Arm21 -no-skin -no-audio -no-window &
3939
- android-wait-for-emulator
4040
- "cd test-app && ./gradlew runtest --stacktrace"
4141
- cd ..
4242
before_deploy:
4343
- FULL_PACKAGE_VERSION=`sed -n 's/\s*"version":\s*"\([a-zA-Z0-9\.]*\)"\s*,*/\1/p' dist/package.json`
44-
- mv dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz ../.deploymentpackage
44+
- ls -la dist
45+
- mv dist/tns-android*.tgz ../.deploymentpackage
4546
- mv .travis ../
4647
- cd ..
4748
- rm -rf android-runtime

build-artifacts/project-template-gradle/build-tools/android-static-binding-generator/ast-parser/visitors/es5-visitors.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ var es5_visitors = (function () {
1111
TYPESCRIPT_EXTEND_STRING = FILE_SEPARATOR + "rnal_ts_helpers_l47_c38",
1212
customExtendsArr = [],
1313
normalExtendsArr = [],
14-
interfacesArr = [];
14+
interfacesArr = [],
15+
16+
customExtendsArrGlobal = [];
1517

1618
/* ENTRY POINT!
1719
* Traverses each passed node with several visitors.
@@ -227,7 +229,7 @@ var es5_visitors = (function () {
227229
if(config.logger) {
228230
config.logger.info(lineToWrite)
229231
}
230-
customExtendsArr.push(lineToWrite)
232+
addCustomExtend(classNameFromDecorator, config.fullPathName, lineToWrite)
231233
}
232234

233235
/*
@@ -299,8 +301,9 @@ var es5_visitors = (function () {
299301
if(config.logger) {
300302
config.logger.info(lineToWrite)
301303
}
302-
lineToWrite = _generateLineToWrite(isCorrectExtendClassName ? className : "", extendClass.reverse().join("."), overriddenMethodNames, "", config.fullPathName);
303-
customExtendsArr.push(lineToWrite)
304+
var classNameFromDecorator = isCorrectExtendClassName ? className : "";
305+
lineToWrite = _generateLineToWrite(classNameFromDecorator, extendClass.reverse().join("."), overriddenMethodNames, "", config.fullPathName);
306+
addCustomExtend(classNameFromDecorator, config.fullPathName, lineToWrite)
304307
return;
305308
}
306309

@@ -464,6 +467,22 @@ var es5_visitors = (function () {
464467
return lineToWrite;
465468
}
466469

470+
function addCustomExtend(param, extendPath, lineToWrite) {
471+
if(customExtendsArrGlobal.indexOf(param) === -1) {
472+
customExtendsArr.push(lineToWrite)
473+
customExtendsArrGlobal.push(param)
474+
}
475+
else {
476+
console.log("Warning: there already is an extend called " + param + ".")
477+
if(extendPath.indexOf("tns_modules") === -1) {
478+
// app folder will take precedence over tns_modules
479+
console.log("Warning: The static binding generator will generate extend from:" + extendPath + " implementation")
480+
customExtendsArr.push(lineToWrite)
481+
customExtendsArrGlobal.push(param)
482+
}
483+
}
484+
}
485+
467486
return {
468487
es5Visitor: es5Visitor
469488
}

build-artifacts/project-template-gradle/build.gradle

Lines changed: 90 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
* -Palias=[alias_to_use_from_keystore_file]
1111
* -Ppassword=[password_for_alias]
1212
*
13-
* -PtargetSdk=[target_sdk] (default is 22)
14-
* -PbuildToolsVersion=[build_tools_version] (default is 22.0.1)
15-
* -PsupportVersion=[support_version] (default (22.2.0)
16-
* -PcompileSdk=[compile_sdk_version] (default 22)
13+
* -PtargetSdk=[target_sdk]
14+
* -PbuildToolsVersion=[build_tools_version]
15+
* -PsupportVersion=[support_version]
16+
* -PcompileSdk=[compile_sdk_version]
1717
18-
* -PdontRunSbg=[true/false] (default false)
18+
* -PdontRunSbg=[true/false]
1919
*/
2020

2121
import groovy.json.JsonSlurper //used to parse package.json
@@ -222,6 +222,60 @@ task pluginStructureCheck {
222222
}
223223
}
224224

225+
def updateProductFlavorsContent(flavor, dimensionName, oldContent) {
226+
def endIndex = oldContent.length() - 1;
227+
def index = 0;
228+
def newContent = "";
229+
def level = -1;
230+
def dimensionFound = false;
231+
232+
while(index <= endIndex) {
233+
if(level == 0 && (oldContent[index] == '"' || oldContent[index] == "'")) {
234+
def closingQuotes = oldContent.indexOf('"', index + 1);
235+
if(closingQuotes == -1) {
236+
closingQuotes = oldContent.indexOf("'", index + 1);
237+
}
238+
239+
index = closingQuotes + 1;
240+
newContent += "\"${flavor}\"";
241+
continue;
242+
}
243+
244+
if(oldContent[index] == "{") {
245+
level++;
246+
}
247+
248+
if(oldContent[index] == "}") {
249+
level--;
250+
}
251+
252+
if(level > 0) {
253+
if(!dimensionFound && oldContent.indexOf("dimension", index) == index) {
254+
newContent += "dimension \"${dimensionName}\"";
255+
dimensionFound = true;
256+
index += "dimension ".length();
257+
def openingQuoutes = oldContent.indexOf('"', index);
258+
if(openingQuoutes == -1) {
259+
openingQuoutes = oldContent.indexOf("'", index);
260+
}
261+
262+
def closingQuotes = oldContent.indexOf('"', openingQuoutes + 1);
263+
if(closingQuotes == -1) {
264+
closingQuotes = closingQuotes.indexOf("'", openingQuoutes + 1);
265+
}
266+
267+
index = closingQuotes + 1;
268+
}
269+
}
270+
271+
newContent += oldContent[index];
272+
273+
index++;
274+
}
275+
276+
return newContent;
277+
}
278+
225279
def createProductFlavorsContent(flavor, dimensionName, includeAndroidContent = true)
226280
{
227281
if (includeAndroidContent)
@@ -250,7 +304,6 @@ android {
250304
}
251305
}
252306

253-
254307
def createIncludeFile (filePath, flavor, dimensionName) {
255308
println "\t + creating include.gradle file for ${filePath}"
256309

@@ -264,39 +317,38 @@ def sanatizeDimensionName(str) {
264317

265318
def replaceProductFlavorInContent(content, dimension, flavor)
266319
{
267-
def indexStart = content.indexOf("productFlavors");
268-
def index = indexStart + "productFlavors".length();
269-
def indexEnd = -1;
270-
def nestedOpenBraketsCount = 0;
271-
272-
while (index < content.length())
273-
{
274-
print content[index]
275-
if (content[index] == "}")
276-
{
277-
if (nestedOpenBraketsCount == 0)
278-
{
279-
indexEnd = index;
280-
break;
281-
}
282-
else
283-
{
284-
nestedOpenBraketsCount--;
285-
}
286-
}
287-
else if (content[index] == "{")
288-
{
289-
nestedOpenBraketsCount++;
290-
}
291-
292-
index++;
293-
}
294-
295-
if (indexEnd != -1)
320+
def indexStart = content.indexOf("productFlavors");
321+
def index = indexStart + "productFlavors".length();
322+
def indexEnd = -1;
323+
def nestedOpenBraketsCount = 0;
324+
325+
while (index < content.length())
326+
{
327+
// print content[index];
328+
if (content[index] == "}")
329+
{
330+
nestedOpenBraketsCount--;
331+
332+
if (nestedOpenBraketsCount == 0)
333+
{
334+
indexEnd = index;
335+
break;
336+
}
337+
}
338+
else if (content[index] == "{")
339+
{
340+
nestedOpenBraketsCount++;
341+
}
342+
343+
index++;
344+
}
345+
346+
if (indexEnd != -1)
296347
{
297-
def oldProductFlavorsText = content.substring(indexStart, indexEnd - 1);
298-
299-
def newProductFlavorsContent = createProductFlavorsContent(flavor, dimension, false);
348+
// full content of productFlavors { ... } -> the substring is parenthesis to parenthesis -> { ... }
349+
def oldProductFlavorsText = content.substring(indexStart, indexEnd + 1);
350+
351+
def newProductFlavorsContent = updateProductFlavorsContent(flavor, dimension, oldProductFlavorsText);
300352

301353
return content.replace(oldProductFlavorsText, newProductFlavorsContent);
302354
}

build-artifacts/project-template-gradle/src/main/java/com/tns/AndroidJsDebugger.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,12 @@ public void start()
437437
Handler handler = new Handler(handlerThread.getLooper());
438438

439439
this.registerEnableDisableDebuggerReceiver(handler);
440-
440+
441+
AndroidJsDebugger.this.debugContext.enableAgent();
442+
441443
boolean shouldDebugBreak = getDebugBreakFlagAndClearIt();
442444
if (shouldDebugBreak)
443445
{
444-
AndroidJsDebugger.this.debugContext.enableAgent();
445446
AndroidJsDebugger.this.debugContext.debugBreak();
446447
}
447448
}

0 commit comments

Comments
 (0)