From: George Nash Date: Wed, 1 Feb 2017 20:50:35 +0000 (-0800) Subject: build: Clean build folders when using scons -c X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f38487d4680199069c0b35156b88b32d270383f;p=contrib%2Fiotivity.git build: Clean build folders when using scons -c Since Android and Java code is built using gradle the build output is not properly tracked by scons. Scons' Clean method is used to add the build output to the clean build. This commit is limited to the `build` folders generated when building TARGET_OS=android or BUILD_JAVA=1. Change-Id: I69965272e377494bd99731fbacb2cc6e06ff7815 Signed-off-by: George Nash Reviewed-on: https://gerrit.iotivity.org/gerrit/16977 Tested-by: jenkins-iotivity Reviewed-by: Larry Sachs Reviewed-by: Rick Bell --- diff --git a/SConstruct b/SConstruct index 4bfe3b0..74b4589 100644 --- a/SConstruct +++ b/SConstruct @@ -57,15 +57,13 @@ if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows']: SConscript(build_dir + 'examples/OICMiddle/SConscript') java_build = None -if env.get('BUILD_JAVA') == True or target_os == 'android': - if env.get('JAVA_HOME') != None: +if (env.get('BUILD_JAVA') == True and env.get('JAVA_HOME') != None) or target_os == 'android': java_build = SConscript(build_dir + 'java/SConscript') # Build 'service' sub-project service_build = SConscript(build_dir + 'service/SConscript') -if env.get('BUILD_JAVA') == True or target_os == 'android': - if env.get('JAVA_HOME') != None: +if (env.get('BUILD_JAVA') == True and env.get('JAVA_HOME') != None) or target_os == 'android': Depends(service_build, java_build) # Build "cloud" sub-project diff --git a/java/SConscript b/java/SConscript index 5d4427c..b3b56d6 100644 --- a/java/SConscript +++ b/java/SConscript @@ -101,10 +101,39 @@ jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' b #cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (examples_target, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (examples_target, )) cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, )) -exampleAclFiles = jdk_env.Install('#java/examples-java/simpleserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat') -exampleAclFiles += jdk_env.Install('#java/examples-java/simpleclientserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat') +if target_os != 'android': + exampleAclFiles = jdk_env.Install('#java/examples-java/simpleserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat') + exampleAclFiles += jdk_env.Install('#java/examples-java/simpleclientserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat') + Depends(exampleAclFiles, cmdBuildExamples) -Depends(cmdBuildExamples, exampleAclFiles) Depends(cmdBuildExamples, cmdBuildApi) +if target_os == 'android': + jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-android/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/cloudprovisioningclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/DirectPairing/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/provisioningclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simplebase/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclientserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/') +else: + jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-linux/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclient/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclientserver/build/') + jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleserver/build/') + env.AppendUnique(baseAAR = cmdBuildApi) diff --git a/service/easy-setup/mediator/richsdk/android/SConscript b/service/easy-setup/mediator/richsdk/android/SConscript index 653d60d..21b3c04 100755 --- a/service/easy-setup/mediator/richsdk/android/SConscript +++ b/service/easy-setup/mediator/richsdk/android/SConscript @@ -74,7 +74,8 @@ jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + jdk_env['BUILD_DIR'] = env.get('BUILD_DIR') cmdBuildEasysetup=jdk_env.Gradle(target="EasySetupCore/objs", source="EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java") -jdk_env.Clean(cmdBuildEasysetup, './build') +jdk_env.Clean(cmdBuildEasysetup, Dir('#/service/easy-setup/mediator/richsdk/android/build/')) +jdk_env.Clean(cmdBuildEasysetup, Dir('#/service/easy-setup/mediator/richsdk/android/EasySetupCore/build/')) Depends(cmdBuildEasysetup, env.get('baseAAR')) env.AppendUnique(easysetupAAR = cmdBuildEasysetup) \ No newline at end of file diff --git a/service/easy-setup/sampleapp/mediator/android/SConscript b/service/easy-setup/sampleapp/mediator/android/SConscript index c41a9b5..eb79c7f 100644 --- a/service/easy-setup/sampleapp/mediator/android/SConscript +++ b/service/easy-setup/sampleapp/mediator/android/SConscript @@ -75,4 +75,5 @@ jdk_env['BUILD_DIR'] = env.get('BUILD_DIR') cmdBuildEasysetupApp=jdk_env.Gradle(target="EasySetup/app/apk", source="EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java") jdk_env.Clean(cmdBuildEasysetupApp, '#/service/easy-setup/sampleapp/mediator/android/EasySetup/build') +jdk_env.Clean(cmdBuildEasysetupApp, '#/service/easy-setup/sampleapp/mediator/android/EasySetup/app/build') Depends(cmdBuildEasysetupApp, env.get('easysetupAAR')) \ No newline at end of file diff --git a/service/notification/android/SConscript b/service/notification/android/SConscript index 09f14ff..531db6f 100755 --- a/service/notification/android/SConscript +++ b/service/notification/android/SConscript @@ -57,7 +57,9 @@ jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + jdk_env['BUILD_DIR'] = env.get('BUILD_DIR') cmdBuildNotification = jdk_env.Gradle(target="notification-service/objs", source="notification-service/src/main/java/org/iotivity/service/ns/consumer/ConsumerService.java") -jdk_env.Clean(cmdBuildNotification, './build') +jdk_env.Clean(cmdBuildNotification, '#/service/notification/android/build') +jdk_env.Clean(cmdBuildNotification, '#/service/notification/android/notification-service/build') + Depends(cmdBuildNotification, env.get('baseAAR')) env.AppendUnique(notificationAAR = cmdBuildNotification) diff --git a/service/notification/examples/android/NotiConsumerExample/SConscript b/service/notification/examples/android/NotiConsumerExample/SConscript index 4d7890c..e147b90 100644 --- a/service/notification/examples/android/NotiConsumerExample/SConscript +++ b/service/notification/examples/android/NotiConsumerExample/SConscript @@ -80,4 +80,5 @@ cmdBuildNotificationConsumerApp=jdk_env.Gradle(target="app/apk", source=["app/src/main/java/org/iotivity/service/ns/sample/consumer/MainActivity.java", "app/src/main/java/org/iotivity/service/ns/sample/consumer/ConsumerSample.java"]) jdk_env.Clean(cmdBuildNotificationConsumerApp, '#/service/notification/examples/android/NotiConsumerExample/build') +jdk_env.Clean(cmdBuildNotificationConsumerApp, '#/service/notification/examples/android/NotiConsumerExample/app/build') Depends(cmdBuildNotificationConsumerApp, env.get('notificationAAR')) diff --git a/service/notification/examples/android/NotiProviderExample/SConscript b/service/notification/examples/android/NotiProviderExample/SConscript index fa506be..36c77c1 100644 --- a/service/notification/examples/android/NotiProviderExample/SConscript +++ b/service/notification/examples/android/NotiProviderExample/SConscript @@ -81,4 +81,5 @@ cmdBuildNotificationProviderApp=jdk_env.Gradle(target="app/apk", "app/src/main/java/org/iotivity/service/ns/sample/provider/NotiListener.java", "app/src/main/java/org/iotivity/service/ns/sample/provider/ProviderSample.java"]) jdk_env.Clean(cmdBuildNotificationProviderApp, '#/service/notification/examples/android/NotiProviderExample/build') +jdk_env.Clean(cmdBuildNotificationProviderApp, '#/service/notification/examples/android/NotiProviderExample/app/build') Depends(cmdBuildNotificationProviderApp, env.get('notificationAAR')) diff --git a/service/resource-container/android/SConscript b/service/resource-container/android/SConscript index 81510e2..fb454aa 100644 --- a/service/resource-container/android/SConscript +++ b/service/resource-container/android/SConscript @@ -53,4 +53,5 @@ jdk_env['BUILD_DIR'] = env.get('BUILD_DIR') cmdResourceContainerApp = jdk_env.Gradle(target="resource-container/objs", source="resource-container/src/main/java/org/iotivity/service/resourcecontainer/RcsBundleInfo.java") -jdk_env.Clean(cmdResourceContainerApp, '#/service/resource-container/android//build') +jdk_env.Clean(cmdResourceContainerApp, '#/service/resource-container/android/build') +jdk_env.Clean(cmdResourceContainerApp, '#/service/resource-container/android/resource-container/build')