Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Build Lite
提交
cc7f9816
B
Build Lite
项目概览
OpenHarmony
/
Build Lite
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
cc7f9816
编写于
3月 17, 2021
作者:
O
openharmony_ci
提交者:
Gitee
3月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
!33 Adapts to the Windows platform
Merge pull request !33 from pilipala195/master
上级
66699dec
8b7e3202
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
65 addition
and
52 deletion
+65
-52
build_ext_components.py
build_ext_components.py
+20
-16
hb/__init__.py
hb/__init__.py
+2
-1
hb/build/build_process.py
hb/build/build_process.py
+4
-5
hb/common/config.py
hb/common/config.py
+21
-12
hb/common/device.py
hb/common/device.py
+2
-2
hb/common/utils.py
hb/common/utils.py
+6
-6
hb/cts/cts.py
hb/cts/cts.py
+1
-1
hb/deps/gen_deps.py
hb/deps/gen_deps.py
+1
-1
setup.py
setup.py
+3
-3
utils.py
utils.py
+5
-5
未找到文件。
build_ext_components.py
浏览文件 @
cc7f9816
...
...
@@ -30,12 +30,14 @@ def cmd_exec(command, temp_file, error_log_path):
proc
=
subprocess
.
Popen
(
cmd
,
stdout
=
temp_file
,
stderr
=
temp_file
,
universal_newlines
=
True
)
encoding
=
'utf-8'
)
proc
.
wait
()
ret_code
=
proc
.
returncode
if
ret_code
!=
0
:
temp_file
.
close
()
copyfile
(
temp_file
.
name
,
error_log_path
)
os
.
remove
(
temp_file
.
name
)
return
ret_code
return
ret_code
...
...
@@ -58,23 +60,25 @@ def main():
if
args
.
path
:
curr_dir
=
os
.
getcwd
()
os
.
chdir
(
args
.
path
)
with
NamedTemporaryFile
(
mode
=
'wt'
)
as
temp_file
:
if
args
.
prebuilts
:
status
=
cmd_exec
(
args
.
prebuilts
,
temp_file
,
args
.
out_dir
[
0
])
if
status
!=
0
:
return
status
if
args
.
command
:
if
'&&'
in
args
.
command
:
command
=
args
.
command
.
split
(
'&&'
)
for
data
in
command
:
status
=
cmd_exec
(
data
,
temp_file
,
args
.
out_dir
[
0
])
if
status
!=
0
:
return
status
else
:
status
=
cmd_exec
(
args
.
command
,
temp_file
,
args
.
out_dir
[
0
])
temp_file
=
NamedTemporaryFile
(
mode
=
'wt'
,
delete
=
False
)
if
args
.
prebuilts
:
status
=
cmd_exec
(
args
.
prebuilts
,
temp_file
,
args
.
out_dir
[
0
])
if
status
!=
0
:
return
status
if
args
.
command
:
if
'&&'
in
args
.
command
:
command
=
args
.
command
.
split
(
'&&'
)
for
data
in
command
:
status
=
cmd_exec
(
data
,
temp_file
,
args
.
out_dir
[
0
])
if
status
!=
0
:
return
status
copyfile
(
temp_file
.
name
,
args
.
target_dir
[
0
])
else
:
status
=
cmd_exec
(
args
.
command
,
temp_file
,
args
.
out_dir
[
0
])
if
status
!=
0
:
return
status
temp_file
.
close
()
copyfile
(
temp_file
.
name
,
args
.
target_dir
[
0
])
os
.
remove
(
temp_file
.
name
)
os
.
chdir
(
curr_dir
)
return
0
...
...
hb/__init__.py
浏览文件 @
cc7f9816
...
...
@@ -21,7 +21,8 @@ import os
def
get_config_path
():
search_path
=
os
.
getcwd
()
while
search_path
!=
'/'
:
root_path
=
os
.
path
.
abspath
(
os
.
sep
)
while
search_path
!=
root_path
:
config_path
=
os
.
path
.
join
(
search_path
,
'ohos_config.json'
)
if
os
.
path
.
isfile
(
config_path
):
return
config_path
...
...
hb/build/build_process.py
浏览文件 @
cc7f9816
...
...
@@ -188,16 +188,15 @@ class Build():
self
.
config
.
out_path
=
os
.
path
.
join
(
self
.
config
.
root_path
,
'out'
,
board
)
gn_device_path
=
os
.
path
.
dirname
(
device_path
).
\
replace
(
self
.
config
.
root_path
,
'/'
)
gn_kernel_path
=
device_path
.
replace
(
self
.
config
.
root_path
,
'/'
)
gn_device_path
=
os
.
path
.
dirname
(
device_path
)
gn_kernel_path
=
device_path
self
.
register_args
(
'ohos_build_target'
,
[
gn_device_path
])
self
.
register_args
(
'device_path'
,
gn_kernel_path
)
self
.
register_args
(
'ohos_kernel_type'
,
kernel
)
else
:
# Compile product in "hb set"
self
.
register_args
(
'product_path'
,
self
.
config
.
gn_
product_path
)
self
.
register_args
(
'device_path'
,
self
.
config
.
gn_
device_path
)
self
.
register_args
(
'product_path'
,
self
.
config
.
product_path
)
self
.
register_args
(
'device_path'
,
self
.
config
.
device_path
)
self
.
register_args
(
'ohos_kernel_type'
,
self
.
config
.
kernel
)
product_json
=
os
.
path
.
join
(
self
.
config
.
product_path
,
...
...
hb/common/config.py
浏览文件 @
cc7f9816
...
...
@@ -16,6 +16,7 @@
# limitations under the License.
import
os
import
platform
from
distutils.spawn
import
find_executable
from
hb
import
CONFIG_JSON
...
...
@@ -145,14 +146,27 @@ class Config(metaclass=Singleton):
def
vendor_path
(
self
):
return
os
.
path
.
join
(
self
.
root_path
,
'vendor'
)
@
property
def
build_tools_path
(
self
):
platform_name
=
platform
.
system
()
if
platform_name
==
'Linux'
:
return
os
.
path
.
join
(
self
.
root_path
,
'prebuilts'
,
'build-tools'
,
'linux-x86'
,
'bin'
)
if
platform_name
==
'Windows'
:
return
os
.
path
.
join
(
self
.
root_path
,
'prebuilts'
,
'build-tools'
,
'win-x86'
,
'bin'
)
raise
Exception
(
f
'unidentified platform:
{
platform_name
}
'
)
@
property
def
gn_path
(
self
):
repo_gn_path
=
os
.
path
.
join
(
self
.
root_path
,
'prebuilts'
,
'build-tools'
,
'linux-x86'
,
'bin'
,
'gn'
)
repo_gn_path
=
os
.
path
.
join
(
self
.
build_tools_path
,
'gn'
)
if
os
.
path
.
isfile
(
repo_gn_path
):
return
repo_gn_path
...
...
@@ -164,12 +178,7 @@ class Config(metaclass=Singleton):
@
property
def
ninja_path
(
self
):
repo_ninja_path
=
os
.
path
.
join
(
self
.
root_path
,
'prebuilts'
,
'build-tools'
,
'linux-x86'
,
'bin'
,
'ninja'
)
repo_ninja_path
=
os
.
path
.
join
(
self
.
build_tools_path
,
'ninja'
)
if
os
.
path
.
isfile
(
repo_ninja_path
):
return
repo_ninja_path
...
...
hb/common/device.py
浏览文件 @
cc7f9816
...
...
@@ -86,7 +86,7 @@ class Device():
kernel_pattern
=
r
'kernel_type ?= ?"{}"'
.
format
(
kernel
)
version_pattern
=
r
'kernel_version ?= ?"{}"'
.
format
(
version
)
with
open
(
config
,
'rt'
)
as
config_file
:
with
open
(
config
,
'rt'
,
encoding
=
'utf-8'
)
as
config_file
:
data
=
config_file
.
read
()
return
re
.
search
(
kernel_pattern
,
data
)
and
\
re
.
search
(
version_pattern
,
data
)
...
...
@@ -96,7 +96,7 @@ class Device():
kernel_pattern
=
r
'kernel_type ?= ?"(\w+)"'
version_pattern
=
r
'kernel_version ?= ?"([a-zA-Z0-9._]*)"'
with
open
(
config
,
'rt'
)
as
config_file
:
with
open
(
config
,
'rt'
,
encoding
=
'utf-8'
)
as
config_file
:
data
=
config_file
.
read
()
kernel_list
=
re
.
findall
(
kernel_pattern
,
data
)
version_list
=
re
.
findall
(
version_pattern
,
data
)
...
...
hb/common/utils.py
浏览文件 @
cc7f9816
...
...
@@ -56,7 +56,7 @@ def read_json_file(input_file):
def
dump_json_file
(
dump_file
,
json_data
):
with
open
(
dump_file
,
'wt'
)
as
json_file
:
with
open
(
dump_file
,
'wt'
,
encoding
=
'utf-8'
)
as
json_file
:
json
.
dump
(
json_data
,
json_file
,
ensure_ascii
=
False
,
...
...
@@ -75,11 +75,11 @@ def exec_command(cmd, log_path='out/build.log', **kwargs):
useful_info_pattern
=
re
.
compile
(
r
'\[\d+/\d+\].+'
)
is_log_filter
=
kwargs
.
pop
(
'log_filter'
,
False
)
with
open
(
log_path
,
'at'
)
as
log_file
:
with
open
(
log_path
,
'at'
,
encoding
=
'utf-8'
)
as
log_file
:
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
True
,
encoding
=
'utf-8'
,
**
kwargs
)
for
line
in
iter
(
process
.
stdout
.
readline
,
''
):
if
is_log_filter
:
...
...
@@ -94,7 +94,7 @@ def exec_command(cmd, log_path='out/build.log', **kwargs):
ret_code
=
process
.
returncode
if
ret_code
!=
0
:
with
open
(
log_path
,
'at'
)
as
log_file
:
with
open
(
log_path
,
'at'
,
encoding
=
'utf-8'
)
as
log_file
:
for
line
in
iter
(
process
.
stderr
.
readline
,
''
):
if
'ninja: warning'
in
line
:
log_file
.
write
(
line
)
...
...
@@ -112,7 +112,7 @@ def exec_command(cmd, log_path='out/build.log', **kwargs):
def
get_failed_log
(
log_path
):
with
open
(
log_path
,
'rt'
)
as
log_file
:
with
open
(
log_path
,
'rt'
,
encoding
=
'utf-8'
)
as
log_file
:
data
=
log_file
.
read
()
failed_pattern
=
re
.
compile
(
r
'(\[\d+/\d+\].*?)(?=\[\d+/\d+\]|'
'ninja: build stopped)'
,
re
.
DOTALL
)
...
...
@@ -123,7 +123,7 @@ def get_failed_log(log_path):
error_log
=
os
.
path
.
join
(
os
.
path
.
dirname
(
log_path
),
'error.log'
)
if
os
.
path
.
isfile
(
error_log
):
with
open
(
error_log
,
'rt'
)
as
log_file
:
with
open
(
error_log
,
'rt'
,
encoding
=
'utf-8'
)
as
log_file
:
hb_error
(
log_file
.
read
())
...
...
hb/cts/cts.py
浏览文件 @
cc7f9816
...
...
@@ -222,7 +222,7 @@ class Subsystem():
component_list
[
index
][
'deps'
]
=
component_cls
.
get_real_deps
()
self
.
json_content
[
'components'
]
=
component_list
with
open
(
self
.
json_path
,
'wt'
)
as
file
:
with
open
(
self
.
json_path
,
'wt'
,
encoding
=
'utf-8'
)
as
file
:
json
.
dump
(
self
.
json_content
,
file
,
ensure_ascii
=
False
,
indent
=
2
)
...
...
hb/deps/gen_deps.py
浏览文件 @
cc7f9816
...
...
@@ -72,7 +72,7 @@ def gen_deps(subsystems, products):
status
=
exec_command
(
args_factory
(
args
))
except
Exception
:
status
=
1
with
open
(
config
.
log_path
,
'rt'
)
as
log_file
:
with
open
(
config
.
log_path
,
'rt'
,
encoding
=
'utf-8'
)
as
log_file
:
log
=
log_file
.
read
()
else
:
log
=
''
...
...
setup.py
浏览文件 @
cc7f9816
...
...
@@ -22,12 +22,12 @@ from setuptools import setup
WORK_PATH
=
os
.
path
.
dirname
(
'__file__'
)
README_PATH
=
os
.
path
.
join
(
WORK_PATH
,
'README.md'
)
LICENSE_PATH
=
os
.
path
.
join
(
WORK_PATH
,
'LICENSE'
)
LONG_DESCRIPTION
=
open
(
README_PATH
).
read
()
LICENSE
=
open
(
LICENSE_PATH
).
read
()
LONG_DESCRIPTION
=
open
(
README_PATH
,
'rt'
,
encoding
=
'utf-8'
).
read
()
LICENSE
=
open
(
LICENSE_PATH
,
'rt'
,
encoding
=
'utf-8'
).
read
()
setup
(
name
=
'ohos-build'
,
version
=
'0.
1.1
'
,
version
=
'0.
2.0
'
,
description
=
'OHOS build command line tool'
,
long_description
=
LONG_DESCRIPTION
,
url
=
''
,
...
...
utils.py
浏览文件 @
cc7f9816
...
...
@@ -53,24 +53,24 @@ def read_json_file(input_file):
def
exec_command
(
cmd
,
log_path
=
'out/build.log'
,
**
kwargs
):
with
open
(
log_path
,
'at'
)
as
f
:
with
open
(
log_path
,
'at'
,
encoding
=
'utf-8'
)
as
log_file
:
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
True
,
encoding
=
'utf-8'
,
**
kwargs
)
for
line
in
iter
(
process
.
stdout
.
readline
,
''
):
sys
.
stdout
.
write
(
line
)
f
.
write
(
line
)
log_file
.
write
(
line
)
process
.
wait
()
ret_code
=
process
.
returncode
if
ret_code
!=
0
:
with
open
(
log_path
,
'at'
)
as
f
:
with
open
(
log_path
,
'at'
,
encoding
=
'utf-8'
)
as
log_file
:
for
line
in
iter
(
process
.
stderr
.
readline
,
''
):
sys
.
stdout
.
write
(
line
)
f
.
write
(
line
)
log_file
.
write
(
line
)
print
(
'you can check build log in {}'
.
format
(
log_path
))
raise
Exception
(
"{} failed, return code is {}"
.
format
(
cmd
,
ret_code
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录