提交 39aff2e8 编写于 作者: Y yangming_ha 提交者: Gitee

!5 hb trransfer time parameters to gn args

Merge pull request !5 from pilipala195/N/A
......@@ -20,6 +20,7 @@ from collections import defaultdict
from hb.build.build_process import Build
from hb.set.set import set_product
from hb.common.utils import get_current_time
def add_options(parser):
......@@ -59,6 +60,10 @@ def exec_command(args):
cmd_args = defaultdict(list)
build.register_args('ohos_build_type', args.build_type[0])
# Get the compilation time in timestamp and human readable format
build.register_args('ohos_build_time', get_current_time(type='timestamp'))
build.register_args('ohos_build_datetime',
get_current_time(type='datetime'))
if args.test is not None:
build.test = args.test
......
......@@ -24,6 +24,7 @@ import sys
import json
from collections import namedtuple
import yaml
from datetime import datetime
def encode(data, encoding='utf-8'):
......@@ -190,6 +191,13 @@ def args_factory(args_dict):
return args
def get_current_time(type='timestamp'):
if type == 'timestamp':
return int(datetime.utcnow().timestamp() * 1000)
if type == 'datetime':
return datetime.now().strftime('%Y-%m-%d %H:%M:%S')
def hb_info(msg):
level = 'info'
for line in str(msg).splitlines():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册