You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2016/10/22 14:02:35 UTC

incubator-edgent git commit: Edgent-304 Always build edgent.android.{hardware, topology}.jar

Repository: incubator-edgent
Updated Branches:
  refs/heads/master 49c9989da -> b7ade1384


Edgent-304 Always build edgent.android.{hardware,topology}.jar

Get android.jar from maven for compilation

Note: the android jar is not included in the binary tgz.
ANDROID_SDK_PLATFORM is no longer used / has no effect.

Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/b7ade138
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/b7ade138
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/b7ade138

Branch: refs/heads/master
Commit: b7ade1384788bbbbc08e784855c2fbb45d1fc80a
Parents: 49c9989
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sat Oct 22 09:43:05 2016 -0400
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sat Oct 22 09:43:05 2016 -0400

----------------------------------------------------------------------
 DEVELOPMENT.md                |  5 -----
 android/hardware/build.gradle |  5 ++---
 android/hardware/build.xml    | 11 +++++++++--
 android/topology/build.gradle |  5 +----
 android/topology/build.xml    | 11 +++++++++--
 build.gradle                  |  4 +++-
 platform/java7/build.gradle   |  6 ++++++
 platform/java7/build.xml      |  9 ++++++++-
 settings.gradle               |  9 ++-------
 9 files changed, 40 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/DEVELOPMENT.md
----------------------------------------------------------------------
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 7a8fadd..494580c 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -34,11 +34,6 @@ these additional development software tools.
 
 * Java 8 - The development setup assumes Java 8 and Linux. 
 
-These are optional
-
-* Android SDK - Allows building of Android specific modules. Set the environment variable `ANDROID_SDK_PLATFORM` to
-the location of the Android platform so that ${ANDROID_SDK_PLATFORM}/android.jar points to a valid jar.
-
 ### Building a Binary Release Bundle
 
 Building an Edgent binary release bundle:

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/android/hardware/build.gradle
----------------------------------------------------------------------
diff --git a/android/hardware/build.gradle b/android/hardware/build.gradle
index a8d2d45..6931b0e 100644
--- a/android/hardware/build.gradle
+++ b/android/hardware/build.gradle
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-// NB settings.gradle conditionally includes this project
-// based on System.env.ANDROID_SDK_PLATFORM
+ext.androidJarSpec = 'com.google.android:android:4.1.1.4@jar'
 
 dependencies {
   addTargetDirProjectJarDependency 'compile', ':api:topology'
-  compile files("${System.env.ANDROID_SDK_PLATFORM}/android.jar")
+  addProjectExtDependency 'compile', androidJarSpec
   
   // N.B. root project adds test common dependencies
 }

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/android/hardware/build.xml
----------------------------------------------------------------------
diff --git a/android/hardware/build.xml b/android/hardware/build.xml
index 71fdc23..2c6b89d 100644
--- a/android/hardware/build.xml
+++ b/android/hardware/build.xml
@@ -27,6 +27,13 @@
   <property name="component.path" value="android/hardware"/>
   <import file="../../common-build.xml"/>
 
+  <property name="android.sdk.platform.jar" value=""/>
+<!--	
+  <condition property="android.sdk.platform.jar" value="env.ANDROID_SDK_PLATFORM_JAR">
+    <isset property="env.ANDROID_SDK_PLATFORM_JAR" />
+  </condition>
+-->
+
   <path id="compile.classpath">
     <pathelement location="${edgent.lib}/edgent.api.topology.jar" />
   </path>
@@ -34,7 +41,7 @@
 
   <path id="android.classpath">
     <path refid="compile.classpath"/>
-    <pathelement location="${env.ANDROID_SDK_PLATFORM}/android.jar"/>
+    <pathelement location="${android.sdk.platform.jar}"/>
   </path>
 
   <path id="test.compile.classpath">
@@ -48,7 +55,7 @@
     <path refid="test.common.classpath" />
   </path>
 
- <target name="all" if="env.ANDROID_SDK_PLATFORM">
+ <target name="all" if="android.sdk.platform.jar">
     <antcall target="edgent.common.all"/>
  </target>
 

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/android/topology/build.gradle
----------------------------------------------------------------------
diff --git a/android/topology/build.gradle b/android/topology/build.gradle
index 32c9975..b68b970 100644
--- a/android/topology/build.gradle
+++ b/android/topology/build.gradle
@@ -12,13 +12,10 @@
  * limitations under the License.
  */
 
-// NB settings.gradle conditionally includes this project
-// based on System.env.ANDROID_SDK_PLATFORM
-
 dependencies {
   addTargetDirProjectJarDependency 'compile', ':api:topology'
   addTargetDirProjectJarDependency 'compile', ':api:oplet'
-  compile files("${System.env.ANDROID_SDK_PLATFORM}/android.jar")
+  addProjectExtDependency 'compile', project(':android:hardware').androidJarSpec
 
   // N.B. root project adds test common dependencies
 }

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/android/topology/build.xml
----------------------------------------------------------------------
diff --git a/android/topology/build.xml b/android/topology/build.xml
index 91dc0e5..f0f63fe 100644
--- a/android/topology/build.xml
+++ b/android/topology/build.xml
@@ -27,6 +27,13 @@
   <property name="component.path" value="android/topology"/>
   <import file="../../common-build.xml"/>
 
+  <property name="android.sdk.platform.jar" value=""/>
+<!--	
+  <condition property="android.sdk.platform.jar" value="env.ANDROID_SDK_PLATFORM_JAR">
+    <isset property="env.ANDROID_SDK_PLATFORM_JAR" />
+  </condition>
+-->
+
   <path id="compile.classpath">
     <pathelement location="${edgent.lib}/edgent.api.topology.jar" />
     <pathelement location="${edgent.lib}/edgent.api.oplet.jar" />
@@ -35,7 +42,7 @@
 
   <path id="android.classpath">
     <path refid="compile.classpath"/>
-    <pathelement location="${env.ANDROID_SDK_PLATFORM}/android.jar"/>
+    <pathelement location="${android.sdk.platform.jar}"/>
   </path>
 
   <path id="test.compile.classpath">
@@ -49,7 +56,7 @@
     <path refid="test.common.classpath" />
   </path>
 
- <target name="all" if="env.ANDROID_SDK_PLATFORM">
+ <target name="all" if="android.sdk.platform.jar">
     <antcall target="edgent.common.all"/>
  </target>
 

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 72653a6..5efd499 100644
--- a/build.gradle
+++ b/build.gradle
@@ -131,7 +131,9 @@ task copyCommonExtJars << {
 
 def String mkJarNameFromSpec(String jarSpec) {
   // e.g. 'com.google.code.gson:gson:2.2.4' => gson-2.2.4.jar
-  return jarSpec.split(':')[1] + '-' + jarSpec.split(':')[2] + '.jar'
+  // e.g. 'com.google.code.gson:gson:2.2.4@jar' => gson-2.2.4.jar
+  def sfx = jarSpec.endsWith('@jar') ? "" : '.jar'
+  return jarSpec.split(':')[1] + '-' + jarSpec.split(':')[2].replace('@','.') + sfx
 }
 
 def getProjectExtDepFiles(Project proj) { // project's direct ext deps and their transitive deps

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/platform/java7/build.gradle
----------------------------------------------------------------------
diff --git a/platform/java7/build.gradle b/platform/java7/build.gradle
index c4dae75..4681342 100644
--- a/platform/java7/build.gradle
+++ b/platform/java7/build.gradle
@@ -54,6 +54,12 @@ task preAntTask << {
   // make retrolambda available to the ant tooling
   copyProjectExtJarsFn2 "$external_jars_dir/tools"
   ant.properties['retrolambda.jar'] = "$external_jars_dir/tools/$retrolambdaJarName"
+  
+  // make android.jar available to the ant tooling
+  def hwProj = project(':android:hardware')
+  hwProj.copyProjectExtJarsFn "$external_jars_dir"
+  ant.properties['android.sdk.platform.jar'] = 
+    "$external_jars_dir/${hwProj.targetRelProjExtDir}/" + mkJarNameFromSpec(hwProj.androidJarSpec)
 }
 
 ant_retro7.doFirst { 

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/platform/java7/build.xml
----------------------------------------------------------------------
diff --git a/platform/java7/build.xml b/platform/java7/build.xml
index b17dc23..990afc4 100644
--- a/platform/java7/build.xml
+++ b/platform/java7/build.xml
@@ -42,6 +42,13 @@
     <property name="metrics.ext.dir" value="metrics-${metrics.version}/"/>
     <property name="retrolambda.jar" location="ext/retrolambda-${retrolambda.version}.jar"/>
 
+    <property name="android.sdk.platform.jar" value=""/>
+<!--	
+    <condition property="android.sdk.platform.jar" value="env.ANDROID_SDK_PLATFORM_JAR">
+      <isset property="env.ANDROID_SDK_PLATFORM_JAR" />
+    </condition>
+-->
+
 	<path id="edgent.classpath">
         <pathelement location="${ext.dir}/${slf4j.ext.dir}slf4j-api-${slf4j.version}.jar"/>
         <pathelement location="${ext.dir}/${gson.ext.dir}gson-${gson.version}.jar"/>
@@ -175,7 +182,7 @@
 		</copy>
 
 	</target>
-	<target name="retro7.edgent.android" if="env.ANDROID_SDK_PLATFORM">
+	<target name="retro7.edgent.android" if="android.sdk.platform.jar">
 		<retro7 qjar="edgent.android.topology.jar" qdir="android/topology/lib" />
 		<retro7 qjar="edgent.android.hardware.jar" qdir="android/hardware/lib" />
 	</target>

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b7ade138/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index dce6cc9..d59426d 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -66,12 +66,7 @@ include 'test:fvtiot'
 include 'test:svt'
 include 'platform:java7'
 include 'platform:android'
-if (System.env.ANDROID_SDK_PLATFORM != null) {
-  include 'android:topology'
-  include 'android:hardware'
-}
-else {
-  logger.lifecycle 'ANDROID_SDK_PLATFORM ev not set. Omitting android:{topology,hardware} projects.'
-}
+include 'android:topology'
+include 'android:hardware'
 
 rootProject.name = build_name