Skip to content

Commit 8965bc0

Browse files
author
Mihail Slavchev
committed
merge with master
2 parents e24c652 + 4d3dac0 commit 8965bc0

79 files changed

Lines changed: 3385 additions & 7765 deletions

File tree

Some content is hidden

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

.travis.yml

Lines changed: 58 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,68 @@
11
env:
2-
global:
3-
- NDK_VERSION=r10e
2+
global:
3+
- NDK_VERSION=r10e
4+
- DATE=$(date +%Y-%m-%d)
5+
- PACKAGE_VERSION=$DATE-$TRAVIS_BUILD_NUMBER
6+
- ANDROID_VERSION=19
7+
- ANDROID_SUPPORT_VERSION=19.0.0
8+
- PACKAGE_NAME=tns-android
49
sudo: false
5-
language:
6-
android
10+
language: android
711
jdk:
8-
- oraclejdk8
12+
- oraclejdk8
913
git:
10-
submodules: false
14+
submodules: false
1115
android:
12-
components:
13-
- platform-tools
14-
- tools
15-
16-
- build-tools-22.0.1
17-
- android-19
18-
19-
- extra-android-support
20-
- extra-android-m2repository
21-
22-
- sys-img-armeabi-v7a-android-19
23-
16+
components:
17+
- platform-tools
18+
- tools
19+
- build-tools-22.0.1
20+
- android-19
21+
- extra-android-support
22+
- extra-android-m2repository
23+
- sys-img-armeabi-v7a-android-19
2424
before_cache:
25-
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
25+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
2626
cache:
27-
directories:
28-
- $HOME/.gradle/caches/
29-
- $HOME/.gradle/wrapper/
27+
directories:
28+
- "$HOME/.gradle/caches/"
29+
- "$HOME/.gradle/wrapper/"
3030
before_install:
31-
- sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
32-
- git submodule update --init --recursive
33-
- wget http://dl.google.com/android/ndk/android-ndk-$NDK_VERSION-linux-x86_64.bin
34-
- chmod +x android-ndk-$NDK_VERSION-linux-x86_64.bin
35-
- ./android-ndk-$NDK_VERSION-linux-x86_64.bin | egrep -v ^Extracting
36-
- export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
37-
- export PATH=${PATH}:${ANDROID_NDK_HOME}
38-
31+
- sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
32+
- git submodule update --init --recursive
33+
- wget http://dl.google.com/android/ndk/android-ndk-$NDK_VERSION-linux-x86_64.bin
34+
- chmod +x android-ndk-$NDK_VERSION-linux-x86_64.bin
35+
- "./android-ndk-$NDK_VERSION-linux-x86_64.bin | egrep -v ^Extracting"
36+
- export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
37+
- export PATH=${PATH}:${ANDROID_NDK_HOME}
3938
before_script:
40-
- echo no | android create avd --force -n Arm19 -t android-19 -b armeabi-v7a -c 12M
41-
- emulator -avd Arm19 -no-skin -no-audio -no-window &
42-
- android-wait-for-emulator
43-
39+
- echo no | android create avd --force -n Arm19 -t android-19 -b armeabi-v7a -c 12M
40+
- emulator -avd Arm19 -no-skin -no-audio -no-window &
41+
- android-wait-for-emulator
4442
script:
45-
- ./gradlew packar -i -PPACKAGE_VERSION=5.5.5 -PcompileSdk=android-19 -PsupportVersion=19.0.0 --stacktrace
46-
- ./gradlew runtest -PenableTest -PcompileSdk=android-19 -PsupportVersion=19.0.0 -PtargetSdk=19 --stacktrace
47-
43+
- "./gradlew packar -i -PPACKAGE_VERSION=$PACKAGE_VERSION -PcompileSdk=android-$ANDROID_VERSION
44+
-PsupportVersion=$ANDROID_SUPPORT_VERSION --stacktrace"
45+
- "./gradlew runtest -PenableTest -PcompileSdk=android-$ANDROID_VERSION -PsupportVersion=$ANDROID_SUPPORT_VERSION
46+
-PtargetSdk=$ANDROID_VERSION --stacktrace"
47+
before_deploy:
48+
- FULL_PACKAGE_VERSION=`sed -n 's/\s*"version":\s*"\([a-zA-Z0-9.\-]\+\)"/\1/p' dist/package.json`
49+
- mv dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz ../.deploymentpackage
50+
- mv .travis ../
51+
- cd ..
52+
- rm -rf android-runtime
53+
- tar -zxvf .deploymentpackage
54+
- mv package android-runtime
55+
- cd android-runtime
56+
- rm ../.deploymentpackage
57+
- nvm install 4.2.6
58+
- nvm use 4.2.6
59+
- mv ../.travis ./
60+
- node ./.travis/add-publishConfig.js next
61+
deploy:
62+
provider: npm
63+
email: nativescript@telerik.com
64+
on:
65+
branch: master
66+
skip_cleanup: true
67+
api_key:
68+
secure: aFJZR8VIbFAlXfFx5G2AveSgpGjr40prghvw8m06X0yvmUQlucwHVyq+Ov0ZD94br8d7OUOPbUzh+p9N/+oXLAXOj3DbQmJaCc+fk/e+avHu1BRy3fg295P9BQau1Abu+2ZO7tUbg5zAqJqhbEgjXsr9B5gxl+vwh4lbDhCPCwo=

.travis/add-publishConfig.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env node
2+
3+
var fsModule = require('fs');
4+
5+
//Adds a publishConfig section to the package.json file
6+
// and sets a tag to it
7+
8+
var path = './package.json';
9+
var fileOptions = {encoding: "utf-8"};
10+
var content = fsModule.readFileSync(path, fileOptions);
11+
12+
var tag = process.argv[2];
13+
if (!tag) {
14+
console.log('Please pass the tag name as an argument!');
15+
process.exit(1);
16+
}
17+
18+
var packageDef = JSON.parse(content);
19+
if (!packageDef.publishConfig) {
20+
packageDef.publishConfig = {};
21+
}
22+
packageDef.publishConfig.tag = tag;
23+
24+
var newContent = JSON.stringify(packageDef, null, ' ');
25+
fsModule.writeFileSync(path, newContent, fileOptions);

android-metadata-generator

binding-generator/README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
11
# android-binding-generator
2-
Contains the source of the binding generator tool for the NativeScript's Android Runtime.
2+
3+
This project is used in the [NativeScript runtime for Android](https://github.com/NativeScript/android-runtime) to generate Java subclasses at runtime. Supppose you have the following Java class
4+
5+
```Java
6+
package com.example;
7+
8+
public class MyClass {
9+
public int add(int x, int y) {
10+
return x + y;
11+
}
12+
}
13+
```
14+
15+
In NativeScript, you can inherit from `MyClass` using the following syntax:
16+
17+
```JavaScript
18+
var MyNewClass = com.example.MyClass.extend({
19+
add: function(x, y) {
20+
return x * y;
21+
}
22+
})
23+
24+
var obj = new MyNewClass();
25+
```
26+
27+
Using `extend` function will create a new Java class that looks roughly as follows
28+
```Java
29+
package <some auto-generated package name>;
30+
31+
public <some auto-generated class name> extends com.example.MyClass {
32+
public int add(int x, int y) {
33+
java.lang.Object[] params = new Object[2];
34+
params[0] = x;
35+
params[1] = y;
36+
return (int)com.tns.Platform.callJSMethod(this, "add", int.class, params);
37+
}
38+
}
39+
```
40+
The binding generator uses [ASMDEX library](http://asm.ow2.org/asmdex-index.html) to create the class above and to produce the corresponding `*.dex` file.

0 commit comments

Comments
 (0)