Skip to content

Commit 0d908c1

Browse files
author
Vasil Hristov
authored
Merge pull request #1467 from NativeScript/master
Release
2 parents 8b66dcd + abc97d0 commit 0d908c1

File tree

221 files changed

+66422
-73897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+66422
-73897
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ bin/
2020
.settings
2121

2222
.classpath
23-
android-runtime.iml
23+
android-runtime.iml

Diff for: .travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
env:
22
global:
33
- NODE_VERSION=10
4-
- NDK_VERSION=r19c
4+
- NDK_VERSION=r20
55
- DATE=$(date +%Y-%m-%d)
66
- PACKAGE_VERSION=next-$DATE-$TRAVIS_BUILD_NUMBER
77
- EMULATOR_API_LEVEL=21
88
- ANDROID_ABI=armeabi-v7a
99
- EMULATOR_NAME=runtime-emu
10-
- BUILD_TOOLS=28.0.3
11-
- ANDROID_API=28
10+
- BUILD_TOOLS=29.0.2
11+
- ANDROID_API=29
1212

1313
matrix:
1414
include:

Diff for: CHANGELOG.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
6.1.0
2+
==
3+
4+
## What's New
5+
- [Runtime Binding Generator depends on deprecated APIs #1441)](https://github.com/NativeScript/android-runtime/issues/1441)
6+
- [The runtime depends on accessing a hidden value field (#1458)](https://github.com/NativeScript/android-runtime/issues/1458)
7+
- [Upgrade v8 to 7.6.303.28 (#1439)](https://github.com/NativeScript/android-runtime/issues/1439)
8+
- [Unify JS stack trace when exception is thrown #1443](https://github.com/NativeScript/android-runtime/issues/1443)
9+
- [Update androidSdk, targetSdk and build tools to 29 (#1452)](https://github.com/NativeScript/android-runtime/issues/1452)
10+
- [Upgrade android gradle plugin to the latest 3.5.0 version (#1456)](https://github.com/NativeScript/android-runtime/issues/1456)
11+
- [Add initial Kotlin support (#1459)](https://github.com/NativeScript/android-runtime/issues/1459)
12+
- [Add support for user defined gradle.properties (#1463)](https://github.com/NativeScript/android-runtime/issues/1463)
13+
14+
15+
## Bug Fixes
16+
17+
- [SIGSEGV in libNativeScript.so on callback from java with console.log when displaying an object. #1366](https://github.com/NativeScript/android-runtime/issues/1366)
18+
119
6.0.2
220
==
321

422
## What's New
523

6-
- [Include x86_64 architecture](https://github.com/NativeScript/android-runtime/issues/1419)
24+
- [Include x86_64 architecture](https://github.com/NativeScript/android-runtime/issues/1419)
725

826
6.0.1
927
==
@@ -16,7 +34,6 @@
1634
- [Upgrade android gradle plugin to the latest 3.4.2 version (#1425)](https://github.com/NativeScript/android-runtime/issues/1425)
1735

1836

19-
2037
6.0.0
2138
==
2239

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"v8Version": "7.5.288.22",
2+
"v8Version": "7.6.303.28",
33
"mksnapshotParams": "--profile_deserialization --turbo_instruction_scheduling --target_os=android --no-native-code-counters"
44
}

Diff for: build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ task copyFilesToProjectTemeplate {
286286
from "$TEST_APP_PATH/build.gradle"
287287
into "$DIST_FRAMEWORK_PATH"
288288
}
289+
copy {
290+
from "$TEST_APP_PATH/paths.gradle"
291+
into "$DIST_FRAMEWORK_PATH"
292+
}
293+
copy {
294+
from "$TEST_APP_PATH/user_properties_reader.gradle"
295+
into "$DIST_FRAMEWORK_PATH"
296+
}
289297
copy {
290298
from "$TEST_APP_PATH/gradle"
291299
into "$DIST_FRAMEWORK_PATH/gradle"

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

Diff for: package.json

+4-4
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": "6.0.2",
4+
"version": "6.1.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/NativeScript/android-runtime.git"
@@ -10,8 +10,8 @@
1010
"**/*"
1111
],
1212
"gradle": {
13-
"version": "5.1.1",
14-
"android": "3.4.2"
13+
"version": "5.4.1",
14+
"android": "3.5.0"
1515
},
16-
"android_ndk_version": "19c"
16+
"android_ndk_version": "20"
1717
}

Diff for: test-app/app/build.gradle

+47-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,25 @@
1818
* -PandroidXMaterial=[androidx_material_version]
1919
*/
2020

21+
22+
import groovy.io.FileType
2123
import groovy.json.JsonSlurper
24+
25+
import javax.inject.Inject
2226
import java.nio.file.Files
2327
import java.nio.file.Paths
2428
import java.nio.file.StandardCopyOption
25-
import groovy.io.FileType
2629
import java.security.MessageDigest
27-
import javax.inject.Inject
30+
2831
apply plugin: "com.android.application"
2932

33+
def enableKotlin = (project.hasProperty("useKotlin") && project.useKotlin == "true")
34+
35+
if (enableKotlin) {
36+
apply plugin: 'kotlin-android'
37+
apply plugin: 'kotlin-android-extensions'
38+
}
39+
3040
def onlyX86 = project.hasProperty("onlyX86")
3141
if (onlyX86) {
3242
println "OnlyX86 build triggered."
@@ -61,10 +71,11 @@ def METADATA_OUT_PATH = "$projectDir/src/main/assets/metadata"
6171
def pluginsJarLibraries = new LinkedList<String>()
6272
def allJarLibraries = new LinkedList<String>()
6373

64-
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 28 }
65-
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 28 }
74+
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.3.41" }
75+
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 29 }
76+
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 29 }
6677
def computeBuildToolsVersion = { ->
67-
project.hasProperty("buildToolsVersion") ? buildToolsVersion : "28.0.3"
78+
project.hasProperty("buildToolsVersion") ? buildToolsVersion : "29.0.2"
6879
}
6980

7081
project.ext.selectedBuildType = project.hasProperty("release") ? "release" : "debug"
@@ -217,6 +228,13 @@ def setAppIdentifier = { ->
217228
}
218229

219230
android {
231+
232+
if (enableKotlin) {
233+
kotlinOptions {
234+
jvmTarget = '1.8'
235+
}
236+
}
237+
220238
compileSdkVersion computeCompileSdkVersion()
221239
buildToolsVersion computeBuildToolsVersion()
222240

@@ -302,6 +320,7 @@ repositories {
302320
dirs pluginDependencies
303321
}
304322
}
323+
mavenCentral()
305324
}
306325

307326
dependencies {
@@ -320,9 +339,9 @@ dependencies {
320339
androidXMaterialVersion = androidXMaterial
321340
}
322341

323-
println "\t + using andorid X library androidx.legacy:legacy-support-v4:$androidXLegacyVersion"
342+
println "\t + using android X library androidx.legacy:legacy-support-v4:$androidXLegacyVersion"
324343

325-
implementation "androidx.multidex:multidex:2.0.0"
344+
implementation "androidx.multidex:multidex:2.0.1"
326345
implementation "androidx.legacy:legacy-support-v4:$androidXLegacyVersion"
327346
implementation "androidx.appcompat:appcompat:$androidXAppCompatVersion"
328347
implementation "com.google.android.material:material:$androidXMaterialVersion"
@@ -361,6 +380,11 @@ dependencies {
361380
implementation project(':runtime')
362381
}
363382

383+
def kotlinVersion = computeKotlinVersion()
384+
if (enableKotlin) {
385+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
386+
}
387+
364388
}
365389

366390
////////////////////////////////////////////////////////////////////////////////////
@@ -545,7 +569,7 @@ afterEvaluate { project ->
545569
// if there's a project dependency search for its result jar file in the build/intermediates/runtime_library_classes folder
546570
// this is the output folder in gradle 5.1.1, but it can be changed in the future versions of gradle
547571
def jarDir = new File("${it.getBuildDir()}/intermediates/runtime_library_classes/${buildType.toLowerCase()}")
548-
if(jarDir.exists()) {
572+
if (jarDir.exists()) {
549573
jarDir.eachFileRecurse(FileType.FILES) { file ->
550574
if (file.path.endsWith(".jar")) {
551575
processJar(file, jars)
@@ -574,7 +598,7 @@ def processJar(File jar, jars) {
574598
// directory is a randomly generated string)
575599
cleanupAllJars.inputs.files jar
576600

577-
task "${taskName}" (type: WorkerTask) {
601+
task "${taskName}"(type: WorkerTask) {
578602
dependsOn cleanupAllJars
579603
extractAllJars.dependsOn it
580604

@@ -683,6 +707,11 @@ task buildMetadata(type: JavaExec) {
683707
def classesDir = "$buildDir/intermediates/javac"
684708
inputs.dir(classesDir)
685709

710+
def kotlinClassesDir = "$buildDir/tmp/kotlin-classes"
711+
if (file(kotlinClassesDir).exists()) {
712+
inputs.dir(kotlinClassesDir)
713+
}
714+
686715
outputs.files("$METADATA_OUT_PATH/treeNodeStream.dat", "$METADATA_OUT_PATH/treeStringsStream.dat", "$METADATA_OUT_PATH/treeValueStream.dat")
687716

688717
doFirst {
@@ -700,6 +729,15 @@ task buildMetadata(type: JavaExec) {
700729
}
701730
}
702731

732+
if (file(kotlinClassesDir).exists()) {
733+
def kotlinClassesSubDirs = new File(kotlinClassesDir).listFiles()
734+
for (File subDir : kotlinClassesSubDirs) {
735+
if (subDir.getName() == selectedBuildType) {
736+
generatedClasses.add(subDir.getAbsolutePath())
737+
}
738+
}
739+
}
740+
703741
new File("$BUILD_TOOLS_PATH/$MDG_OUTPUT_DIR").withWriter { out ->
704742
out.println "$METADATA_OUT_PATH"
705743
}

Diff for: test-app/app/src/main/assets/app/mainpage.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ require("./tests/dex-interface-implementation");
5353
require("./tests/testInterfaceImplementation");
5454
require("./tests/testRuntimeImplementedAPIs");
5555
require("./tests/testsInstanceOfOperator");
56-
require("./tests/testReleaseNativeCounterpart");
56+
require("./tests/testReleaseNativeCounterpart");
57+
require("./tests/kotlin/companions/testCompanionObjectsSupport");
58+
require("./tests/kotlin/properties/testPropertiesSupport");
59+
require("./tests/kotlin/delegation/testDelegationSupport");
60+
require("./tests/kotlin/objects/testObjectsSupport");
61+
require("./tests/kotlin/functions/testTopLevelFunctionsSupport");
-227 KB
Binary file not shown.
-1.01 MB
Binary file not shown.
-710 KB
Binary file not shown.
-1.28 MB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
describe("Tests Kotlin companion objects support", function () {
2+
it("Test Kotlin companion object without a name should be supported", function () {
3+
var stringFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithCompanion.Companion.getStringFromCompanion();
4+
expect(stringFromCompanion).toBe("testCompanion");
5+
6+
var providedStringFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithCompanion.Companion.getProvidedStringFromCompanion("providedString");
7+
expect(providedStringFromCompanion).toBe("providedString");
8+
9+
var simpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithCompanion.Companion.getSimpleObjectFromCompanion();
10+
expect(simpleObjectFromCompanion.getSomeString()).toBe("test");
11+
12+
var simpleKotlinObject = new com.tns.tests.kotlin.SimpleKotlinObject();
13+
var providedSimpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithCompanion.Companion.getProvidedSimpleObjectFromCompanion(simpleKotlinObject);
14+
expect(simpleKotlinObject.equals(providedSimpleObjectFromCompanion)).toBe(true);
15+
16+
var stringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithCompanion.getStringJvmStaticFromCompanion();
17+
expect(stringJvmStaticFromCompanion).toBe("testCompanion");
18+
19+
var providedStringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithCompanion.getProvidedStringJvmStaticFromCompanion("providedString");
20+
expect(providedStringJvmStaticFromCompanion).toBe("providedString");
21+
});
22+
23+
it("Test Kotlin named companion object without a name should be supported", function () {
24+
var stringFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithNamedCompanion.NamedCompanion.getStringFromNamedCompanion();
25+
expect(stringFromCompanion).toBe("testCompanion");
26+
27+
var providedStringFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithNamedCompanion.NamedCompanion.getProvidedStringFromNamedCompanion("providedString");
28+
expect(providedStringFromCompanion).toBe("providedString");
29+
30+
var simpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithNamedCompanion.NamedCompanion.getSimpleObjectFromNamedCompanion();
31+
expect(simpleObjectFromCompanion.getSomeString()).toBe("test");
32+
33+
var simpleKotlinObject = new com.tns.tests.kotlin.SimpleKotlinObject();
34+
var providedSimpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithNamedCompanion.NamedCompanion.getProvidedSimpleObjectFromNamedCompanion(simpleKotlinObject);
35+
expect(simpleKotlinObject.equals(providedSimpleObjectFromCompanion)).toBe(true);
36+
37+
var stringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithNamedCompanion.getStringJvmStaticFromNamedCompanion();
38+
expect(stringJvmStaticFromCompanion).toBe("testCompanion");
39+
40+
var providedStringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinClassWithNamedCompanion.getProvidedStringJvmStaticFromNamedCompanion("providedString");
41+
expect(providedStringJvmStaticFromCompanion).toBe("providedString");
42+
});
43+
44+
45+
it("Test Kotlin interface companion object without a name should be supported", function () {
46+
var stringFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithCompanion.Companion.getStringFromCompanion();
47+
expect(stringFromCompanion).toBe("testCompanion");
48+
49+
var providedStringFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithCompanion.Companion.getProvidedStringFromCompanion("providedString");
50+
expect(providedStringFromCompanion).toBe("providedString");
51+
52+
var simpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithCompanion.Companion.getSimpleObjectFromCompanion();
53+
expect(simpleObjectFromCompanion.getSomeString()).toBe("test");
54+
55+
var simpleKotlinObject = new com.tns.tests.kotlin.SimpleKotlinObject();
56+
var providedSimpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithCompanion.Companion.getProvidedSimpleObjectFromCompanion(simpleKotlinObject);
57+
expect(simpleKotlinObject.equals(providedSimpleObjectFromCompanion)).toBe(true);
58+
59+
var stringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithCompanion.getStringJvmStaticFromCompanion();
60+
expect(stringJvmStaticFromCompanion).toBe("testCompanion");
61+
62+
var providedStringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithCompanion.getProvidedStringJvmStaticFromCompanion("providedString");
63+
expect(providedStringJvmStaticFromCompanion).toBe("providedString");
64+
});
65+
66+
it("Test Kotlin interface named companion object without a name should be supported", function () {
67+
var stringFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithNamedCompanion.NamedCompanion.getStringFromNamedCompanion();
68+
expect(stringFromCompanion).toBe("testCompanion");
69+
70+
var providedStringFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithNamedCompanion.NamedCompanion.getProvidedStringFromNamedCompanion("providedString");
71+
expect(providedStringFromCompanion).toBe("providedString");
72+
73+
var simpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithNamedCompanion.NamedCompanion.getSimpleObjectFromNamedCompanion();
74+
expect(simpleObjectFromCompanion.getSomeString()).toBe("test");
75+
76+
var simpleKotlinObject = new com.tns.tests.kotlin.SimpleKotlinObject();
77+
var providedSimpleObjectFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithNamedCompanion.NamedCompanion.getProvidedSimpleObjectFromNamedCompanion(simpleKotlinObject);
78+
expect(simpleKotlinObject.equals(providedSimpleObjectFromCompanion)).toBe(true);
79+
80+
var stringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithNamedCompanion.getStringJvmStaticFromNamedCompanion();
81+
expect(stringJvmStaticFromCompanion).toBe("testCompanion");
82+
83+
var providedStringJvmStaticFromCompanion = com.tns.tests.kotlin.companions.KotlinInterfaceWithNamedCompanion.getProvidedStringJvmStaticFromNamedCompanion("providedString");
84+
expect(providedStringJvmStaticFromCompanion).toBe("providedString");
85+
});
86+
87+
it("Test Kotlin class whose parent class contains a companion should work", function () {
88+
var child = new com.tns.tests.kotlin.companions.ChildKotlinClass();
89+
var str = child.getStringFromCompanion();
90+
expect(str).toBe("someString");
91+
});
92+
93+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe("Tests Kotlin delegation support", function () {
2+
it("Test Kotlin class implementation delegation should work", function () {
3+
var delegationObject = new com.tns.tests.kotlin.delegation.DelegationClass();
4+
expect(delegationObject.getString()).toBe("some string");
5+
});
6+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
describe("Tests Kotlin top level functions support", function () {
2+
it("Test Kotlin top level functions in an unnamed class should work", function () {
3+
var res = com.tns.tests.kotlin.functions.TopLevelFunctionsKt.getRandomNumber();
4+
expect(res).toBe(42);
5+
});
6+
7+
it("Test Kotlin top level functions in a named class should work", function () {
8+
var res = com.tns.tests.kotlin.functions.DemoUtils.getRandomString();
9+
expect(res).toBe("42");
10+
});
11+
12+
it("Test Kotlin top level functions in a named multifile class should work", function () {
13+
var res1 = com.tns.tests.kotlin.multifiles.Utils.getNewString();
14+
expect(res1).toBe("new string");
15+
16+
var res2 = com.tns.tests.kotlin.multifiles.Utils.getOldString();
17+
expect(res2).toBe("old string");
18+
});
19+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
describe("Tests Kotlin objects support", function () {
2+
it("Test Kotlin object instances should be the same reference", function () {
3+
var kotlinClass = com.tns.tests.kotlin.objects.KotlinSingleton.INSTANCE;
4+
var kotlinClass2 = com.tns.tests.kotlin.objects.KotlinSingleton.INSTANCE;
5+
expect(com.tns.EqualityComparator.areReferencesEqual(kotlinClass, kotlinClass2)).toBe(true);
6+
});
7+
});

0 commit comments

Comments
 (0)