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 16if ((defined(ark_standalone_build) && ark_standalone_build) || 17 (defined(ark_static_standalone_build) && ark_static_standalone_build)) { 18 import("//arkcompiler/runtime_core/static_core/ark_config.gni") 19} else { 20 import( 21 "//build/config/components/runtime_core/static_core/ark_common_config.gni") 22} 23 24if (defined(ohos_indep_compiler_enable) && ohos_indep_compiler_enable) { 25 typescript_dir = 26 get_label_info("typescript:build_typescript_etc", "target_out_dir") 27 typescript_tgz = "${typescript_dir}/libs/ohos-typescript-4.9.5-r4.tgz" 28} else { 29 typescript_dir = get_label_info("//third_party/typescript:build_typescript", 30 "target_out_dir") 31 typescript_tgz = "${typescript_dir}/ohos-typescript-4.9.5-r4.tgz" 32} 33 34action("build_arkguard") { 35 sources = [ 36 "package.json", 37 "src/ArkObfuscator.ts", 38 "src/ArkObfuscatorForTest.ts", 39 "src/IObfuscator.ts", 40 "src/cli/SecHarmony.ts", 41 "src/common/ApiExtractor.ts", 42 "src/common/ApiReader.ts", 43 "src/common/type.ts", 44 "src/configs/INameObfuscationOption.ts", 45 "src/configs/IOptions.ts", 46 "src/configs/preset/es_reserved_properties.json", 47 "src/generator/INameGenerator.ts", 48 "src/generator/NameFactory.ts", 49 "src/generator/OrderedNameGenerator.ts", 50 "src/transformers/TransformPlugin.ts", 51 "src/transformers/TransformerManager.ts", 52 "src/transformers/layout/DisableConsoleTransformer.ts", 53 "src/transformers/rename/RenameFileNameTransformer.ts", 54 "src/transformers/rename/RenameIdentifierTransformer.ts", 55 "src/transformers/rename/RenamePropertiesTransformer.ts", 56 "src/transformers/rename/ShorthandPropertyTransformer.ts", 57 "src/utils/FileUtils.ts", 58 "src/utils/ListUtil.ts", 59 "src/utils/NameCacheUtil.ts", 60 "src/utils/NodeUtils.ts", 61 "src/utils/OhsUtil.ts", 62 "src/utils/ScopeAnalyzer.ts", 63 "src/utils/SourceMapUtil.ts", 64 "src/utils/TransformUtil.ts", 65 "src/utils/TypeUtils.ts", 66 ] 67 68 external_deps = [ "typescript:build_typescript_etc" ] 69 script = "compile_arkguard.py" 70 args = [ 71 rebase_path(get_path_info("./", "abspath")), 72 rebase_path("$typescript_tgz"), 73 rebase_path("${target_out_dir}"), 74 ] 75 76 outputs = [ "${target_out_dir}/arkguard-1.1.3.tgz" ] 77} 78 79if (!(defined(ark_static_standalone_build) && ark_static_standalone_build)) { 80 ohos_shared_headers("build_arkguard_etc") { 81 include_dirs = [] 82 deps = [ ":build_arkguard" ] 83 part_name = "ets_frontend" 84 subsystem_name = "arkcompiler" 85 } 86} 87