【修复】studio 生成工程报错的问题。

This commit is contained in:
guozhanxin 2021-05-17 15:11:34 +08:00
parent 6dc38962a9
commit f0ca8be39d
2 changed files with 28 additions and 2 deletions

View File

@ -448,6 +448,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
duplicate=0, duplicate=0,
exports='remove_components')) exports='remove_components'))
# include testcases # include testcases
if os.path.isfile(os.path.join(Rtt_Root, 'examples/utest/testcases/SConscript')):
objs.extend(SConscript(Rtt_Root + '/examples/utest/testcases/SConscript', objs.extend(SConscript(Rtt_Root + '/examples/utest/testcases/SConscript',
variant_dir=kernel_vdir + '/examples/utest/testcases', variant_dir=kernel_vdir + '/examples/utest/testcases',
duplicate=0)) duplicate=0))

View File

@ -217,8 +217,27 @@ def touch_env():
if os.path.exists(os.path.join(env_dir, 'tools', 'scripts')): if os.path.exists(os.path.join(env_dir, 'tools', 'scripts')):
os.environ["PATH"] = os.path.join(env_dir, 'tools', 'scripts') + ';' + os.environ["PATH"] os.environ["PATH"] = os.path.join(env_dir, 'tools', 'scripts') + ';' + os.environ["PATH"]
# Exclude utestcases
def exclude_utestcases(RTT_ROOT):
if os.path.isfile(os.path.join(RTT_ROOT, 'examples/utest/testcases/Kconfig')):
return
if not os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig')):
return
with open(os.path.join(RTT_ROOT, 'Kconfig'), 'r') as f:
data = f.readlines()
with open(os.path.join(RTT_ROOT, 'Kconfig'), 'w') as f:
for line in data:
if line.find('examples/utest/testcases/Kconfig') == -1:
f.write(line)
# menuconfig for Linux # menuconfig for Linux
def menuconfig(RTT_ROOT): def menuconfig(RTT_ROOT):
# Exclude utestcases
exclude_utestcases(RTT_ROOT)
kconfig_dir = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends') kconfig_dir = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends')
os.system('scons -C ' + kconfig_dir) os.system('scons -C ' + kconfig_dir)
@ -250,6 +269,9 @@ def menuconfig(RTT_ROOT):
def guiconfig(RTT_ROOT): def guiconfig(RTT_ROOT):
import pyguiconfig import pyguiconfig
# Exclude utestcases
exclude_utestcases(RTT_ROOT)
if sys.platform != 'win32': if sys.platform != 'win32':
touch_env() touch_env()
@ -260,7 +282,7 @@ def guiconfig(RTT_ROOT):
fn = '.config' fn = '.config'
fn_old = '.config.old' fn_old = '.config.old'
sys.argv = ['guiconfig', 'Kconfig']; sys.argv = ['guiconfig', 'Kconfig']
pyguiconfig._main() pyguiconfig._main()
if os.path.isfile(fn): if os.path.isfile(fn):
@ -281,6 +303,9 @@ def guiconfig(RTT_ROOT):
def guiconfig_silent(RTT_ROOT): def guiconfig_silent(RTT_ROOT):
import defconfig import defconfig
# Exclude utestcases
exclude_utestcases(RTT_ROOT)
if sys.platform != 'win32': if sys.platform != 'win32':
touch_env() touch_env()