Skip to content

Commit c40965d

Browse files
vmutafovmbektchievsaschaarthur
authored
Prepare release 6.5.1 (#1616)
* chore:Update CHANGELOG for v6.5.0 * Make buildMetadata aware of whitelist/blacklist files (#1590) * - warning cleanups (#1610) * Bump to 6.5.1 * Update CHANGELOG.md for 6.5.1 * Hardcode first emulator * Use wait-for-device Co-authored-by: Martin Bektchiev <[email protected]> Co-authored-by: saschaarthur <[email protected]>
1 parent 06980ed commit c40965d

File tree

10 files changed

+88
-76
lines changed

10 files changed

+88
-76
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
6.5.1
2+
==
3+
4+
## Bug Fixes
5+
6+
- [Cleanup of warnings / possible not checked nullpointers (#1610)](https://github.com/NativeScript/android-runtime/pull/1610)
7+
8+
- [[metadata] not rebuilding on json api usage change (#1589)](https://github.com/NativeScript/android-runtime/issues/1589)
9+
10+
6.5.0
11+
==
12+
13+
### No changes
14+
115
6.4.1
216
==
317

build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ for emulator in $listOfEmulators; do
5555
find ~/.android/avd/${emulator}.avd -type f -name 'config.ini' -exec cat {} +
5656

5757
echo "Run Android Runtime unit tests for $emulator"
58-
$ANDROID_HOME/platform-tools/adb devices
59-
$ANDROID_HOME/platform-tools/adb -e logcat -c
60-
$ANDROID_HOME/platform-tools/adb -e logcat > consoleLog.txt&
61-
$ANDROID_HOME/platform-tools/adb -e logcat > consoleLog$emulator.txt&
58+
$ANDROID_HOME/platform-tools/adb wait-for-device
59+
$ANDROID_HOME/platform-tools/adb -s emulator-5554 logcat -c
60+
$ANDROID_HOME/platform-tools/adb -s emulator-5554 logcat > consoleLog.txt&
61+
$ANDROID_HOME/platform-tools/adb -s emulator-5554 logcat > consoleLog$emulator.txt&
6262

6363
if [ "$1" != 'unit_tests_only' ]; then
6464
./gradlew runtests

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": "6.5.0",
4+
"version": "6.5.1",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/NativeScript/android-runtime.git"

test-app/app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,9 @@ task buildMetadata(type: BuildToolTask) {
767767
description "builds metadata with provided jar dependencies"
768768

769769
inputs.files("$MDG_JAVA_DEPENDENCIES")
770+
771+
// make MDG aware of whitelist.mdg and blacklist.mdg files
772+
inputs.files(project.fileTree(dir: "$rootDir", include: "**/*.mdg"))
770773

771774
def classesDir = "$buildDir/intermediates/javac"
772775
inputs.dir(classesDir)

test-app/build-tools/android-metadata-generator/src/src/com/telerik/metadata/Builder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ private static TreeNode getOrCreateNode(TreeNode root, NativeClassDescriptor cla
438438

439439
if (ClassUtil.isPrimitive(clazz)) {
440440
TreeNode tmp = TreeNode.getPrimitive(clazz);
441+
if(tmp == null)
442+
throw new UnsupportedOperationException("tmp == null" + clazz.getClassName());
441443
child.nodeType = tmp.nodeType;
442444
} else {
443445
child.nodeType = clazz.isInterface() ? TreeNode.Interface
@@ -449,7 +451,7 @@ private static TreeNode getOrCreateNode(TreeNode root, NativeClassDescriptor cla
449451
}
450452
node = child;
451453
if (node.baseClassNode == null) {
452-
NativeClassDescriptor baseClass = null;
454+
NativeClassDescriptor baseClass;
453455
if (predefinedSuperClassname != null) {
454456
SecuredNativeClassDescriptor securedNativeClassDescriptor = SecuredClassRepository.INSTANCE.findNearestAllowedClass(predefinedSuperClassname);
455457
baseClass = securedNativeClassDescriptor.isUsageAllowed() ? securedNativeClassDescriptor.getNativeDescriptor() : null;
@@ -503,6 +505,8 @@ private static TreeNode createArrayNode(TreeNode root, String className)
503505
child = currentNode.createChild(name);
504506
if (ClassUtil.isPrimitive(name)) {
505507
TreeNode node = TreeNode.getPrimitive(name);
508+
if(node == null)
509+
throw new UnsupportedOperationException("node == null: " + name);
506510
child.nodeType = node.nodeType;
507511
child.arrayElement = node;
508512
} else {

test-app/build-tools/android-metadata-generator/src/src/com/telerik/metadata/ClassDirectory.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
import java.io.File;
1818
import java.io.IOException;
19-
import java.util.ArrayList;
20-
import java.util.HashMap;
21-
import java.util.List;
22-
import java.util.Map;
19+
import java.util.*;
2320

2421
public class ClassDirectory implements ClassMapProvider {
2522
private final String path;
@@ -31,7 +28,7 @@ public class ClassDirectory implements ClassMapProvider {
3128

3229
private ClassDirectory(String path) {
3330
this.path = path;
34-
this.classMap = new HashMap<String, NativeClassDescriptor>();
31+
this.classMap = new HashMap<>();
3532
}
3633

3734
public Map<String, NativeClassDescriptor> getClassMap() {
@@ -50,9 +47,9 @@ public static ClassDirectory readDirectory(String path) throws IOException {
5047

5148
private static void readDirectory(ClassDirectory dir, String path)
5249
throws IOException {
53-
List<File> subDirs = new ArrayList<File>();
50+
List<File> subDirs = new ArrayList<>();
5451
File currentDir = new File(path);
55-
for (File file : currentDir.listFiles()) {
52+
for (File file : Objects.requireNonNull(currentDir.listFiles())) {
5653
if (file.isFile()) {
5754
String name = file.getName();
5855
if (name.endsWith(CLASS_EXT)) {
@@ -73,7 +70,6 @@ private static NativeClassDescriptor getClassDescriptor(String name, File file)
7370
if (name.endsWith(CLASS_EXT)) {
7471
ClassParser cp = new ClassParser(file.getAbsolutePath());
7572
JavaClass javaClass = cp.parse();
76-
boolean isKotlinClass = false;
7773

7874
AnnotationEntry[] annotationEntries = javaClass.getAnnotationEntries();
7975
if (annotationEntries != null) {
@@ -82,16 +78,13 @@ private static NativeClassDescriptor getClassDescriptor(String name, File file)
8278
if ("Lkotlin/Metadata;".equals(annotationType)) {
8379
MetadataAnnotation kotlinClassMetadataAnnotation = new BytecodeMetadataAnnotation(annotationEntry);
8480
NativeClassDescriptor kotlinClassDescriptor = new KotlinClassDescriptor(javaClass, kotlinClassMetadataAnnotation);
85-
isKotlinClass = true;
8681
analyticsCollector.markHasKotlinRuntimeClassesIfNotMarkedAlready();
8782
return kotlinClassDescriptor;
8883
}
8984
}
9085
}
9186

92-
if (!isKotlinClass) {
93-
return new JavaClassDescriptor(javaClass);
94-
}
87+
return new JavaClassDescriptor(javaClass);
9588
}
9689

9790
return clazz;

test-app/build-tools/android-metadata-generator/src/src/com/telerik/metadata/ClassUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ public static String getSimpleName(NativeClassDescriptor clazz) {
6161
if (idx < 0) {
6262
idx = className.lastIndexOf(".");
6363
}
64-
String simpleName = className.substring(idx + 1);
65-
return simpleName;
64+
return className.substring(idx + 1);
6665
}
6766

6867
static NativeMethodDescriptor[] getAllMethods(NativeClassDescriptor clazz) {
69-
ArrayList<NativeMethodDescriptor> methods = new ArrayList<NativeMethodDescriptor>();
68+
ArrayList<NativeMethodDescriptor> methods = new ArrayList<>();
7069
NativeClassDescriptor currentClass = clazz;
7170
while (currentClass != null) {
7271
NativeMethodDescriptor[] currentClassMethods = currentClass.getMethods();

test-app/build-tools/android-metadata-generator/src/src/com/telerik/metadata/Generator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class Generator {
2424
private static final String MDG_BLACKLIST = "blacklist.mdg";
2525

2626
/**
27-
* @param args
27+
* @param args arguments
2828
*/
2929
public static void main(String[] args) {
3030
enableFlaggedFeatures(args);
@@ -38,12 +38,12 @@ public static void main(String[] args) {
3838
try {
3939
metadataOutputDir = getFileRows(MDG_OUTPUT_DIR).get(0);
4040
} catch (Exception e) {
41-
throw new InvalidParameterException(String.format("You need to pass a file containing a single line: the output dir for the metadata generator1\n", e.getMessage()));
41+
throw new InvalidParameterException(String.format("You need to pass a file containing a single line: the output dir for the metadata generator %s\n", e.getMessage()));
4242
}
4343
try {
4444
params = getFileRows(MDG_JAVA_DEPENDENCIES);
4545
} catch (Exception e) {
46-
throw new InvalidParameterException(String.format("You need to pass a file containing a list of jar/class paths, so metadata can be generated for them!\n", e.getMessage()));
46+
throw new InvalidParameterException(String.format("You need to pass a file containing a list of jar/class paths, so metadata can be generated for them! %s\n", e.getMessage()));
4747
}
4848

4949
TreeNode root = Builder.build(params);

test-app/build-tools/android-metadata-generator/src/src/com/telerik/metadata/TreeNode.java

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ public String getPropertyName() {
7171
}
7272

7373
public Optional<MethodInfo> getGetterMethod() {
74-
return getterMethod == null ? Optional.<MethodInfo>empty() : Optional.of(getterMethod);
74+
return getterMethod == null ? Optional.empty() : Optional.of(getterMethod);
7575
}
7676

7777
public Optional<MethodInfo> getSetterMethod() {
78-
return setterMethod == null ? Optional.<MethodInfo>empty() : Optional.of(setterMethod);
78+
return setterMethod == null ? Optional.empty() : Optional.of(setterMethod);
7979
}
8080
}
8181

@@ -144,51 +144,53 @@ public static TreeNode getPrimitive(NativeClassDescriptor clazz) throws Exceptio
144144

145145
String name = clazz.getClassName();
146146

147-
if (name.equals("byte")) {
148-
return TreeNode.BYTE;
149-
} else if (name.equals("short")) {
150-
return TreeNode.SHORT;
151-
} else if (name.equals("int")) {
152-
return TreeNode.INTEGER;
153-
} else if (name.equals("long")) {
154-
return TreeNode.LONG;
155-
} else if (name.equals("float")) {
156-
return TreeNode.FLOAT;
157-
} else if (name.equals("double")) {
158-
return TreeNode.DOUBLE;
159-
} else if (name.equals("boolean")) {
160-
return TreeNode.BOOLEAN;
161-
} else if (name.equals("char")) {
162-
return TreeNode.CHAR;
163-
} else if (name.equals("void")) {
164-
return null;
165-
} else {
166-
throw new Exception("unknown type=" + name);
147+
switch (name) {
148+
case "byte":
149+
return TreeNode.BYTE;
150+
case "short":
151+
return TreeNode.SHORT;
152+
case "int":
153+
return TreeNode.INTEGER;
154+
case "long":
155+
return TreeNode.LONG;
156+
case "float":
157+
return TreeNode.FLOAT;
158+
case "double":
159+
return TreeNode.DOUBLE;
160+
case "boolean":
161+
return TreeNode.BOOLEAN;
162+
case "char":
163+
return TreeNode.CHAR;
164+
case "void":
165+
return null;
166+
default:
167+
throw new Exception("unknown type=" + name);
167168
}
168169
}
169170

170171
public static TreeNode getPrimitive(String name)
171172
throws IllegalArgumentException {
172-
if (name.equals("B")) {
173-
return TreeNode.BYTE;
174-
} else if (name.equals("S")) {
175-
return TreeNode.SHORT;
176-
} else if (name.equals("I")) {
177-
return TreeNode.INTEGER;
178-
} else if (name.equals("J")) {
179-
return TreeNode.LONG;
180-
} else if (name.equals("F")) {
181-
return TreeNode.FLOAT;
182-
} else if (name.equals("D")) {
183-
return TreeNode.DOUBLE;
184-
} else if (name.equals("Z")) {
185-
return TreeNode.BOOLEAN;
186-
} else if (name.equals("C")) {
187-
return TreeNode.CHAR;
188-
} else if (name.equals("V")) {
189-
return null;
190-
} else {
191-
throw new IllegalArgumentException("unknown type=" + name);
173+
switch (name) {
174+
case "B":
175+
return TreeNode.BYTE;
176+
case "S":
177+
return TreeNode.SHORT;
178+
case "I":
179+
return TreeNode.INTEGER;
180+
case "J":
181+
return TreeNode.LONG;
182+
case "F":
183+
return TreeNode.FLOAT;
184+
case "D":
185+
return TreeNode.DOUBLE;
186+
case "Z":
187+
return TreeNode.BOOLEAN;
188+
case "C":
189+
return TreeNode.CHAR;
190+
case "V":
191+
return null;
192+
default:
193+
throw new IllegalArgumentException("unknown type=" + name);
192194
}
193195
}
194196

test-app/build-tools/android-metadata-generator/src/src/com/telerik/metadata/Writer.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.nio.ByteBuffer;
77
import java.nio.ByteOrder;
88
import java.nio.IntBuffer;
9+
import java.nio.charset.StandardCharsets;
910
import java.util.ArrayDeque;
1011
import java.util.HashMap;
1112
import java.util.List;
@@ -42,7 +43,7 @@ private static int writeUniqueName(String name,
4243
writeUniqueName_lenBuff[1] = (byte) ((len >> 8) & 0xFF);
4344

4445
outStringsStream.write(writeUniqueName_lenBuff);
45-
outStringsStream.write(name.getBytes("UTF-8"));
46+
outStringsStream.write(name.getBytes(StandardCharsets.UTF_8));
4647

4748
uniqueStrings.put(name, position);
4849

@@ -61,7 +62,7 @@ private static void writeInt(int value, StreamWriter out) throws Exception {
6162
private static void writeMethodInfo(MethodInfo mi,
6263
HashMap<String, Integer> uniqueStrings, StreamWriter outValueStream)
6364
throws Exception {
64-
int pos = uniqueStrings.get(mi.name).intValue();
65+
int pos = uniqueStrings.get(mi.name);
6566
writeInt(pos, outValueStream);
6667

6768
byte isResolved = (byte) (mi.isResolved ? 1 : 0);
@@ -190,9 +191,9 @@ public void writeClassValue(StreamWriter writer,
190191
public void writeTree(TreeNode root) throws Exception {
191192
short curId = 0;
192193

193-
ArrayDeque<TreeNode> d = new ArrayDeque<TreeNode>();
194+
ArrayDeque<TreeNode> d = new ArrayDeque<>();
194195

195-
HashMap<String, Integer> uniqueStrings = new HashMap<String, Integer>();
196+
HashMap<String, Integer> uniqueStrings = new HashMap<>();
196197

197198
commonInterfacePrefixPosition = writeUniqueName("com/tns/gen/",
198199
uniqueStrings, outStringsStream);
@@ -275,9 +276,7 @@ public void writeTree(TreeNode root) throws Exception {
275276
}
276277
}
277278

278-
for (TreeNode child : n.children) {
279-
d.add(child);
280-
}
279+
d.addAll(n.children);
281280
}
282281

283282
outStringsStream.flush();
@@ -307,9 +306,7 @@ public void writeTree(TreeNode root) throws Exception {
307306
throw new Exception("should not happen");
308307
}
309308

310-
for (TreeNode child : n.children) {
311-
d.add(child);
312-
}
309+
d.addAll(n.children);
313310
}
314311

315312
outValueStream.flush();

0 commit comments

Comments
 (0)