From 2f9e2c9baab36e0aea7ab1faad1cffc2054ecea6 Mon Sep 17 00:00:00 2001 From: KIM JungYong Date: Tue, 18 Oct 2016 15:54:07 +0900 Subject: [PATCH] Update build script for RE android sample app. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/13369 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi Tested-by: Uze Choi --- service/resource-encapsulation/android/SConscript | 37 ++++++++++++++++++++-- service/resource-encapsulation/examples/SConscript | 2 +- .../android/RESampleClientApp/app/build.gradle | 8 +++-- .../android/RESampleClientApp/build.gradle | 3 +- .../android/RESampleServerApp/app/build.gradle | 8 +++-- .../android/RESampleServerApp/build.gradle | 3 +- 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/service/resource-encapsulation/android/SConscript b/service/resource-encapsulation/android/SConscript index 689eec9..229a7b4 100644 --- a/service/resource-encapsulation/android/SConscript +++ b/service/resource-encapsulation/android/SConscript @@ -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) + + diff --git a/service/resource-encapsulation/examples/SConscript b/service/resource-encapsulation/examples/SConscript index 2fffd52..177388a 100644 --- a/service/resource-encapsulation/examples/SConscript +++ b/service/resource-encapsulation/examples/SConscript @@ -5,4 +5,4 @@ Import('env') target_os = env.get('TARGET_OS') if target_os in ['linux']: - SConscript('linux/SConscript') + SConscript('linux/SConscript') diff --git a/service/resource-encapsulation/examples/android/RESampleClientApp/app/build.gradle b/service/resource-encapsulation/examples/android/RESampleClientApp/app/build.gradle index 48c699f..8c70e9d 100644 --- a/service/resource-encapsulation/examples/android/RESampleClientApp/app/build.gradle +++ b/service/resource-encapsulation/examples/android/RESampleClientApp/app/build.gradle @@ -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" } diff --git a/service/resource-encapsulation/examples/android/RESampleClientApp/build.gradle b/service/resource-encapsulation/examples/android/RESampleClientApp/build.gradle index 6f0accc..555dac4 100644 --- a/service/resource-encapsulation/examples/android/RESampleClientApp/build.gradle +++ b/service/resource-encapsulation/examples/android/RESampleClientApp/build.gradle @@ -17,7 +17,8 @@ allprojects { jcenter() flatDir { - dirs 'libs' + dirs '../../../../android/service/build/outputs/aar' + dirs '../../../../../../android/android_api/base/build/outputs/aar' } } } diff --git a/service/resource-encapsulation/examples/android/RESampleServerApp/app/build.gradle b/service/resource-encapsulation/examples/android/RESampleServerApp/app/build.gradle index 1f64223..4b5ef9e 100644 --- a/service/resource-encapsulation/examples/android/RESampleServerApp/app/build.gradle +++ b/service/resource-encapsulation/examples/android/RESampleServerApp/app/build.gradle @@ -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" } diff --git a/service/resource-encapsulation/examples/android/RESampleServerApp/build.gradle b/service/resource-encapsulation/examples/android/RESampleServerApp/build.gradle index 6f0accc..555dac4 100644 --- a/service/resource-encapsulation/examples/android/RESampleServerApp/build.gradle +++ b/service/resource-encapsulation/examples/android/RESampleServerApp/build.gradle @@ -17,7 +17,8 @@ allprojects { jcenter() flatDir { - dirs 'libs' + dirs '../../../../android/service/build/outputs/aar' + dirs '../../../../../../android/android_api/base/build/outputs/aar' } } } -- 2.7.4