From 275b4306cde28d9e6f6fe7066d0fefeeeb1f93bf Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Wed, 16 Dec 2015 15:30:19 +0200 Subject: [PATCH] Replaced grunt with gradle --- .gitignore | 3 ++- .idea/.name | 2 +- .idea/misc.xml | 27 --------------------------- .idea/vcs.xml | 6 ------ README.md | 12 ++---------- build.gradle | 2 +- package.json | 9 +-------- widgets/build.gradle | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 39 insertions(+), 54 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index 209ff45ff..dd02daa6e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ .DS_Store /build /captures -/node_modules \ No newline at end of file +/node_modules +/dist \ No newline at end of file diff --git a/.idea/.name b/.idea/.name index 73aeaaf17..94e0f58fc 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -android-widgets-app \ No newline at end of file +android-widgets \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 5d1998103..1d9d62604 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,32 +1,5 @@ - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index ecb160ffb..de48a694a 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,8 @@ Contains the source code of the `org.nativescript.widgets` library used by the N ## How to Build ``` -gradle build +gradle packFramework ``` This generates widgets-debug.aar and widgets-release.aar files located in the widgets/build/outputs/aar folder. - -## How to Make NPM Package -Requires nodejs, npm, gradle and grunt. -``` -npm install -grunt -``` - -This generates tgz files in build folder. +And generates tgz files in dist folder. diff --git a/build.gradle b/build.gradle index b16936538..bc4714fe2 100644 --- a/build.gradle +++ b/build.gradle @@ -20,4 +20,4 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/package.json b/package.json index caf7480ac..ba46c7833 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,5 @@ "bugs": { "url": "https://github.com/NativeScript/android-widgets/issues" }, - "homepage": "https://github.com/NativeScript/android-widgets#readme", - "devDependencies": { - "grunt": "~0.4.5", - "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-copy": "^0.8.0", - "grunt-exec": "^0.4.6", - "grunt-mkdir": "^0.1.2" - } + "homepage": "https://github.com/NativeScript/android-widgets#readme" } diff --git a/widgets/build.gradle b/widgets/build.gradle index d166bc9ed..b5991c258 100644 --- a/widgets/build.gradle +++ b/widgets/build.gradle @@ -1,3 +1,5 @@ +def isWinOs = System.properties['os.name'].toLowerCase().contains('windows') + apply plugin: 'com.android.library' android { @@ -23,3 +25,33 @@ dependencies { testCompile 'junit:junit:4.12' compile 'com.android.support:support-v4:+' } + +task cleanDistDir (type: Delete) { + delete "../dist/" +} + +task copyAar << { + copy { + from "../package.json" + into "../dist" + } + copy { + from "build/outputs/aar/widgets-release.aar" + into "../dist/platforms/android/" + } +} + +task packFramework (type: Exec) { + workingDir "../dist" + + if(isWinOs) { + commandLine "cmd", "/c", "npm", "pack" + } + else { + commandLine "npm", "pack" + } +} + +assembleRelease.dependsOn(cleanDistDir) +copyAar.dependsOn(assembleRelease) +packFramework.dependsOn(copyAar)