Skip to content

Commit

Permalink
fix dump and docs (#781)
Browse files Browse the repository at this point in the history
* fix dump and docs
  • Loading branch information
chen3feng committed Jan 20, 2021
1 parent 2dfee29 commit 5375776
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
11 changes: 6 additions & 5 deletions doc/en/command_line.md
Expand Up @@ -10,11 +10,12 @@ Blade <subcommand> [options]... [targets]...

Subcommand is a subcommand that currently has:

* build means build project
* test means build and run unit test
* clean indicates the result of the cleanup target
* query query target dependencies and dependencies
* run build and run a single target
* `build` Build specified targets
* `test` Build and run tests
* `clean` Cleanup specified targets
* `dump` Dump some useful information
* `query` Query target dependencies
* `run` Build and run a single executable target

## Target Syntax ##

Expand Down
11 changes: 6 additions & 5 deletions doc/zh_CN/command_line.md
Expand Up @@ -10,11 +10,12 @@ blade <subcommand> [options]... [targets]...

subcommand是一个子命令,目前有:

* build 表示构建项目
* test 表示构建并且跑单元测试
* clean 表示清除目标的构建结果
* query 查询目标的依赖项与被依赖项
* run 构建并run一个单一目标
* `build` 构建指定的目标
* `test` 构建并且运行指定的测试
* `clean` 清除指定目标的构建结果
* `dump` 输出一些内部信息
* `query` 查询目标的依赖项与被依赖项
* `run` 构建并运行单个可执行的目标

## Target语法 ##

Expand Down
2 changes: 1 addition & 1 deletion doc/zh_CN/user_manual.md
Expand Up @@ -13,7 +13,7 @@ Blade用户手册

[编写BUILD文件](build_file.md)

[运行Blade](command_line.md)
[命令行参考](command_line.md)

[测试支持](test.md)

Expand Down
6 changes: 4 additions & 2 deletions src/blade/blade_main.py
Expand Up @@ -237,9 +237,11 @@ def query(options):
def dump(options):
output_file_name = os.path.join(_WORKING_DIR, options.dump_to_file)
if options.dump_compdb:
_dump_compdb(options, output_file_name)
return _dump_compdb(options, output_file_name)
elif options.dump_targets:
build_manager.instance.dump_targets(output_file_name)
return build_manager.instance.dump_targets(output_file_name)
else:
assert False, "Invalid dump option"


def _dump_compdb(options, output_file_name):
Expand Down
3 changes: 2 additions & 1 deletion src/blade/build_manager.py
Expand Up @@ -391,8 +391,9 @@ def dump_targets(self, output_file_name):
for target_key in self.__expanded_command_targets:
target = self.__target_database[target_key]
result.append(target.dump())
json.dump(result, fp=f, indent=2)
json.dump(result, fp=f, indent=2, sort_keys=True)
print(file=f)
return 0

def get_build_time(self):
return self.__build_time
Expand Down

0 comments on commit 5375776

Please sign in to comment.