improve build scripts for awtk-web

This commit is contained in:
xianjimli 2020-08-17 08:43:23 +08:00
parent 28e16a461e
commit 18a59cad5d
3 changed files with 5 additions and 10 deletions

View File

@ -79,6 +79,7 @@ class AppHelperBase:
self.APP_BIN_DIR = os.path.join(APP_ROOT, 'bin')
self.APP_LIB_DIR = os.path.join(APP_ROOT, 'lib')
self.APP_SRC = os.path.join(APP_ROOT, 'src')
self.APP_RES = os.path.join(APP_ROOT, 'res')
mkdir_if_not_exist(self.APP_BIN_DIR);
mkdir_if_not_exist(self.APP_LIB_DIR);
@ -238,7 +239,7 @@ class AppHelperBase:
APP_LINKFLAGS = ''
AWTK_LIBS = self.AWTK_LIBS
APP_CPPPATH = [self.APP_SRC]
APP_CPPPATH = [self.APP_SRC, self.APP_RES]
APP_LIBPATH = [self.APP_LIB_DIR]
AWTK_CCFLAGS = awtk.CCFLAGS

View File

@ -145,6 +145,7 @@ def run(awtk_root):
AWTK_ROOT = awtk_root
APP_ROOT = common.getcwd()
action = common.get_action()
if APP_ROOT.endswith('scripts'):
APP_ROOT = os.path.dirname(APP_ROOT)
@ -160,6 +161,8 @@ def run(awtk_root):
ASSETS_ROOT = common.join_path(APP_ROOT, 'design')
ASSET_C = common.join_path(APP_ROOT, 'res/assets.inc')
OUTPUT_ROOT = common.join_path(APP_ROOT, 'res/assets')
if action == 'json':
ASSET_C = common.join_path(APP_ROOT, 'assets_web.js')
use_default_theme_config()
if not is_dependencies_ok():
@ -178,6 +181,5 @@ def run(awtk_root):
common.update_res()
if isinstance(THEMES[0], dict):
action = common.get_action()
if action != 'clean' and action != 'web' and action != 'json' and action != 'pinyin':
common.gen_res_c(False)

View File

@ -932,10 +932,6 @@ def gen_res_web_c():
result += '#include "base/assets_manager.h"\n'
result += gen_assets_includes(join_path(OUTPUT_DIR, 'inc/images/*.bsvg'), None, False)
if IS_GENERATE_INC_RES:
result += gen_assets_includes(join_path(OUTPUT_DIR, 'inc/images/*.res'), None, False)
else:
result += gen_assets_includes(join_path(OUTPUT_DIR, 'inc/images/*.data'), None, False)
result += gen_assets_includes(join_path(OUTPUT_DIR, 'inc/strings/*.data'), None, False)
result += gen_assets_includes(join_path(OUTPUT_DIR, 'inc/styles/*.data'), None, False)
result += gen_assets_includes(join_path(OUTPUT_DIR, 'inc/ui/*.data'), None, False)
@ -948,10 +944,6 @@ def gen_res_web_c():
result += ''
result += gen_assets_adds(join_path(OUTPUT_DIR, 'inc/images/*.bsvg'))
if IS_GENERATE_INC_RES:
result += gen_assets_adds(join_path(OUTPUT_DIR, 'inc/images/*.res'))
else:
result += gen_assets_adds(join_path(OUTPUT_DIR, 'inc/images/*.data'))
result += gen_assets_adds(join_path(OUTPUT_DIR, 'inc/strings/*.data'))
result += gen_assets_adds(join_path(OUTPUT_DIR, 'inc/styles/*.data'))
result += gen_assets_adds(join_path(OUTPUT_DIR, 'inc/ui/*.data'))