build: let UnpackAll.py find 7z.exe on Windows
authorDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 27 Jun 2017 22:33:54 +0000 (15:33 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Wed, 12 Jul 2017 16:51:27 +0000 (16:51 +0000)
Remove incomplete workaround - executing external_builders.scons
twice instead of just one time, from build_common\SConscript.
UnpackAll.py was not able to find the path to 7z.exe when using that
workaround, and SCons was not able to unpack Gradle.

Replace that workaround by fixing SCons's PATH earlier, before
UnpackAll.py starts - similarly to the way build_common\SConscript
handles the PATH on non-Windows platforms.

[Philippe Coval]

Conflicts:
build_common/SConscript

Bug: https://jira.iotivity.org/browse/IOT-1745
Change-Id: Ic90337c6c34556043017f2c55afbc1edcac402ef
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21063
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Mats Wichmann <mats@linux.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: George Nash <george.nash@intel.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21343

build_common/SConscript
build_common/windows/SConscript

index 58c9f82..4c74ac4 100755 (executable)
@@ -409,6 +409,11 @@ if env['CONFIG_ENVIRONMENT_IMPORT'] == True:
     if os.environ['LDFLAGS'] != None:
         env.AppendUnique(LINKFLAGS=Split(os.environ['LDFLAGS']))
 
+if target_os in ['windows']:
+    # UnpackAll.py needs access to system PATH components that SCons
+    # does not include by default - e.g., the path to 7z.exe.
+    env.AppendUnique(PATH=os.environ['PATH'])
+
 # Ensure scons is able to change its working directory
 env.SConscriptChdir(1)
 
@@ -832,10 +837,6 @@ conf.CheckPThreadsSupport()
 env = conf.Finish()
 ######################################################################
 
-# must call external_builders.scons second time to properly setup
-# UnpackAll builder this is due to the system path not being pulled
-# in for windows till after the windows target has run.
-env.SConscript('external_builders.scons')
 env.SConscript('external_libs.scons')
 
 Return('env')
index 68c124e..cd0fc4c 100644 (file)
@@ -89,7 +89,6 @@ if env['CC'] == 'cl':
     env.PrependUnique(LIBPATH=[os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk', 'resource-directory')])
     env.PrependUnique(LIBPATH=['#extlibs/mbedtls'])
 
-    env.AppendUnique(PATH=os.environ['PATH'])
     env['PDB'] = '${TARGET.base}.pdb'
     env.Append(LINKFLAGS=['/PDB:${TARGET.base}.pdb'])