Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Build Lite
提交
245c7149
B
Build Lite
项目概览
OpenHarmony
/
Build Lite
8 个月 前同步成功
通知
22
Star
24
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Build Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
245c7149
编写于
11月 12, 2021
作者:
O
openharmony_ci
提交者:
Gitee
11月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
!283 add compact_mode for hb build
Merge pull request !283 from yaoxiaoyu_903c/master
上级
16151ddf
f4f974a2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
7 deletion
+28
-7
hb/build/build.py
hb/build/build.py
+14
-2
hb/build/build_process.py
hb/build/build_process.py
+14
-5
未找到文件。
hb/build/build.py
浏览文件 @
245c7149
...
...
@@ -52,6 +52,10 @@ def add_options(parser):
help
=
'sign haps by server'
,
action
=
'store_true'
)
parser
.
add_argument
(
'--patch'
,
help
=
'apply product patch before compiling'
,
action
=
'store_true'
)
parser
.
add_argument
(
'--compact-mode'
,
help
=
'compactiable with standard build system'
'set to true if we use build.sh as build entrance'
,
action
=
'store_true'
,
default
=
False
)
parser
.
add_argument
(
'--gn-args'
,
nargs
=
1
,
default
=
''
,
help
=
'specifies gn build arguments, '
'eg: --gn-args="foo="bar" enable=true blah=7"'
)
...
...
@@ -62,7 +66,7 @@ def exec_command(args):
product
,
company
=
args
.
product
[
0
].
split
(
'@'
)
set_product
(
product_name
=
product
,
company
=
company
)
build
=
Build
(
args
.
component
)
build
=
Build
(
args
.
component
,
args
.
compact_mode
)
cmd_args
=
defaultdict
(
list
)
build
.
register_args
(
'ohos_build_type'
,
args
.
build_type
[
0
])
...
...
@@ -87,7 +91,8 @@ def exec_command(args):
if
args
.
ndk
:
build
.
register_args
(
'ohos_build_ndk'
,
'true'
,
quota
=
False
)
if
hasattr
(
args
,
'target'
)
and
len
(
args
.
target
):
if
args
.
compact_mode
is
False
and
hasattr
(
args
,
'target'
)
and
len
(
args
.
target
):
build
.
register_args
(
'ohos_build_target'
,
args
.
target
)
if
hasattr
(
args
,
'verbose'
)
and
args
.
verbose
:
...
...
@@ -110,4 +115,11 @@ def exec_command(args):
except
ValueError
:
raise
OHOSException
(
f
'Invalid gn args:
{
gn_arg
}
'
)
# Add build target, order is important
if
args
.
compact_mode
:
if
hasattr
(
args
,
'target'
)
and
len
(
args
.
target
):
cmd_args
[
'ninja'
].
extend
(
args
.
target
)
else
:
cmd_args
[
'ninja'
].
append
(
'packages'
)
return
build
.
build
(
args
.
full
,
patch
=
args
.
patch
,
cmd_args
=
cmd_args
)
hb/build/build_process.py
浏览文件 @
245c7149
...
...
@@ -37,7 +37,7 @@ from distutils.spawn import find_executable
class
Build
():
def
__init__
(
self
,
component
=
None
):
def
__init__
(
self
,
component
=
None
,
compact_mode
=
False
):
self
.
config
=
Config
()
# Get gn args ready
...
...
@@ -45,6 +45,7 @@ class Build():
self
.
_target
=
None
self
.
_compiler
=
None
self
.
_test
=
None
self
.
_compact_mode
=
compact_mode
self
.
target
=
component
self
.
start_time
=
get_current_time
()
...
...
@@ -181,10 +182,13 @@ class Build():
gn_cmd
=
[
gn_path
,
'gen'
,
self
.
config
.
out_path
,
'--root={}'
.
format
(
self
.
config
.
root_path
),
'--dotfile={}/.gn'
.
format
(
self
.
config
.
build_path
),
f
'--script-executable=
{
sys
.
executable
}
'
,
'--args={}'
.
format
(
" "
.
join
(
self
.
_args_list
))]
+
gn_args
if
self
.
_compact_mode
is
False
:
gn_cmd
+=
[
'--root={}'
.
format
(
self
.
config
.
root_path
),
'--dotfile={}/.gn'
.
format
(
self
.
config
.
build_path
),
]
exec_command
(
gn_cmd
,
log_path
=
self
.
config
.
log_path
)
def
gn_clean
(
self
,
out_path
=
None
):
...
...
@@ -204,10 +208,13 @@ class Build():
return
gn_cmd
=
[
gn_path
,
'--root={}'
.
format
(
self
.
config
.
root_path
),
'--dotfile={}/.gn'
.
format
(
self
.
config
.
build_path
),
'clean'
,
self
.
config
.
out_path
]
if
self
.
_compact_mode
is
False
:
gn_cmd
+=
[
'--root={}'
.
format
(
self
.
config
.
root_path
),
'--dotfile={}/.gn'
.
format
(
self
.
config
.
build_path
),
]
exec_command
(
gn_cmd
,
log_path
=
self
.
config
.
log_path
)
def
ninja_build
(
self
,
cmd_args
):
...
...
@@ -246,6 +253,8 @@ class Build():
# Compile product in "hb set"
self
.
compiler
=
Device
.
get_compiler
(
self
.
config
.
device_path
)
self
.
register_args
(
'product_path'
,
self
.
config
.
product_path
)
if
self
.
_compact_mode
:
self
.
register_args
(
'product_name'
,
self
.
config
.
product
)
self
.
register_args
(
'device_path'
,
self
.
config
.
device_path
)
self
.
register_args
(
'ohos_kernel_type'
,
self
.
config
.
kernel
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录