Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Build Lite
提交
eb58f932
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,发现更多精彩内容 >>
提交
eb58f932
编写于
12月 08, 2020
作者:
D
d00434757
提交者:
public tcshversion
12月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Description:add hap build script
Reviewed-by:zhangmingxiu/panxiaoqun
上级
dd4fdea4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
247 addition
and
2 deletion
+247
-2
config/hap_pack.gni
config/hap_pack.gni
+118
-0
hap_pack.py
hap_pack.py
+121
-0
platform/hi3516dv300_liteos_a/platform.json
platform/hi3516dv300_liteos_a/platform.json
+4
-1
product/ipcamera_hi3516dv300.json
product/ipcamera_hi3516dv300.json
+4
-1
未找到文件。
config/hap_pack.gni
0 → 100755
浏览文件 @
eb58f932
# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
declare_args() {
hapsigner = "developtools/hapsigntoolv2.jar"
packtool = "developtools/hmos_app_packing_tool.jar"
jks_file = "//base/security/frameworks/app_verify/OpenHarmonyCer/OpenHarmony.jks"
cert_file = "//base/security/frameworks/app_verify/OpenHarmonyCer/OpenHarmony.cer"
default_hap_signature_algorithm = "SHA256withECDSA"
privatekey = "OpenHarmony Software Signature"
keystorepasswd = "123456"
}
template("hap_pack") {
assert(defined(invoker.cert_profile), "cert_profile in required.")
assert(defined(invoker.hap_name), "hap_name in required.")
unsignhap_path = "$root_out_dir/system/internal/unsigned_${invoker.hap_name}.hap"
signhap_path = "$root_out_dir/system/internal/${invoker.hap_name}.hap"
action(target_name){
if (defined(invoker.deps)) {
deps = []
deps += invoker.deps
}
script = "//build/lite/hap_pack.py"
args = [
"--packing-tool-path",
packtool
]
if (defined(invoker.mode)) {
args += [
"--mode",
invoker.mode
]
}
if (defined(invoker.json_path)) {
args += [
"--json-path",
rebase_path(invoker.json_path)
]
}
if (defined(invoker.resources_path)) {
args += [
"--resources-path",
rebase_path(invoker.resources_path)
]
}
if (defined(invoker.assets_path)) {
args += [
"--assets-path",
rebase_path(invoker.assets_path)
]
}
if (defined(invoker.lib_path)) {
args += [
"--lib-path",
rebase_path(invoker.lib_path)
]
}
if (defined(invoker.shared_libs_path)) {
args += [
"--shared-libs-path",
rebase_path(invoker.shared_libs_path)
]
}
if (defined(invoker.ability_so_path)) {
args += [
"--ability-so-path",
rebase_path(invoker.ability_so_path)
]
}
if (defined(invoker.index_path)) {
args += [
"--index-path",
rebase_path(invoker.index_path)
]
}
if (defined(invoker.force)) {
args += [
"--force",
invoker.force
]
}
args += [
"--signtool-path",
hapsigner,
"--privatekey",
privatekey,
"--sign-algo",
default_hap_signature_algorithm,
"--unsignhap-path",
rebase_path(unsignhap_path),
"--signhap-path",
rebase_path(signhap_path),
"--jks-path",
rebase_path(jks_file),
"--cert-path",
rebase_path(cert_file),
]
if (defined(invoker.cert_profile)) {
args += [
"--cert-profile",
rebase_path(invoker.cert_profile)
]
}
outputs = [ "$target_out_dir/${target_name}_build_log.txt" ]
}
}
hap_pack.py
0 → 100755
浏览文件 @
eb58f932
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import
sys
import
os
import
argparse
import
subprocess
import
shutil
import
zipfile
def
cmd_popen
(
cmd
):
proc
=
subprocess
.
Popen
(
cmd
)
proc
.
wait
()
ret_code
=
proc
.
returncode
if
ret_code
!=
0
:
print
(
"hap warning: {} failed, return code is {}"
.
format
(
cmd
,
ret_code
))
def
parse_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--packing-tool-path'
,
help
=
'packing tool path '
)
parser
.
add_argument
(
'--mode'
,
help
=
'package mode'
)
parser
.
add_argument
(
'--json-path'
,
help
=
'profile'
)
parser
.
add_argument
(
'--resources-path'
,
help
=
'resources'
)
parser
.
add_argument
(
'--assets-path'
,
help
=
'assets'
)
parser
.
add_argument
(
'--lib-path'
,
help
=
'lib'
)
parser
.
add_argument
(
'--shared-libs-path'
,
help
=
'shared-libs'
)
parser
.
add_argument
(
'--ability-so-path'
,
help
=
'ability so'
)
parser
.
add_argument
(
'--index-path'
,
help
=
'index'
)
parser
.
add_argument
(
'--unsignhap-path'
,
help
=
'unsignhap path'
)
parser
.
add_argument
(
'--force'
,
help
=
'force'
)
parser
.
add_argument
(
'--signtool-path'
,
help
=
'sign tool path'
)
parser
.
add_argument
(
'--signhap-path'
,
help
=
'sign hap path'
)
parser
.
add_argument
(
'--privatekey'
,
help
=
'privatekey'
)
parser
.
add_argument
(
'--sign-algo'
,
help
=
'sign algo'
)
parser
.
add_argument
(
'--cert-profile'
,
help
=
'cert profile'
)
parser
.
add_argument
(
'--jks-path'
,
help
=
'jks path'
)
parser
.
add_argument
(
'--cert-path'
,
help
=
'cert path'
)
args
=
parser
.
parse_args
()
return
args
def
hap_packing
(
args
):
if
not
args
.
packing_tool_path
:
print
(
'hap warning: packing tool path empty'
)
return
packing_tool_path
=
os
.
path
.
join
(
os
.
environ
[
'HOME'
],
args
.
packing_tool_path
)
packing_cmd
=
[
'java'
,
'-jar'
,
packing_tool_path
]
cmd_dict
=
{
'--mode'
:
args
.
mode
,
'--json-path'
:
args
.
json_path
,
'--resources-path'
:
args
.
resources_path
,
'--assets-path'
:
args
.
assets_path
,
'--lib-path'
:
args
.
lib_path
,
'--shared-libs-path'
:
args
.
shared_libs_path
,
'--ability-so-path'
:
args
.
ability_so_path
,
'--index-path'
:
args
.
index_path
,
'--out-path'
:
args
.
unsignhap_path
,
'--force'
:
args
.
force
}
for
key
,
value
in
cmd_dict
.
items
():
if
value
:
packing_cmd
.
extend
([
key
,
value
])
cmd_popen
(
packing_cmd
)
def
hap_signing
(
args
):
user_name
=
''
password
=
''
if
not
args
.
signtool_path
:
print
(
'hap warning: signing tool path empty'
)
return
signtool_path
=
os
.
path
.
join
(
os
.
environ
[
'HOME'
],
args
.
signtool_path
)
#The default password of the key is 123456.
# You are advised to use a key and certificate management tool (
# such as keytool) to change the default password.
# For details, see section "Application Signature Verification
# Development Guide" in the Security Subsystem Development Guide.
signing_cmd
=
[
'java'
,
'-jar'
,
signtool_path
,
'sign'
,
'-mode'
,
'localjks'
,
'-profileSigned'
,
'1'
,
'-keystorepasswd'
,
'123456'
,
'-keyaliaspasswd'
,
'123456'
]
cmd_dict
=
{
'-privatekey'
:
args
.
privatekey
,
'-inputFile'
:
args
.
unsignhap_path
,
'-outputFile'
:
args
.
signhap_path
,
'-signAlg'
:
args
.
sign_algo
,
'-profile'
:
args
.
cert_profile
,
'-keystore'
:
args
.
jks_path
,
'-certpath'
:
args
.
cert_path
}
for
key
,
value
in
cmd_dict
.
items
():
if
value
:
signing_cmd
.
extend
([
key
,
value
])
cmd_popen
(
signing_cmd
)
def
main
():
args
=
parse_args
()
hap_packing
(
args
)
if
os
.
path
.
exists
(
args
.
unsignhap_path
):
hap_signing
(
args
)
os
.
remove
(
args
.
unsignhap_path
)
if
__name__
==
'__main__'
:
sys
.
exit
(
main
())
platform/hi3516dv300_liteos_a/platform.json
浏览文件 @
eb58f932
...
...
@@ -257,7 +257,10 @@
"targets"
:
[
"//applications/sample/camera/app:camera_app"
,
"//applications/sample/camera/communication:sample"
,
"//applications/sample/camera/hap:copy_hap"
"//applications/sample/camera/launcher:launcher"
,
"//applications/sample/camera/cameraApp:cameraApp"
,
"//applications/sample/camera/setting:setting"
,
"//applications/sample/camera/gallery:gallery"
],
"features"
:
[],
"deps"
:
{
...
...
product/ipcamera_hi3516dv300.json
浏览文件 @
eb58f932
...
...
@@ -17,7 +17,10 @@
"component"
:
[
{
"name"
:
"camera"
,
"dir"
:
"//applications/sample/camera/app:camera_app"
,
"features"
:[]
},
{
"name"
:
"communication"
,
"dir"
:
"//applications/sample/camera/communication:sample"
,
"features"
:[]
},
{
"name"
:
"hap"
,
"dir"
:
"//applications/sample/camera/hap:copy_hap"
,
"features"
:[]
}
{
"name"
:
"launcher"
,
"dir"
:
"//applications/sample/camera/launcher:launcher"
,
"features"
:[]
},
{
"name"
:
"cameraApp"
,
"dir"
:
"//applications/sample/camera/cameraApp:cameraApp"
,
"features"
:[]
},
{
"name"
:
"setting"
,
"dir"
:
"//applications/sample/camera/setting:setting"
,
"features"
:[]
},
{
"name"
:
"gallery"
,
"dir"
:
"//applications/sample/camera/gallery:gallery"
,
"features"
:[]
}
]
},
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录