1#!/usr/bin/env python
2# coding: utf-8
3# Copyright (c) 2023 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16typescript_dir = get_label_info("//third_party/typescript:build_typescript",
17                                "target_out_dir")
18
19action("build_arkguard") {
20  sources = [
21    "package.json",
22    "src/ArkObfuscator.ts",
23    "src/ArkObfuscatorForTest.ts",
24    "src/IObfuscator.ts",
25    "src/cli/SecHarmony.ts",
26    "src/common/ApiExtractor.ts",
27    "src/common/ApiReader.ts",
28    "src/common/type.ts",
29    "src/configs/INameObfuscationOption.ts",
30    "src/configs/IOptions.ts",
31    "src/configs/preset/es_reserved_properties.json",
32    "src/generator/INameGenerator.ts",
33    "src/generator/NameFactory.ts",
34    "src/generator/OrderedNameGenerator.ts",
35    "src/transformers/TransformPlugin.ts",
36    "src/transformers/TransformerManager.ts",
37    "src/transformers/layout/DisableConsoleTransformer.ts",
38    "src/transformers/rename/RenameFileNameTransformer.ts",
39    "src/transformers/rename/RenameIdentifierTransformer.ts",
40    "src/transformers/rename/RenamePropertiesTransformer.ts",
41    "src/transformers/rename/ShorthandPropertyTransformer.ts",
42    "src/utils/FileUtils.ts",
43    "src/utils/ListUtil.ts",
44    "src/utils/NameCacheUtil.ts",
45    "src/utils/NodeUtils.ts",
46    "src/utils/OhsUtil.ts",
47    "src/utils/ScopeAnalyzer.ts",
48    "src/utils/SourceMapUtil.ts",
49    "src/utils/TransformUtil.ts",
50    "src/utils/TypeUtils.ts",
51  ]
52
53  deps = [ "//third_party/typescript:build_typescript" ]
54  script = "compile_arkguard.py"
55  args = [
56    rebase_path(get_path_info("./", "abspath")),
57    rebase_path("${typescript_dir}/ohos-typescript-4.9.5-r4.tgz"),
58    rebase_path("${target_out_dir}"),
59  ]
60
61  outputs = [ "${target_out_dir}/arkguard-1.1.3.tgz" ]
62}
63