Commit 2f38487d authored by George Nash's avatar George Nash Committed by Rick Bell

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's avatarGeorge Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16977Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent bd360701
......@@ -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
......
......@@ -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)
......@@ -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
......@@ -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
......@@ -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)
......@@ -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'))
......@@ -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'))
......@@ -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')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment