diff --git a/BUILD.gn b/BUILD.gn
index 8cca83a68cf8fb906443f608b2d06d702a817981..bc69cc233822993148c8c086a169158c3c3a1be9 100755
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -20,12 +20,14 @@ packing_tool("packing_tool") {
"//developtools/packing_tool/haptobin.sh",
"//developtools/packing_tool/packingTool.sh",
"//developtools/packing_tool/unpackingTool.sh",
+ "//developtools/packing_tool/checkTool.sh",
]
outputs = [
"${target_out_dir}/jar/haptobin_tool.jar",
"${target_out_dir}/jar/app_unpacking_tool.jar",
"${target_out_dir}/jar/app_packing_tool.jar",
"${target_out_dir}/jar",
+ "${target_out_dir}/jar/app_check_tool.jar",
]
}
@@ -50,6 +52,13 @@ ohos_prebuilt_etc("app_packing_tool") {
install_enable = false
}
+ohos_prebuilt_etc("app_check_tool") {
+ list = get_target_outputs(":packing_tool")
+ source = list[3]
+ deps = [ ":packing_tool" ]
+ install_enable = false
+}
+
ohos_prebuilt_etc("fastjson-1.2.83") {
source = "jar/fastjson-1.2.83.jar"
install_enable = false
diff --git a/META-INF/check_tool/MANIFEST.MF b/META-INF/check_tool/MANIFEST.MF
new file mode 100644
index 0000000000000000000000000000000000000000..83a23b9863986344b9ce8ae96bd7b8674fd3a16e
--- /dev/null
+++ b/META-INF/check_tool/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Class-Path: fastjson-1.2.83.jar
+Created-By: javac.py
+Main-Class: ohos.ScanEntrance
diff --git a/OAT.xml b/OAT.xml
index 33fe5d8c37631d3dd65fdba2c7e92b37fc3e64de..852815349959529aea0c7d87aaf89905be374f11 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -61,6 +61,7 @@ Note:If the text contains special characters, please escape them according to th
+
diff --git a/build.py b/build.py
index 5a776bc8af26929e289873f8f188eb2760910c4c..d56ba64c01c329d3c8c179546907db6efc326b91 100755
--- a/build.py
+++ b/build.py
@@ -30,6 +30,7 @@ def main():
parser.add_argument('--haptobinOutput', required=True)
parser.add_argument('--unpackOutput', required=True)
parser.add_argument('--packOutput', required=True)
+ parser.add_argument('--checkOutput', required=True)
parser.add_argument('--outpath', required=True)
parser.add_argument('--toolchain', required=True)
parser.add_argument('--compileTarget', required=True)
@@ -37,6 +38,7 @@ def main():
print(args.haptobinOutput)
print(args.unpackOutput)
print(args.packOutput)
+ print(args.checkOutput)
print(args.outpath)
print(args.compileTarget)
root_dir = os.path.dirname(os.path.realpath(__file__))
@@ -85,6 +87,16 @@ def main():
print(pack_out.decode('utf-8'))
print(pack_err.decode('utf-8'))
raise Exception("compile packing tool java class failed!")
+
+ #compile app_check_tool.jar
+ check_tool_shell_path = os.path.join(root_dir, "checkTool.sh")
+ command_check = ['bash', check_tool_shell_path, root_dir, args.checkOutput, args.outpath, toolchain]
+ child_check = subprocess.Popen(command_check, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ check_out, check_err = child_check.communicate(timeout=time_out)
+ if child_check.returncode != 0:
+ print(check_out.decode('utf-8'))
+ print(check_err.decode('utf-8'))
+ raise Exception("compile check tool java class failed!")
if __name__ == '__main__':
sys.exit(main())
diff --git a/checkTool.sh b/checkTool.sh
new file mode 100644
index 0000000000000000000000000000000000000000..6228a1ed4253977cfae092b989ab09bc416f8d4c
--- /dev/null
+++ b/checkTool.sh
@@ -0,0 +1,118 @@
+#!/usr/bin/env bash
+# Copyright (c) 2023 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.
+set -e
+root_path=$1
+pack_build_out_jar_path=$2
+pack_build_out_path=$3
+toolchain=$4
+final_path=$(pwd)
+
+jar_dir="jar"
+pack_jar_file="app_check_tool.jar"
+fastjson_jar_file="fastjson-1.2.83.jar"
+jar_directory="${root_path}/jar"
+pack_jar_path="${root_path}/${jar_dir}/${pack_jar_file}"
+manifest_path="${root_path}/META-INF/check_tool/MANIFEST.MF"
+css_path="${root_path}/adapter/ohos/scan_template.css"
+html_path="${root_path}/adapter/ohos/scan_template.html"
+
+out_dir="${root_path}/out/${toolchain}/check_tool"
+if [ -d "${out_dir}/ohos" ]
+ then
+ echo "${out_dir}/ohos exist"
+ else
+ mkdir -p "${out_dir}/ohos"
+fi
+
+jar_path="${root_path}/jar"
+fastjson_jar_path="${root_path}/jar/fastjson-1.2.83.jar"
+java_suffix=".java"
+java_collection=""
+declare -a compile_class=(
+ "BundleException"
+ "CommandParser"
+ "ScanEntrance"
+ "Scan"
+ "ScanVerify"
+ "ScanStatDuplicate"
+ "ScanStatFileSize"
+ "ScanStatSuffix"
+ "Log"
+ "PackFormatter"
+ "ShowHelp"
+ "Utility"
+ "FileUtils"
+ )
+compile_class_length=${#compile_class[@]}
+for ((i=0; i<${compile_class_length};++i))
+do
+ java_collection="${java_collection} ${root_path}/adapter/ohos/${compile_class[$i]}${java_suffix}"
+done
+compile_command="javac -source 1.8 -target 1.8 -cp ${fastjson_jar_path} -d ${out_dir} ${java_collection}"
+eval ${compile_command}
+
+temp_dir="$root_path/jar/temp_${toolchain}"
+if [ -d "${temp_dir}" ]
+ then
+ echo "${temp_dir} exit"
+ else
+ mkdir ${temp_dir}
+fi
+
+cd ${out_dir}
+product_pack_jar_command="jar -cvfm ${temp_dir}/${pack_jar_file} ${manifest_path} ./ohos ${css_path} ${html_path}"
+eval ${product_pack_jar_command}
+
+# merge app_packing_tool.jar and fastjson
+cp ${fastjson_jar_path} "${temp_dir}/${fastjson_jar_file}"
+detach_pack_jar_command="jar -xvf ${pack_jar_file}"
+detach_fastjson_jar_command="jar -xvf ${fastjson_jar_file}"
+cd ${temp_dir}
+eval ${detach_pack_jar_command}
+eval ${detach_fastjson_jar_command}
+rm ${pack_jar_file}
+rm ${fastjson_jar_file}
+
+cd ${jar_directory}
+temp_pack_jar_dir="${root_path}/jar/packtool_${toolchain}"
+temp_pack_jar_path="${root_path}/jar/packtool_${toolchain}/${pack_jar_file}"
+merge_pack_fast_jar_command="jar -cvfm ${temp_pack_jar_path} ${manifest_path} -C ${temp_dir} ."
+if [ -d "${temp_pack_jar_dir}" ]
+ then
+ echo "${temp_pack_jar_dir} exist"
+ else
+ mkdir -p ${temp_pack_jar_dir}
+fi
+eval ${merge_pack_fast_jar_command}
+
+# make out dir
+final_pack_out_path="${final_path}/${pack_build_out_path}"
+final_pack_jar_path="${final_path}/${pack_build_out_jar_path}"
+if [ -d "$final_pack_out_path" ]
+ then
+ echo "${final_pack_out_path} exist"
+ else
+ mkdir -p ${final_pack_out_path}
+fi
+copy_command="cp ${temp_pack_jar_path} ${final_pack_jar_path}"
+eval ${copy_command}
+if [ -f "${pack_jar_file}"]
+ then
+ echo "${pack_jar_file} exist"
+ else
+ cp ${temp_pack_jar_path} ${pack_jar_file}
+fi
+rm -rf ${temp_pack_jar_dir}
+rm -rf ${temp_dir}
+rm -rf "${root_path}/out"
diff --git a/packingtool.gni b/packingtool.gni
index 9a9b38d301fa64cc46c0c646e0e60de36e33ed70..bd21b05e6803efea23c26f786bbd2ca25a252328 100755
--- a/packingtool.gni
+++ b/packingtool.gni
@@ -33,6 +33,8 @@ template("packing_tool") {
rebase_path(outputs[2], root_build_dir),
"--outpath",
rebase_path(outputs[3], root_build_dir),
+ "--checkOutput",
+ rebase_path(outputs[4], root_build_dir),
"--toolchain",
current_toolchain,
]