提交 eab2de20 编写于 作者: J jady3356 提交者: Gitee

add build single target function

上级 506cbf40
......@@ -16,11 +16,15 @@ import("//build/lite/ndk/ndk.gni")
group("ohos") {
deps = []
product_cfg = read_file("//build/lite/product/${product}.json", "json")
foreach(subsystem, product_cfg.subsystem) {
foreach(component, subsystem.component) {
deps += [ component.dir ]
if (ohos_build_target == "") {
product_cfg = read_file("//build/lite/product/${product}.json", "json")
foreach(subsystem, product_cfg.subsystem) {
foreach(component, subsystem.component) {
deps += [ component.dir ]
}
}
} else {
deps += [ ohos_build_target ]
}
}
......
......@@ -27,6 +27,8 @@ def add_options(parser):
parser.add_argument('-b', '--build_type', help='release or debug version.',
nargs=1, default=['release'])
parser.add_argument('-t', '--test', help='Compile test suit', nargs='*')
parser.add_argument('-T', '--target', help='Compile single target',
nargs=1, default=[''])
parser.add_argument('-n', '--ndk', help='Compile ndk', action='store_true')
......
......@@ -18,6 +18,8 @@ test=
test_args=ohos_xts_test_args = "%(test)s"
compiler_path=
compiler_args=ohos_build_compiler_dir="%(compiler_path)s"
build_target=
build_target_args=ohos_build_target = "%(build_target)s"
[ndk]
ndk_path=
......
......@@ -32,6 +32,7 @@ class Config():
def __init__(self, args):
self.product = args.product[0]
self.build_type = args.build_type[0]
self.build_target = args.target[0]
self.__set_path()
self.config = os.path.join(self.get_build_path(), 'config.ini')
self.log_path = os.path.join(self.get_out_path(), 'build.log')
......@@ -100,8 +101,10 @@ class Config():
def get_gn_args(self):
self.cfg.set('gn_args', 'product', self.product)
self.cfg.set('gn_args', 'build_type', self.build_type)
self.cfg.set('gn_args', 'build_target', self.build_target)
self.args_list.append(self.cfg.get('gn_args', 'product_args'))
self.args_list.append(self.cfg.get('gn_args', 'build_type_args'))
self.args_list.append(self.cfg.get('gn_args', 'build_target_args'))
return " ".join(self.args_list)
......
......@@ -15,6 +15,7 @@ declare_args() {
product = ""
# "debug" or "release"
ohos_build_type = "debug"
ohos_build_target = ""
ohos_build_compiler_dir = ""
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册