1# Copyright (c) 2020-2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/startup/appspawn/appspawn.gni")
15import("//base/startup/appspawn/etc/sandbox/appdata_sandbox_fixer.gni")
16import("//build/ohos.gni")
17
18if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) {
19  ohos_prebuilt_etc("appdata-sandbox-nweb.json") {
20    source = "../appdata-sandbox-nweb.json"
21    part_name = "${part_name}"
22    module_install_dir = "etc/sandbox"
23  }
24
25  ohos_prebuilt_etc("appdata-sandbox.json") {
26    source = "../appdata-sandbox-app.json"
27    symlink_target_name = [ "appdata-sandbox.json" ]
28    part_name = "${part_name}"
29    module_install_dir = "etc/sandbox"
30  }
31
32  ohos_prebuilt_etc("appdata-sandbox-isolated.json") {
33    source = "../appdata-sandbox-isolated.json"
34    part_name = "${part_name}"
35    module_install_dir = "etc/sandbox"
36  }
37} else {
38  ohos_prebuilt_appdata_sandbox("appdata-sandbox.json") {
39    source = "../appdata-sandbox.json"
40    patterns = []
41    extra_sandbox_cfgs = []
42    if (target_cpu == "arm64" || target_cpu == "x86_64") {
43      extra_sandbox_cfgs += [ "../appdata-sandbox64.json" ]
44    }
45    if (is_asan || asan_detector) {
46      extra_sandbox_cfgs += [ "../appdata-sandbox-asan.json" ]
47    }
48    subsystem_name = "${subsystem_name}"
49    part_name = "${part_name}"
50    module_install_dir = "etc/sandbox"
51  }
52
53  ohos_prebuilt_appdata_sandbox("appdata-sandbox-isolated.json") {
54    source = "../appdata-sandbox-isolated.json"
55    patterns = []
56    extra_sandbox_cfgs = []
57    subsystem_name = "${subsystem_name}"
58    part_name = "${part_name}"
59    module_install_dir = "etc/sandbox"
60  }
61}
62
63ohos_prebuilt_etc("appspawn_preload.json") {
64  source = "../appspawn_preload.json"
65  part_name = "${part_name}"
66  module_install_dir = "etc/appspawn"
67}
68
69group("etc_files") {
70  deps = [
71    ":appdata-sandbox-isolated.json",
72    ":appdata-sandbox.json",
73    ":appspawn_preload.json",
74  ]
75  if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) {
76    deps += [ ":appdata-sandbox-nweb.json" ]
77  }
78}
79