Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
f39cf377
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f39cf377
编写于
3月 29, 2019
作者:
C
Chinmay Garde
提交者:
GitHub
3月 29, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a GN format presubmit. (#8371)
上级
d6e2d852
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
0 deletion
+55
-0
ci/check_gn_format.py
ci/check_gn_format.py
+52
-0
ci/format.sh
ci/format.sh
+3
-0
未找到文件。
ci/check_gn_format.py
0 → 100755
浏览文件 @
f39cf377
#!/usr/bin/env python
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import
sys
import
subprocess
import
os
import
argparse
import
errno
import
shutil
def
GetGNFiles
(
directory
):
directory
=
os
.
path
.
abspath
(
directory
)
gn_files
=
[]
assert
os
.
path
.
exists
(
directory
),
"Directory must exist %s"
%
directory
for
root
,
dirs
,
files
in
os
.
walk
(
directory
):
for
file
in
files
:
if
file
.
endswith
(
".gn"
)
or
file
.
endswith
(
".gni"
):
gn_files
.
append
(
os
.
path
.
join
(
root
,
file
))
return
gn_files
def
main
():
parser
=
argparse
.
ArgumentParser
();
parser
.
add_argument
(
'--gn-binary'
,
dest
=
'gn_binary'
,
required
=
True
,
type
=
str
)
parser
.
add_argument
(
'--dry-run'
,
dest
=
'dry_run'
,
required
=
True
,
type
=
bool
)
parser
.
add_argument
(
'--root-directory'
,
dest
=
'root_directory'
,
required
=
True
,
type
=
str
)
args
=
parser
.
parse_args
()
gn_binary
=
os
.
path
.
abspath
(
args
.
gn_binary
)
assert
os
.
path
.
exists
(
gn_binary
),
"GN Binary must exist %s"
%
gn_binary
gn_command
=
[
gn_binary
,
'format'
]
if
args
.
dry_run
:
gn_command
.
append
(
'--dry-run'
)
for
gn_file
in
GetGNFiles
(
args
.
root_directory
):
if
subprocess
.
call
(
gn_command
+
[
gn_file
])
!=
0
:
print
"ERROR: '%s' is incorrectly formatted."
%
os
.
path
.
relpath
(
gn_file
,
args
.
root_directory
)
print
"Format the same with 'gn format' using the 'gn' binary in //buildtools."
print
"Or, run ./ci/check_gn_format.py with '--dry-run false'"
return
-
1
return
0
if
__name__
==
'__main__'
:
sys
.
exit
(
main
())
ci/format.sh
浏览文件 @
f39cf377
...
...
@@ -73,3 +73,6 @@ if [[ ! -z "$TRAILING_SPACES" ]]; then
echo
"ERROR: Some files have trailing spaces. To fix, try something like
\`
find . -name "
*
.dart
" -exec sed -i -e 's/
\s\+
$/
/' {}
\;\`
."
exit
1
fi
# Check GN format consistency
./ci/check_gn_format.py
--dry-run
true
--root-directory
.
--gn-binary
"../buildtools/
$OS
/gn"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录