Update build script for RE android sample app.
authorKIM JungYong <jyong2.kim@samsung.com>
Tue, 18 Oct 2016 06:54:07 +0000 (15:54 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 20 Oct 2016 04:44:29 +0000 (04:44 +0000)
When building of RE android sample app,
we need to execute of scons build and also need additional android studio build.
With this patch, can build android sample app by only scons build.

Change-Id: Ife7142cf89993531bc15bf4b9f655090f50a1bad
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13369
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/resource-encapsulation/android/SConscript
service/resource-encapsulation/examples/SConscript
service/resource-encapsulation/examples/android/RESampleClientApp/app/build.gradle
service/resource-encapsulation/examples/android/RESampleClientApp/build.gradle
service/resource-encapsulation/examples/android/RESampleServerApp/app/build.gradle
service/resource-encapsulation/examples/android/RESampleServerApp/build.gradle

index 689eec9..229a7b4 100644 (file)
@@ -44,13 +44,44 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 
 
 def ensure_libs(target, source, env):
-    return target, [source, env.get('BUILD_DIR') + 'librcs_server.so', 
+    return target, [source, env.get('BUILD_DIR') + 'librcs_server.so',
                     env.get('BUILD_DIR') + 'librcs_client.so']
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + 
+jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
     ' build -bservice/resource-encapsulation/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
     emitter = ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-jdk_env.Gradle(target="service/objs", 
+cmdBuildRE = jdk_env.Gradle(target="service/objs",
     source="service/src/main/java/org/iotivity/service/RcsResourceAttributes.java")
+
+env.AppendUnique(resourceencapsulationAAR = cmdBuildRE)
+
+Depends(cmdBuildRE, env.get('baseAAR'))
+
+# Build RE Android Samples
+re_sample_server_env = Environment(ENV=os.environ)
+re_sample_server_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
+    ' build -bservice/resource-encapsulation/examples/android/RESampleServerApp/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter = ensure_libs)
+re_sample_server_env['BUILD_DIR'] = env.get('BUILD_DIR')
+cmdBuildREServerApp=re_sample_server_env.Gradle(target="../examples/android/RESampleServerApp/app/apk",
+    source=["../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/MainActivity.java",
+            "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/CustomServerActivity.java",
+            "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/ResourceProperties.java",
+            "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/SimpleServerActivity.java"])
+
+Depends(cmdBuildREServerApp, cmdBuildRE)
+
+re_sample_client_env = Environment(ENV=os.environ)
+re_sample_client_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
+    ' build -bservice/resource-encapsulation/examples/android/RESampleClientApp/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter = ensure_libs)
+re_sample_client_env['BUILD_DIR'] = env.get('BUILD_DIR')
+cmdBuildREClientApp=re_sample_client_env.Gradle(target="../examples/android/RESampleClientApp/app/apk",
+    source=["../examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/MainActivity.java",
+            "../examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/ResourceClientActivity.java"])
+
+Depends(cmdBuildREClientApp, cmdBuildRE)
+
+
index 2fffd52..177388a 100644 (file)
@@ -5,4 +5,4 @@ Import('env')
 
 target_os = env.get('TARGET_OS')
 if target_os in ['linux']:
-       SConscript('linux/SConscript')
+    SConscript('linux/SConscript')
index 48c699f..8c70e9d 100644 (file)
@@ -17,11 +17,15 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
+
+    lintOptions {
+        abortOnError false
+    }
 }
 
 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
 
-    compile(name:'iotivity-armeabi-service-release', ext:'aar')
-    compile(name:'iotivity-base-armeabi-release', ext:'aar')
+    compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
+    compile ":iotivity-${TARGET_ARCH}-service-${RELEASE}@aar"
 }
index 6f0accc..555dac4 100644 (file)
@@ -17,7 +17,8 @@ allprojects {
         jcenter()
 
         flatDir {
-            dirs 'libs'
+            dirs '../../../../android/service/build/outputs/aar'
+            dirs '../../../../../../android/android_api/base/build/outputs/aar'
         }
     }
 }
index 1f64223..4b5ef9e 100644 (file)
@@ -17,11 +17,15 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
+
+    lintOptions {
+        abortOnError false
+    }
 }
 
 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
 
-    compile(name:'iotivity-armeabi-service-release', ext:'aar')
-    compile(name:'iotivity-base-armeabi-release', ext:'aar')
+    compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
+    compile ":iotivity-${TARGET_ARCH}-service-${RELEASE}@aar"
 }
index 6f0accc..555dac4 100644 (file)
@@ -17,7 +17,8 @@ allprojects {
         jcenter()
 
         flatDir {
-            dirs 'libs'
+            dirs '../../../../android/service/build/outputs/aar'
+            dirs '../../../../../../android/android_api/base/build/outputs/aar'
         }
     }
 }