build: Correct app version and enable automated upload to Google Play

Change-Id: I253bb795b65dfc4cff52c244c824d42f7fc71c17
diff --git a/README-dev.md b/README-dev.md
new file mode 100644
index 0000000..a9210b1
--- /dev/null
+++ b/README-dev.md
@@ -0,0 +1,50 @@
+Developer Notes
+===============
+
+## To build debug version of NFD
+
+Configure `ndk.dir` and `sdk.dir` in `local.properties` file.  For example:
+
+    ndk.dir=/opt/crystax-ndk-10.2.1
+    sdk.dir=/opt/android-sdk-macosx
+
+Alternatively, you can set `ANDROID_NDK_ROOT` environment variable to point towards NDK folder.
+
+Build process can be customized using several environment variables:
+
+- `NDK_DEBUG`
+
+   If set, the native code is built in debug mode.  For example:
+
+        NDK_DEBUG=1 build assembleDebug
+
+- `NDK_BUILD_ABI=<comma-separated-list-of-platforms>`
+
+  If set, the native code is built only for the specified platforms.  For example, the following snippet will build NFD only for x86 platform:
+
+        export NDK_BUILD_ABI=x86
+        build assembleDebug
+
+- `NDK_BUILD_PARALLEL=<number>`
+
+  If set, the build will be limited with the specified number of parallel builds.  Otherwise, the build will be automatically parallelized based on the number of available CPUs.
+
+## To build the release version of NFD
+
+In order to build the release version of NFD, it needs to be properly signed.  In order to specify keystore, keystore's password, key in the keystore, and key's password, add the following configuration into `local.properties` file:
+
+
+    keystore=<path-to-.keystore-file>
+    keystore.password=<keystore-password>
+    keystore.key.alias=<key-alias-in-keystore>
+    keystore.key.password=<key-password>
+
+For more information about application signing and instructions on how to generate keys, refer to [Android Documentation](http://developer.android.com/tools/publishing/app-signing.html).
+
+## To publish the release version on Google Play
+
+The release version of NFD can be automatically uploaded to Google Play, if Google Play parameters are configured in `local.properties` files:
+
+    google-play=<path-to-json-config>
+
+Note that `.json` config can be downloaded from Google Developer Console.  For more information, refer to [Google Play Publishing Plugin](https://github.com/Triple-T/gradle-play-publisher).
diff --git a/app/build.gradle b/app/build.gradle
index 57b585b..9695397 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@
         applicationId "net.named_data.nfd"
         minSdkVersion 15
         targetSdkVersion 19
-        versionCode 2001
-        versionName "0.2.1"
+        versionCode 3005
+        versionName "0.3.4"
     }
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
@@ -45,7 +45,7 @@
     splits {
         abi {
             enable true // enable ABI split feature to create one APK per ABI
-            universalApk true //generate an additional APK that targets all the ABIs
+            universalApk false // don't generate an additional APK that targets all the ABIs
         }
     }
 
@@ -110,12 +110,14 @@
     return ndk_build
 }
 
+
 def getNdkDir() {
     if (System.env.ANDROID_NDK_ROOT != null)
         return System.env.ANDROID_NDK_ROOT
 
     Properties properties = new Properties()
     properties.load(project.rootProject.file('local.properties').newDataInputStream())
+
     def ndk_dir = properties.getProperty('ndk.dir', null)
     if (ndk_dir == null) {
         throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
@@ -153,3 +155,37 @@
     compile 'net.named-data.jndn-xx:jndn-xx-util:0.0.1'
     compile 'joda-time:joda-time:2.7'
 }
+
+Properties properties = new Properties()
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+
+if (properties['keystore'] == null || properties['keystore.password'] == null ||
+    properties['keystore.key.alias'] == null || properties['keystore.key.password'] == null) {
+    println("Cannot sign .apk: specify keystore, keystore.password, keystore.key.alias, and keystore.key.password in local.properties.")
+}
+else {
+    android {
+        signingConfigs {
+            release {
+                storeFile file(properties['keystore'])
+                storePassword properties['keystore.password']
+                keyAlias properties['keystore.key.alias']
+                keyPassword properties['keystore.key.password']
+            }
+        }
+        buildTypes {
+            release {
+                signingConfig signingConfigs.release
+            }
+        }
+    }
+}
+
+if (properties['google-play'] != null) {
+    apply plugin: 'net.named-data.playground.play'
+
+    play {
+        track = 'alpha'
+        jsonFile = file(properties['google-play'])
+    }
+}
diff --git a/app/src/main/play/contactEmail b/app/src/main/play/contactEmail
new file mode 100644
index 0000000..e406e99
--- /dev/null
+++ b/app/src/main/play/contactEmail
@@ -0,0 +1 @@
+info@named-data.net
\ No newline at end of file
diff --git a/app/src/main/play/contactPhone b/app/src/main/play/contactPhone
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/src/main/play/contactPhone
diff --git a/app/src/main/play/contactWebsite b/app/src/main/play/contactWebsite
new file mode 100644
index 0000000..b2845c5
--- /dev/null
+++ b/app/src/main/play/contactWebsite
@@ -0,0 +1 @@
+http://named-data.net
\ No newline at end of file
diff --git a/app/src/main/play/defaultLanguage b/app/src/main/play/defaultLanguage
new file mode 100644
index 0000000..f2b0341
--- /dev/null
+++ b/app/src/main/play/defaultLanguage
@@ -0,0 +1 @@
+en-US
\ No newline at end of file
diff --git a/app/src/main/play/en-US/listing/fulldescription b/app/src/main/play/en-US/listing/fulldescription
new file mode 100644
index 0000000..37cd1bf
--- /dev/null
+++ b/app/src/main/play/en-US/listing/fulldescription
@@ -0,0 +1,3 @@
+NFD is an open and free software package licensed under GPL 3.0 license and is the centerpiece of our commitment to making NDN's core technology open and free to all Internet users and developers. The main design goal of NFD is to support diverse experimentation of NDN technology. The design emphasizes modularity and extensibility to allow easy experiments with new protocol features, algorithms, new applications. We have not fully optimized the code for performance. The intention is that performance optimizations are one type of experiments that developers can conduct by trying out different data structures and different algorithms; over time, better implementations may emerge within the same design framework.
+
+NFD is developed by a community effort. Although the first release was mostly done by the members of NSF-sponsored NDN project team, it already contains significant contributions from people outside the project team.  We strongly encourage participation from all interested parties, since broader community support is key for NDN to succeed as a new Internet architecture.
\ No newline at end of file
diff --git a/app/src/main/play/en-US/listing/shortdescription b/app/src/main/play/en-US/listing/shortdescription
new file mode 100644
index 0000000..8531243
--- /dev/null
+++ b/app/src/main/play/en-US/listing/shortdescription
@@ -0,0 +1 @@
+Network forwarder for the Named Data Networking (NDN) protocol
\ No newline at end of file
diff --git a/app/src/main/play/en-US/listing/title b/app/src/main/play/en-US/listing/title
new file mode 100644
index 0000000..546e521
--- /dev/null
+++ b/app/src/main/play/en-US/listing/title
@@ -0,0 +1 @@
+NDN Forwarding Daemon (NFD)
\ No newline at end of file
diff --git a/app/src/main/play/en-US/listing/video b/app/src/main/play/en-US/listing/video
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/src/main/play/en-US/listing/video
diff --git a/build.gradle b/build.gradle
index 96a0a6d..e725ddd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,9 +3,13 @@
 buildscript {
     repositories {
         jcenter()
+        maven {
+            url "https://oss.sonatype.org/content/repositories/snapshots/"
+        }
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
+        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
+        classpath 'net.named-data.playground:play-publisher:1.2.0-2-SNAPSHOT'
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files