Skip to content

Commit 6aeea75

Browse files
authored
Merge pull request #964 from NativeScript/pete/merge-release
merge release into master
2 parents 1dc2ce8 + d1c84d7 commit 6aeea75

File tree

3 files changed

+36
-30
lines changed

3 files changed

+36
-30
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
3.4.2
2+
==
3+
4+
## Bug Fixes
5+
6+
- [fix include gradle flavor generation for plugins with incomplete include.gradle scripts (#937)](https://github.com/NativeScript/android-runtime/pull/937)
7+
18
3.4.1
29
==
310

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

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -371,43 +371,42 @@ static def sanitizeDimensionName(str) {
371371
}
372372

373373
static def modifyProductFlavorInContent(content, dimension, flavor) {
374-
def indexStart = content.indexOf("productFlavors");
375-
def index = indexStart + "productFlavors".length();
376-
def indexEnd = -1;
377-
def nestedOpenBracketsCount = 0;
378-
379-
while (index < content.length())
380-
{
381-
// print content[index];
382-
if (content[index] == "}")
383-
{
384-
nestedOpenBracketsCount--;
385-
386-
if (nestedOpenBracketsCount == 0)
387-
{
388-
indexEnd = index;
389-
break;
374+
def PRODUCT_FLAVORS = "productFlavors"
375+
def indexStart = content.indexOf(PRODUCT_FLAVORS)
376+
def index = indexStart + PRODUCT_FLAVORS.length()
377+
def indexEnd = -1
378+
def nestedOpenBracketsCount = 0
379+
380+
if (indexStart != -1) {
381+
// get the index of the closing bracket of the productFlavors { } scope
382+
while (index < content.length()) {
383+
// print content[index];
384+
if (content[index] == "}") {
385+
nestedOpenBracketsCount--
386+
387+
if (nestedOpenBracketsCount == 0) {
388+
indexEnd = index
389+
break
390+
}
391+
} else if (content[index] == "{") {
392+
nestedOpenBracketsCount++
390393
}
391-
}
392-
else if (content[index] == "{")
393-
{
394-
nestedOpenBracketsCount++;
395-
}
396394

397-
index++;
395+
index++
396+
}
398397
}
399398

400-
if (indexEnd != -1)
401-
{
399+
400+
if (indexEnd != -1) {
401+
// replace the productFlavor dimension with a shorter one - F0, F1, F2, etc.
402402
// full content of productFlavors { ... } -> the substring is parenthesis to parenthesis -> { ... }
403-
def oldProductFlavorsText = content.substring(indexStart, indexEnd + 1);
403+
def oldProductFlavorsText = content.substring(indexStart, indexEnd + 1)
404404

405405
def newProductFlavorsContent = updateProductFlavorsContent(flavor, dimension, oldProductFlavorsText);
406406

407-
return content.replace(oldProductFlavorsText, newProductFlavorsContent);
408-
}
409-
else
410-
{
407+
return content.replace(oldProductFlavorsText, newProductFlavorsContent)
408+
} else {
409+
// create a productFlavor dimension - F0, F1, F2, etc.
411410
def androidContentExists = content.indexOf("android {") != -1;
412411
def newProductFlavorsContent = createProductFlavorsContent(flavor, dimension, !androidContentExists);
413412

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tns-android",
33
"description": "NativeScript Runtime for Android",
4-
"version": "3.4.1",
4+
"version": "3.4.2",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/NativeScript/android-runtime.git"

0 commit comments

Comments
 (0)