1# Copyright (c) 2021-2023 北京万里红科技有限公司
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("//build/ohos.gni")
16import("selinux.gni")
17
18startup_init_with_param_base = false
19if (!use_musl) {
20  startup_init_with_param_base = true
21}
22
23special_build_selinux_gni_exist =
24    selinux_adapter_special_build_selinux_gni_path != "" &&
25    exec_script("/bin/sh",
26                [
27                  "-c",
28                  "if [ -f " + rebase_path(
29                          selinux_adapter_special_build_selinux_gni_path) +
30                      " ]; then echo true; else echo false; fi",
31                ],
32                "value")
33if (special_build_selinux_gni_exist) {
34  import(selinux_adapter_special_build_selinux_gni_path)
35}
36
37config("selinux_core_config") {
38  include_dirs = [ "interfaces/policycoreutils/include" ]
39}
40
41ohos_shared_library("libload_policy") {
42  output_name = "libload_policy"
43  sources = [ "interfaces/policycoreutils/src/load_policy.cpp" ]
44  include_dirs = [ "interfaces/policycoreutils/include" ]
45  deps = [ ":libselinux_klog_static" ]
46  external_deps = [ "selinux:libselinux" ]
47  cflags = [
48    "-D_GNU_SOURCE",
49    "-Wall",
50    "-Werror",
51  ]
52  if (selinux_adapter_support_developer_mode) {
53    cflags += [ "-DWITH_DEVELOPER" ]
54  }
55  install_enable = true
56  install_images = [
57    "system",
58    "ramdisk",
59    "updater",
60  ]
61  license_file = "LICENSE"
62  part_name = "selinux_adapter"
63  subsystem_name = "security"
64}
65
66ohos_shared_library("librestorecon") {
67  branch_protector_ret = "pac_ret"
68
69  output_name = "librestorecon"
70  sources = [ "interfaces/policycoreutils/src/selinux_restorecon.c" ]
71  public_configs = [ ":selinux_core_config" ]
72  deps = [ ":libselinux_klog_static" ]
73  external_deps = [ "hilog:libhilog" ]
74
75  public_external_deps = [ "selinux:libselinux" ]
76
77  cflags = [
78    "-D_GNU_SOURCE",
79    "-Wall",
80    "-Werror",
81  ]
82  install_enable = true
83  install_images = [
84    "system",
85    "ramdisk",
86    "updater",
87  ]
88  innerapi_tags = [ "platformsdk_indirect" ]
89  license_file = "LICENSE"
90  part_name = "selinux_adapter"
91  subsystem_name = "security"
92}
93
94ohos_static_library("libselinux_klog_real_static") {
95  output_name = "libselinux_klog_real_static"
96  sources = [ "interfaces/policycoreutils/src/selinux_klog.c" ]
97  include_dirs = [ "interfaces/policycoreutils/include" ]
98  external_deps = [ "bounds_checking_function:libsec_static" ]
99  cflags = [
100    "-D_GNU_SOURCE",
101    "-Wall",
102    "-Werror",
103  ]
104  part_name = "selinux_adapter"
105  subsystem_name = "security"
106}
107
108ohos_static_library("libselinux_hilog_real_static") {
109  output_name = "libselinux_hilog_real_static"
110  sources = [ "interfaces/policycoreutils/src/selinux_log.c" ]
111  include_dirs = [ "interfaces/policycoreutils/include" ]
112  external_deps = [
113    "bounds_checking_function:libsec_static",
114    "hilog:libhilog_base",
115  ]
116  cflags = [
117    "-D_GNU_SOURCE",
118    "-Wall",
119    "-Werror",
120  ]
121  part_name = "selinux_adapter"
122  subsystem_name = "security"
123}
124
125ohos_static_library("librestorecon_static") {
126  output_name = "librestorecon_static"
127  sources = [ "interfaces/policycoreutils/src/selinux_restorecon.c" ]
128  public_configs = [ ":selinux_core_config" ]
129  deps = [ ":libselinux_klog_real_static" ]
130  external_deps = [ "hilog:libhilog_base" ]
131
132  public_external_deps = [ "selinux:libselinux_static" ]
133
134  cflags = [
135    "-D_GNU_SOURCE",
136    "-Wall",
137    "-Werror",
138  ]
139  license_file = "LICENSE"
140  part_name = "selinux_adapter"
141  subsystem_name = "security"
142}
143
144ohos_shared_library("libhap_restorecon") {
145  output_name = "libhap_restorecon"
146  sources = [
147    "interfaces/policycoreutils/src/hap_restorecon.cpp",
148    "interfaces/policycoreutils/src/sehap_contexts_trie.cpp",
149  ]
150  public_configs = [ ":selinux_core_config" ]
151  deps = [
152    ":libselinux_error_static",
153    ":libselinux_hilog_static",
154  ]
155  external_deps = [ "hilog:libhilog" ]
156
157  public_external_deps = [ "selinux:libselinux" ]
158
159  cflags = [
160    "-D_GNU_SOURCE",
161    "-Wall",
162    "-Werror",
163  ]
164  install_enable = true
165  license_file = "LICENSE"
166  part_name = "selinux_adapter"
167  subsystem_name = "security"
168}
169
170ohos_static_library("libselinux_error_static") {
171  output_name = "libselinux_error_static"
172  sources = [ "interfaces/policycoreutils/src/selinux_error.cpp" ]
173  include_dirs = [ "interfaces/policycoreutils/include" ]
174  cflags = [
175    "-D_GNU_SOURCE",
176    "-w",
177  ]
178  part_name = "selinux_adapter"
179  subsystem_name = "security"
180}
181
182ohos_static_library("libselinux_klog_static") {
183  output_name = "libselinux_klog_static"
184  sources = [ "interfaces/policycoreutils/src/selinux_klog.c" ]
185  include_dirs = [ "interfaces/policycoreutils/include" ]
186  external_deps = [ "bounds_checking_function:libsec_shared" ]
187  cflags = [
188    "-D_GNU_SOURCE",
189    "-Wall",
190    "-Werror",
191  ]
192  part_name = "selinux_adapter"
193  subsystem_name = "security"
194}
195
196ohos_static_library("libselinux_hilog_static") {
197  branch_protector_ret = "pac_ret"
198
199  output_name = "libselinux_hilog_static"
200  sources = [ "interfaces/policycoreutils/src/selinux_log.c" ]
201  include_dirs = [ "interfaces/policycoreutils/include" ]
202  external_deps = [
203    "bounds_checking_function:libsec_shared",
204    "hilog:libhilog",
205  ]
206  cflags = [
207    "-D_GNU_SOURCE",
208    "-Wall",
209    "-Werror",
210  ]
211  part_name = "selinux_adapter"
212  subsystem_name = "security"
213}
214
215if (!startup_init_with_param_base) {
216  inherited_configs = [
217    "$BUILD_CONFIG_DIR/compiler:afdo",
218    "$BUILD_CONFIG_DIR/compiler:afdo_optimize_size",
219    "$BUILD_CONFIG_DIR/compiler:compiler",
220    "$BUILD_CONFIG_DIR/compiler:compiler_arm_fpu",
221    "$BUILD_CONFIG_DIR/compiler:compiler_arm_thumb",
222    "$BUILD_CONFIG_DIR/compiler:chromium_code",
223    "$BUILD_CONFIG_DIR/compiler:default_include_dirs",
224    "$BUILD_CONFIG_DIR/compiler:default_optimization",
225    "$BUILD_CONFIG_DIR/compiler:default_stack_frames",
226    "$BUILD_CONFIG_DIR/compiler:default_symbols",
227    "$BUILD_CONFIG_DIR/compiler:export_dynamic",
228    "$BUILD_CONFIG_DIR/compiler:no_exceptions",
229    "$BUILD_CONFIG_DIR/compiler:no_rtti",
230    "$BUILD_CONFIG_DIR/compiler:runtime_library",
231    "$BUILD_CONFIG_DIR/compiler:thin_archive",
232    "$BUILD_CONFIG_DIR/sanitizers:default_sanitizer_flags",
233  ]
234}
235
236static_library("libselinux_parameter_static") {
237  output_name = "libselinux_parameter_static"
238  sources = [
239    "interfaces/policycoreutils/src/contexts_trie.c",
240    "interfaces/policycoreutils/src/selinux_map.c",
241    "interfaces/policycoreutils/src/selinux_parameter.c",
242    "interfaces/policycoreutils/src/selinux_share_mem.c",
243  ]
244  public_configs = [ ":selinux_core_config" ]
245  include_dirs = [ "interfaces/policycoreutils/include" ]
246  cflags = [
247    "-D_GNU_SOURCE",
248    "-Wall",
249    "-Werror",
250  ]
251  if (!startup_init_with_param_base) {
252    ldflags = [ "-nostdlib" ]
253    configs -= inherited_configs
254    configs += [ "$BUILD_CONFIG_DIR/compiler:compiler" ]
255  }
256}
257
258ohos_shared_library("libparaperm_checker") {
259  output_name = "libparaperm_checker"
260  sources = [ "interfaces/policycoreutils/src/param_checker.c" ]
261  public_configs = [ ":selinux_core_config" ]
262  deps = [ ":libselinux_klog_static" ]
263  deps += [ ":libselinux_parameter_static" ]
264  external_deps = [ "bounds_checking_function:libsec_shared" ]
265  public_external_deps = [ "selinux:libselinux" ]
266
267  cflags = [
268    "-D_GNU_SOURCE",
269    "-Wall",
270    "-Werror",
271  ]
272  install_images = [
273    "system",
274    "updater",
275  ]
276  part_name = "selinux_adapter"
277  subsystem_name = "security"
278}
279
280ohos_shared_library("libservice_checker") {
281  output_name = "libservice_checker"
282  sources = [ "interfaces/policycoreutils/src/service_checker.cpp" ]
283  public_configs = [ ":selinux_core_config" ]
284  deps = [
285    ":libselinux_error_static",
286    ":libselinux_hilog_static",
287  ]
288  external_deps = [
289    "bounds_checking_function:libsec_shared",
290    "hilog:libhilog",
291  ]
292  public_external_deps = [ "selinux:libselinux" ]
293  cflags = [
294    "-D_GNU_SOURCE",
295    "-Wall",
296    "-Werror",
297  ]
298  innerapi_tags = [ "chipsetsdk" ]
299  part_name = "selinux_adapter"
300  subsystem_name = "security"
301}
302
303ohos_executable("load_policy") {
304  install_enable = true
305  sources = [ "interfaces/tools/load_policy/load_policy.c" ]
306  include_dirs = [ "interfaces/policycoreutils/include" ]
307  deps = [ ":libload_policy" ]
308  cflags = [
309    "-D_GNU_SOURCE",
310    "-Wall",
311    "-Werror",
312  ]
313  license_file = "LICENSE"
314  part_name = "selinux_adapter"
315  subsystem_name = "security"
316  install_images = [
317    "system",
318    "updater",
319  ]
320}
321
322ohos_executable("restorecon") {
323  install_enable = true
324  sources = [ "interfaces/tools/restorecon/restorecon.c" ]
325  include_dirs = [ "interfaces/policycoreutils/include" ]
326  deps = [ ":librestorecon" ]
327  external_deps = [
328    "bounds_checking_function:libsec_shared",
329    "selinux:libselinux",
330  ]
331  cflags = [
332    "-D_GNU_SOURCE",
333    "-Wall",
334    "-Werror",
335  ]
336  license_file = "LICENSE"
337  part_name = "selinux_adapter"
338  subsystem_name = "security"
339  install_images = [
340    "system",
341    "updater",
342  ]
343}
344
345ohos_executable("hap_restorecon") {
346  install_enable = false
347  sources = [ "interfaces/tools/hap_restorecon/test.cpp" ]
348  include_dirs = [ "interfaces/policycoreutils/include" ]
349  deps = [
350    ":libhap_restorecon",
351    ":libselinux_error_static",
352  ]
353  cflags = [
354    "-D_GNU_SOURCE",
355    "-Wall",
356    "-Werror",
357  ]
358  external_deps = [ "selinux:libselinux" ]
359  license_file = "LICENSE"
360  part_name = "selinux_adapter"
361  subsystem_name = "security"
362}
363
364ohos_executable("param_check") {
365  install_enable = false
366  sources = [ "interfaces/tools/param_check/test.cpp" ]
367  include_dirs = [ "interfaces/policycoreutils/include" ]
368  deps = [
369    ":libparaperm_checker",
370    ":libselinux_error_static",
371    ":libselinux_parameter_static",
372  ]
373  external_deps = [
374    "pcre2:libpcre2",
375    "selinux:libselinux",
376  ]
377  if (startup_init_with_param_base) {
378    deps += [ ":libselinux_parameter_static" ]
379  }
380  cflags = [
381    "-D_GNU_SOURCE",
382    "-DTIME_DISPLAY",
383    "-Wall",
384    "-Werror",
385  ]
386  license_file = "LICENSE"
387  part_name = "selinux_adapter"
388  subsystem_name = "security"
389}
390
391ohos_executable("service_check") {
392  install_enable = false
393  sources = [ "interfaces/tools/service_check/test.cpp" ]
394  include_dirs = [ "interfaces/policycoreutils/include" ]
395  deps = [
396    ":libselinux_error_static",
397    ":libservice_checker",
398  ]
399  cflags = [
400    "-D_GNU_SOURCE",
401    "-Wall",
402    "-Werror",
403  ]
404  license_file = "LICENSE"
405  part_name = "selinux_adapter"
406  subsystem_name = "security"
407}
408
409debug_version = "disable"
410updater_version = "disable"
411
412action("build_policy") {
413  if (build_variant == "user") {
414    debug_version = "disable"
415  } else if (build_variant == "root") {
416    debug_version = "enable"
417  } else {
418    debug_version = "enable"
419  }
420
421  updater_version = "disable"
422
423  inputs = exec_script("//build/scripts/find.py",
424                       [ rebase_path("sepolicy") ],
425                       "list lines")
426  if (selinux_adapter_build_path != "default") {
427    foreach(src, string_split(selinux_adapter_build_path, ":")) {
428      src = "//" + src
429      inputs += exec_script("//build/scripts/find.py",
430                            [ rebase_path(src) ],
431                            "list lines")
432    }
433    if (special_build_selinux_gni_exist &&
434        selinux_build_path_ext != "default") {
435      selinux_adapter_build_path =
436          selinux_adapter_build_path + ":" + selinux_build_path_ext
437    }
438  } else {
439    selinux_adapter_build_path =
440        selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR
441  }
442
443  if (selinux_adapter_special_build_policy_script != "default") {
444    script = selinux_adapter_special_build_policy_script
445  } else {
446    script = "scripts/build_policy.py"
447  }
448
449  args = [
450    "--dst-file",
451    rebase_path(target_out_dir + "/policy.31"),
452    "--tool-path",
453    rebase_path(root_build_dir + "/clang_${host_cpu}/thirdparty/selinux/"),
454    "--source-root-dir",
455    rebase_path("//"),
456    "--policy_dir_list",
457    selinux_adapter_build_path,
458    "--debug-version",
459    debug_version,
460    "--updater-version",
461    updater_version,
462    "--components",
463    selinux_adapter_components,
464  ]
465
466  if (selinux_adapter_components != "default") {
467    args += [
468      "--vendor-policy-version",
469      "$selinux_adapter_vendor_policy_version",
470    ]
471  }
472
473  if (selinux_adapter_extra_args != "default") {
474    foreach(arg, string_split(selinux_adapter_extra_args, " ")) {
475      args += [ arg ]
476    }
477  }
478
479  external_deps = [
480    "selinux:checkpolicy($host_toolchain)",
481    "selinux:secilc($host_toolchain)",
482  ]
483  outputs = [
484    target_out_dir + "/policy.31",
485    target_out_dir + "/user_policy",
486    target_out_dir + "/vendor.cil",
487    target_out_dir + "/prebuild_sepolicy.system.cil.sha256",
488    target_out_dir + "/system.cil",
489    target_out_dir + "/system.cil.sha256",
490    target_out_dir + "/compatible/$selinux_adapter_vendor_policy_version.cil",
491    target_out_dir + "/compatible",
492    target_out_dir + "/version",
493    target_out_dir + "/public.cil",
494  ]
495
496  outputs += [
497    target_out_dir + "/developer/prebuild_sepolicy.system.cil.sha256",
498    target_out_dir + "/developer/system.cil.sha256",
499    target_out_dir +
500        "/developer/compatible/$selinux_adapter_vendor_policy_version.cil",
501    target_out_dir + "/developer/compatible",
502    target_out_dir + "/developer/developer_policy",
503    target_out_dir + "/developer/policy.31",
504    target_out_dir + "/developer/vendor.cil",
505    target_out_dir + "/developer/system.cil",
506    target_out_dir + "/developer/public.cil",
507  ]
508
509  if (selinux_adapter_components != "default") {
510    outputs += [
511      target_out_dir + "/system_common.cil",
512      target_out_dir + "/vendor_common.cil",
513      target_out_dir + "/public_common.cil",
514    ]
515  }
516}
517
518action("build_update_policy") {
519  if (build_variant == "user") {
520    debug_version = "disable"
521  } else if (build_variant == "root") {
522    debug_version = "enable"
523  } else {
524    debug_version = "enable"
525  }
526
527  updater_version = "enable"
528  selinux_adapter_components = "default"
529  inputs = exec_script("//build/scripts/find.py",
530                       [ rebase_path("sepolicy") ],
531                       "list lines")
532  if (selinux_adapter_build_path != "default") {
533    foreach(src, string_split(selinux_adapter_build_path, ":")) {
534      src = "//" + src
535      inputs += exec_script("//build/scripts/find.py",
536                            [ rebase_path(src) ],
537                            "list lines")
538    }
539    if (special_build_selinux_gni_exist &&
540        selinux_build_path_ext_updater != "default") {
541      selinux_adapter_build_path =
542          selinux_adapter_build_path + ":" + selinux_build_path_ext_updater
543    }
544  } else {
545    selinux_adapter_build_path =
546        selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR
547  }
548
549  if (selinux_adapter_special_build_policy_script != "default") {
550    script = selinux_adapter_special_build_policy_script
551  } else {
552    script = "scripts/build_policy.py"
553  }
554
555  args = [
556    "--dst-file",
557    rebase_path(target_out_dir + "/updater/policy.31"),
558    "--tool-path",
559    rebase_path(root_build_dir + "/clang_${host_cpu}/thirdparty/selinux/"),
560    "--source-root-dir",
561    rebase_path("//"),
562    "--policy_dir_list",
563    selinux_adapter_build_path,
564    "--debug-version",
565    debug_version,
566    "--updater-version",
567    updater_version,
568    "--components",
569    selinux_adapter_components,
570  ]
571
572  if (selinux_adapter_extra_args != "default") {
573    foreach(arg, string_split(selinux_adapter_extra_args, " ")) {
574      args += [ arg ]
575    }
576  }
577
578  external_deps = [
579    "selinux:checkpolicy($host_toolchain)",
580    "selinux:secilc($host_toolchain)",
581  ]
582  outputs = [ target_out_dir + "/updater/policy.31" ]
583}
584
585action("build_contexts") {
586  inputs = exec_script("//build/scripts/find.py",
587                       [ rebase_path("sepolicy") ],
588                       "list lines")
589  if (selinux_adapter_build_path != "default") {
590    foreach(src, string_split(selinux_adapter_build_path, ":")) {
591      src = "//" + src
592      inputs += exec_script("//build/scripts/find.py",
593                            [ rebase_path(src) ],
594                            "list lines")
595    }
596    if (special_build_selinux_gni_exist &&
597        selinux_build_path_ext != "default") {
598      selinux_adapter_build_path =
599          selinux_adapter_build_path + ":" + selinux_build_path_ext
600    }
601  } else {
602    selinux_adapter_build_path =
603        selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR
604  }
605
606  if (selinux_adapter_special_build_contexts_script != "default") {
607    script = selinux_adapter_special_build_contexts_script
608  } else {
609    script = "scripts/build_contexts.py"
610  }
611  args = [
612    "--dst-dir",
613    rebase_path(target_out_dir + "/"),
614    "--tool-path",
615    rebase_path(root_build_dir + "/clang_${host_cpu}/thirdparty/selinux/"),
616    "--policy-file",
617    rebase_path(target_out_dir + "/policy.31"),
618    "--source-root-dir",
619    rebase_path("//"),
620    "--policy_dir_list",
621    selinux_adapter_build_path,
622    "--components",
623    selinux_adapter_components,
624  ]
625  if (selinux_adapter_contexts_extra_args != "default") {
626    foreach(arg, string_split(selinux_adapter_contexts_extra_args, " ")) {
627      args += [ arg ]
628    }
629  }
630  deps = [ ":build_policy" ]
631  external_deps = [ "selinux:sefcontext_compile($host_toolchain)" ]
632  outputs = [
633    target_out_dir + "/file_contexts.bin",
634    target_out_dir + "/file_contexts",
635    target_out_dir + "/sehap_contexts",
636    target_out_dir + "/service_contexts",
637    target_out_dir + "/hdf_service_contexts",
638    target_out_dir + "/parameter_contexts",
639  ]
640}
641
642action("build_ignore_cfg") {
643  inputs = exec_script("//build/scripts/find.py",
644                       [ rebase_path("sepolicy") ],
645                       "list lines")
646  if (selinux_adapter_build_path != "default") {
647    foreach(src, string_split(selinux_adapter_build_path, ":")) {
648      src = "//" + src
649      inputs += exec_script("//build/scripts/find.py",
650                            [ rebase_path(src) ],
651                            "list lines")
652    }
653    if (special_build_selinux_gni_exist &&
654        selinux_build_path_ext != "default") {
655      selinux_adapter_build_path =
656          selinux_adapter_build_path + ":" + selinux_build_path_ext
657    }
658  } else {
659    selinux_adapter_build_path =
660        selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR
661  }
662
663  if (special_build_ignore_cfg != "default") {
664    script = special_build_ignore_cfg
665  } else {
666    script = "scripts/build_ignore_cfg.py"
667  }
668  args = [
669    "--dst-dir",
670    rebase_path(target_out_dir + "/"),
671    "--source-root-dir",
672    rebase_path("//"),
673    "--policy-dir-list",
674    selinux_adapter_build_path,
675    "--components",
676    selinux_adapter_components,
677  ]
678  outputs = [ target_out_dir + "/ignore_cfg" ]
679}
680
681action("build_updater_contexts") {
682  inputs = exec_script("//build/scripts/find.py",
683                       [ rebase_path("sepolicy") ],
684                       "list lines")
685  if (selinux_adapter_build_path != "default") {
686    foreach(src, string_split(selinux_adapter_build_path, ":")) {
687      src = "//" + src
688      inputs += exec_script("//build/scripts/find.py",
689                            [ rebase_path(src) ],
690                            "list lines")
691    }
692    if (special_build_selinux_gni_exist &&
693        selinux_build_path_ext_updater != "default") {
694      selinux_adapter_build_path =
695          selinux_adapter_build_path + ":" + selinux_build_path_ext_updater
696    }
697  } else {
698    selinux_adapter_build_path =
699        selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR
700  }
701
702  if (selinux_adapter_special_build_contexts_script != "default") {
703    script = selinux_adapter_special_build_contexts_script
704  } else {
705    script = "scripts/build_contexts.py"
706  }
707  args = [
708    "--dst-dir",
709    rebase_path(target_out_dir + "/updater"),
710    "--tool-path",
711    rebase_path(root_build_dir + "/clang_${host_cpu}/thirdparty/selinux/"),
712    "--policy-file",
713    rebase_path(target_out_dir + "/updater/policy.31"),
714    "--source-root-dir",
715    rebase_path("//"),
716    "--policy_dir_list",
717    selinux_adapter_build_path,
718    "--components",
719    selinux_adapter_components,
720  ]
721  if (selinux_adapter_contexts_extra_args != "default") {
722    foreach(arg, string_split(selinux_adapter_contexts_extra_args, " ")) {
723      args += [ arg ]
724    }
725  }
726  deps = [ ":build_update_policy" ]
727  external_deps = [ "selinux:sefcontext_compile($host_toolchain)" ]
728  outputs = [
729    target_out_dir + "/updater/file_contexts.bin",
730    target_out_dir + "/updater/file_contexts",
731    target_out_dir + "/updater/sehap_contexts",
732    target_out_dir + "/updater/service_contexts",
733    target_out_dir + "/updater/hdf_service_contexts",
734    target_out_dir + "/updater/parameter_contexts",
735  ]
736}
737
738action("selinux_check") {
739  script = "scripts/selinux_check/selinux_check_main.py"
740
741  if (selinux_adapter_build_path == "default") {
742    selinux_adapter_build_path =
743        selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR
744  }
745
746  if (selinux_adapter_check_extend_list != "default") {
747    selinux_adapter_build_path =
748        selinux_adapter_build_path + ":" + selinux_adapter_check_extend_list
749  }
750
751  args = [
752    "--output-path",
753    rebase_path(target_out_dir),
754    "--source-root-dir",
755    rebase_path("//"),
756    "--user-policy",
757    rebase_path(target_out_dir + "/user_policy"),
758    "--developer-policy",
759    rebase_path(target_out_dir + "/developer/developer_policy"),
760    "--tool-path",
761    rebase_path(root_build_dir + "/clang_${host_cpu}/thirdparty/selinux/"),
762    "--policy-dir-list",
763    selinux_adapter_build_path,
764  ]
765
766  if (special_selinux_check_config != "default") {
767    args += [
768      "--selinux-check-config",
769      special_selinux_check_config,
770    ]
771  } else {
772    args += [
773      "--selinux-check-config",
774      "base/security/selinux_adapter/scripts/selinux_check/config/selinux_check.json",
775    ]
776  }
777
778  outputs = [ "$target_out_dir" ]
779
780  deps = [
781    ":build_contexts",
782    ":build_policy",
783  ]
784}
785
786copy("selinux_config") {
787  if (selinux_adapter_enforce) {
788    sources = [ "config/config.enforce" ]
789  } else {
790    sources = [ "config/config.permissive" ]
791  }
792  outputs = [ "$target_out_dir/config" ]
793}
794
795copy("updater_selinux_config") {
796  sources = [ "config/config.enforce" ]
797  outputs = [ "$target_out_dir/updater/config" ]
798}
799
800ohos_prebuilt_etc("build_sepolicy") {
801  deps = [ ":build_policy" ]
802  source = target_out_dir + "/policy.31"
803  license_file = "LICENSE"
804  part_name = "selinux_adapter"
805  subsystem_name = "security"
806  if (selinux_adapter_components == "vendor") {
807    relative_install_dir = "selinux/prebuild_sepolicy/"
808    install_images = [ "vendor" ]
809  } else if (selinux_adapter_components == "default") {
810    if (!selinux_adapter_support_developer_mode) {
811      source = target_out_dir + "/developer/policy.31"
812    }
813    relative_install_dir = "selinux/targeted/policy/"
814    install_images = [ "system" ]
815  }
816}
817
818ohos_prebuilt_etc("build_updater_sepolicy") {
819  deps = [ ":build_update_policy" ]
820  source = target_out_dir + "/updater/policy.31"
821  license_file = "LICENSE"
822  part_name = "selinux_adapter"
823  subsystem_name = "security"
824  relative_install_dir = "selinux/targeted/policy/"
825  install_images = [ "updater" ]
826}
827
828ohos_prebuilt_etc("selinux_version") {
829  deps = [ ":build_policy" ]
830  source = target_out_dir + "/version"
831  license_file = "LICENSE"
832  part_name = "selinux_adapter"
833  subsystem_name = "security"
834  relative_install_dir = "selinux/"
835  install_images = [ "vendor" ]
836}
837
838ohos_prebuilt_etc("config") {
839  deps = [ ":selinux_config" ]
840  source = target_out_dir + "/config"
841  license_file = "LICENSE"
842  part_name = "selinux_adapter"
843  subsystem_name = "security"
844  relative_install_dir = "selinux/"
845  install_images = [ "system" ]
846}
847
848ohos_prebuilt_etc("updater_config") {
849  deps = [ ":updater_selinux_config" ]
850  source = target_out_dir + "/updater/config"
851  license_file = "LICENSE"
852  part_name = "selinux_adapter"
853  subsystem_name = "security"
854  relative_install_dir = "selinux/"
855  install_images = [ "updater" ]
856}
857
858ohos_prebuilt_etc("sehap_contexts") {
859  deps = [ ":build_contexts" ]
860  source = target_out_dir + "/sehap_contexts"
861  license_file = "LICENSE"
862  part_name = "selinux_adapter"
863  subsystem_name = "security"
864  relative_install_dir = "selinux/targeted/contexts/"
865}
866
867ohos_prebuilt_etc("parameter_contexts") {
868  deps = [ ":build_contexts" ]
869  source = target_out_dir + "/parameter_contexts"
870  license_file = "LICENSE"
871  part_name = "selinux_adapter"
872  subsystem_name = "security"
873  relative_install_dir = "selinux/targeted/contexts/"
874  if (selinux_adapter_components == "vendor") {
875    install_images = [ "vendor" ]
876  } else {
877    install_images = [
878      "system",
879      "updater",
880    ]
881  }
882}
883
884ohos_prebuilt_etc("service_contexts") {
885  deps = [ ":build_contexts" ]
886  source = target_out_dir + "/service_contexts"
887  license_file = "LICENSE"
888  part_name = "selinux_adapter"
889  subsystem_name = "security"
890  relative_install_dir = "selinux/targeted/contexts/"
891  if (selinux_adapter_components == "vendor") {
892    install_images = [ "vendor" ]
893  } else {
894    install_images = [ "system" ]
895  }
896}
897
898ohos_prebuilt_etc("hdf_service_contexts") {
899  deps = [ ":build_contexts" ]
900  source = target_out_dir + "/hdf_service_contexts"
901  license_file = "LICENSE"
902  part_name = "selinux_adapter"
903  subsystem_name = "security"
904  relative_install_dir = "selinux/targeted/contexts/"
905  if (selinux_adapter_components == "vendor") {
906    install_images = [ "vendor" ]
907  } else {
908    install_images = [ "system" ]
909  }
910}
911
912ohos_prebuilt_etc("file_contexts") {
913  deps = [ ":build_contexts" ]
914  source = target_out_dir + "/file_contexts"
915  license_file = "LICENSE"
916  part_name = "selinux_adapter"
917  subsystem_name = "security"
918  relative_install_dir = "selinux/targeted/contexts/"
919  if (selinux_adapter_components == "vendor") {
920    install_images = [ "vendor" ]
921  } else {
922    install_images = [ "system" ]
923  }
924}
925
926ohos_prebuilt_etc("ignore_cfg") {
927  deps = [ ":build_ignore_cfg" ]
928  source = target_out_dir + "/ignore_cfg"
929  license_file = "LICENSE"
930  part_name = "selinux_adapter"
931  subsystem_name = "security"
932  relative_install_dir = "selinux/"
933  if (selinux_adapter_components == "vendor") {
934    install_images = [ "vendor" ]
935  } else {
936    install_images = [ "system" ]
937  }
938}
939
940ohos_prebuilt_etc("file_contexts_updater") {
941  deps = [ ":build_updater_contexts" ]
942  source = target_out_dir + "/updater/file_contexts"
943  license_file = "LICENSE"
944  part_name = "selinux_adapter"
945  subsystem_name = "security"
946  relative_install_dir = "selinux/targeted/contexts/"
947  if (selinux_adapter_components == "vendor") {
948    install_images = [ "updater_vendor" ]
949  } else {
950    install_images = [ "updater" ]
951  }
952}
953
954ohos_prebuilt_etc("vendor_cil") {
955  deps = [ ":build_policy" ]
956  source = target_out_dir + "/vendor.cil"
957  license_file = "LICENSE"
958  part_name = "selinux_adapter"
959  subsystem_name = "security"
960  relative_install_dir = "selinux/"
961  install_images = [ "vendor" ]
962}
963
964if (selinux_adapter_components == "vendor") {
965  ohos_prebuilt_etc("vendor_common_cil") {
966    deps = [ ":build_policy" ]
967    source = target_out_dir + "/vendor_common.cil"
968    license_file = "LICENSE"
969    part_name = "selinux_adapter"
970    subsystem_name = "security"
971    relative_install_dir = "selinux/"
972    install_images = [ "vendor" ]
973  }
974}
975
976ohos_prebuilt_etc("public_cil") {
977  deps = [ ":build_policy" ]
978  source = target_out_dir + "/public.cil"
979  license_file = "LICENSE"
980  part_name = "selinux_adapter"
981  subsystem_name = "security"
982  relative_install_dir = "selinux/"
983  install_images = [ "vendor" ]
984}
985
986if (selinux_adapter_components == "vendor") {
987  ohos_prebuilt_etc("public_common_cil") {
988    deps = [ ":build_policy" ]
989    source = target_out_dir + "/public_common.cil"
990    license_file = "LICENSE"
991    part_name = "selinux_adapter"
992    subsystem_name = "security"
993    relative_install_dir = "selinux/"
994    install_images = [ "vendor" ]
995  }
996}
997
998ohos_prebuilt_etc("version_cil") {
999  deps = [ ":build_policy" ]
1000  source =
1001      target_out_dir + "/compatible/$selinux_adapter_vendor_policy_version.cil"
1002  license_file = "LICENSE"
1003  part_name = "selinux_adapter"
1004  subsystem_name = "security"
1005  relative_install_dir = "selinux/compatible/"
1006  install_images = [ "system" ]
1007}
1008
1009ohos_prebuilt_etc("prebuild_sepolicy_system_cil_sha256") {
1010  deps = [ ":build_policy" ]
1011  source = target_out_dir + "/prebuild_sepolicy.system.cil.sha256"
1012  license_file = "LICENSE"
1013  part_name = "selinux_adapter"
1014  subsystem_name = "security"
1015  relative_install_dir = "selinux/"
1016  install_images = [ "vendor" ]
1017}
1018
1019ohos_prebuilt_etc("system_cil") {
1020  deps = [ ":build_policy" ]
1021  source = target_out_dir + "/system.cil"
1022  license_file = "LICENSE"
1023  part_name = "selinux_adapter"
1024  subsystem_name = "security"
1025  relative_install_dir = "selinux/"
1026  install_images = [ "system" ]
1027}
1028
1029if (selinux_adapter_components == "system") {
1030  ohos_prebuilt_etc("system_common_cil") {
1031    deps = [ ":build_policy" ]
1032    source = target_out_dir + "/system_common.cil"
1033    license_file = "LICENSE"
1034    part_name = "selinux_adapter"
1035    subsystem_name = "security"
1036    relative_install_dir = "selinux/"
1037    install_images = [ "system" ]
1038  }
1039}
1040
1041ohos_prebuilt_etc("system_cil_sha256") {
1042  deps = [ ":build_policy" ]
1043  source = target_out_dir + "/system.cil.sha256"
1044  license_file = "LICENSE"
1045  part_name = "selinux_adapter"
1046  subsystem_name = "security"
1047  relative_install_dir = "selinux/"
1048  install_images = [ "system" ]
1049}
1050
1051if (selinux_adapter_support_developer_mode) {
1052  ohos_prebuilt_etc("system_developer_cil") {
1053    deps = [ ":build_policy" ]
1054    source = target_out_dir + "/developer/system.cil"
1055    output = "system_developer.cil"
1056    license_file = "LICENSE"
1057    part_name = "selinux_adapter"
1058    subsystem_name = "security"
1059    relative_install_dir = "selinux/"
1060    install_images = [ "system" ]
1061  }
1062
1063  ohos_prebuilt_etc("vendor_developer_cil") {
1064    deps = [ ":build_policy" ]
1065    source = target_out_dir + "/developer/vendor.cil"
1066    output = "vendor_developer.cil"
1067    license_file = "LICENSE"
1068    part_name = "selinux_adapter"
1069    subsystem_name = "security"
1070    relative_install_dir = "selinux/"
1071    install_images = [ "vendor" ]
1072  }
1073
1074  ohos_prebuilt_etc("public_developer_cil") {
1075    deps = [ ":build_policy" ]
1076    source = target_out_dir + "/developer/public.cil"
1077    output = "public_developer.cil"
1078    license_file = "LICENSE"
1079    part_name = "selinux_adapter"
1080    subsystem_name = "security"
1081    relative_install_dir = "selinux/"
1082    install_images = [ "vendor" ]
1083  }
1084
1085  ohos_prebuilt_etc("version_developer_cil") {
1086    deps = [ ":build_policy" ]
1087    source = target_out_dir +
1088             "/developer/compatible/$selinux_adapter_vendor_policy_version.cil"
1089    license_file = "LICENSE"
1090    part_name = "selinux_adapter"
1091    subsystem_name = "security"
1092    relative_install_dir = "selinux/compatible_developer/"
1093    install_images = [ "system" ]
1094  }
1095
1096  ohos_prebuilt_etc("developer_policy") {
1097    deps = [ ":build_policy" ]
1098    source = target_out_dir + "/developer/policy.31"
1099    output = "developer_policy"
1100    license_file = "LICENSE"
1101    part_name = "selinux_adapter"
1102    subsystem_name = "security"
1103    if (selinux_adapter_components == "vendor") {
1104      relative_install_dir = "selinux/prebuild_sepolicy/"
1105      install_images = [ "vendor" ]
1106    } else if (selinux_adapter_components == "default") {
1107      relative_install_dir = "selinux/targeted/policy/"
1108      install_images = [ "system" ]
1109    }
1110  }
1111
1112  ohos_prebuilt_etc("prebuild_sepolicy_system_developer_cil_sha256") {
1113    deps = [ ":build_policy" ]
1114    source = target_out_dir + "/developer/prebuild_sepolicy.system.cil.sha256"
1115    output = "prebuild_sepolicy.system_developer.cil.sha256"
1116    license_file = "LICENSE"
1117    part_name = "selinux_adapter"
1118    subsystem_name = "security"
1119    relative_install_dir = "selinux/"
1120    install_images = [ "vendor" ]
1121  }
1122
1123  ohos_prebuilt_etc("system_developer_cil_sha256") {
1124    deps = [ ":build_policy" ]
1125    source = target_out_dir + "/developer/system.cil.sha256"
1126    output = "system_developer.cil.sha256"
1127    license_file = "LICENSE"
1128    part_name = "selinux_adapter"
1129    subsystem_name = "security"
1130    relative_install_dir = "selinux/"
1131    install_images = [ "system" ]
1132  }
1133}
1134
1135if (build_selinux && !ohos_indep_compiler_enable) {
1136  ohos_copy("libselinux_toolchain") {
1137    external_deps = [ "selinux:libselinux($host_toolchain)" ]
1138    sources =
1139        [ "$root_build_dir/clang_${host_cpu}/thirdparty/selinux/libselinux.so" ]
1140    outputs =
1141        [ "$root_build_dir/clang_${host_cpu}/security/selinux/libselinux.so" ]
1142    part_name = "selinux_adapter"
1143    subsystem_name = "security"
1144  }
1145
1146  ohos_copy("libpcre2_toolchain") {
1147    external_deps = [ "pcre2:libpcre2($host_toolchain)" ]
1148    sources =
1149        [ "$root_build_dir/clang_${host_cpu}/thirdparty/pcre2/libpcre2.so" ]
1150    outputs =
1151        [ "$root_build_dir/clang_${host_cpu}/security/selinux/libpcre2.so" ]
1152    part_name = "selinux_adapter"
1153    subsystem_name = "security"
1154  }
1155}
1156
1157ohos_copy("filecontexts_toolchain") {
1158  deps = [ ":build_contexts" ]
1159  sources = [ "$target_out_dir/file_contexts.bin" ]
1160  outputs = [ "$target_out_dir/../security/selinux/file_contexts.bin" ]
1161  part_name = "selinux_adapter"
1162  subsystem_name = "security"
1163}
1164
1165if (selinux_adapter_components != "default") {
1166  copy("eng_system_compatible") {
1167    deps = [ ":build_policy" ]
1168    sources = [ "$target_out_dir/compatible" ]
1169    outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/compatible" ]
1170  }
1171
1172  copy("eng_system_compatible_developer") {
1173    deps = [ ":build_policy" ]
1174    sources = [ "$target_out_dir/developer/compatible" ]
1175    outputs = [
1176      "$root_out_dir/$eng_system_base_dir/etc/selinux/compatible_developer",
1177    ]
1178  }
1179
1180  copy("eng_system_system_cil") {
1181    deps = [ ":build_policy" ]
1182    sources = [ "$target_out_dir/system.cil" ]
1183    outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system.cil" ]
1184  }
1185
1186  copy("eng_system_system_cil_sha256") {
1187    deps = [ ":build_policy" ]
1188    sources = [ "$target_out_dir/system.cil.sha256" ]
1189    outputs =
1190        [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system.cil.sha256" ]
1191  }
1192
1193  copy("eng_system_system_common_cil") {
1194    deps = [ ":build_policy" ]
1195    sources = [ "$target_out_dir/system_common.cil" ]
1196    outputs =
1197        [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system_common.cil" ]
1198  }
1199
1200  copy("eng_system_system_developer_cil") {
1201    deps = [ ":build_policy" ]
1202    sources = [ "$target_out_dir/developer/system.cil" ]
1203    outputs = [
1204      "$root_out_dir/$eng_system_base_dir/etc/selinux/system_developer.cil",
1205    ]
1206  }
1207
1208  copy("eng_system_system_developer_cil_sha256") {
1209    deps = [ ":build_policy" ]
1210    sources = [ "$target_out_dir/developer/system.cil.sha256" ]
1211    outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system_developer.cil.sha256" ]
1212  }
1213
1214  copy("eng_chipset_developer_policy") {
1215    deps = [ ":build_policy" ]
1216    sources = [ "$target_out_dir/developer/policy.31" ]
1217    outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy/developer_policy" ]
1218  }
1219
1220  copy("eng_chipset_policy") {
1221    deps = [ ":build_policy" ]
1222    sources = [ "$target_out_dir/policy.31" ]
1223    outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy/policy.31" ]
1224  }
1225
1226  copy("eng_chipset_system_cil_sha256") {
1227    deps = [ ":build_policy" ]
1228    sources = [ "$target_out_dir/prebuild_sepolicy.system.cil.sha256" ]
1229    outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy.system.cil.sha256" ]
1230  }
1231
1232  copy("eng_chipset_system_developer_cil_sha256") {
1233    deps = [ ":build_policy" ]
1234    sources =
1235        [ "$target_out_dir/developer/prebuild_sepolicy.system.cil.sha256" ]
1236    outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy.system_developer.cil.sha256" ]
1237  }
1238
1239  copy("eng_chipset_public_cil") {
1240    deps = [ ":build_policy" ]
1241    sources = [ "$target_out_dir/public.cil" ]
1242    outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public.cil" ]
1243  }
1244
1245  copy("eng_chipset_public_common_cil") {
1246    deps = [ ":build_policy" ]
1247    sources = [ "$target_out_dir/public_common.cil" ]
1248    outputs =
1249        [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public_common.cil" ]
1250  }
1251
1252  copy("eng_chipset_public_developer_cil") {
1253    deps = [ ":build_policy" ]
1254    sources = [ "$target_out_dir/developer/public.cil" ]
1255    outputs = [
1256      "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public_developer.cil",
1257    ]
1258  }
1259
1260  copy("eng_chipset_vendor_cil") {
1261    deps = [ ":build_policy" ]
1262    sources = [ "$target_out_dir/vendor.cil" ]
1263    outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor.cil" ]
1264  }
1265
1266  copy("eng_chipset_vendor_common_cil") {
1267    deps = [ ":build_policy" ]
1268    sources = [ "$target_out_dir/vendor_common.cil" ]
1269    outputs =
1270        [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor_common.cil" ]
1271  }
1272
1273  copy("eng_chipset_vendor_developer_cil") {
1274    deps = [ ":build_policy" ]
1275    sources = [ "$target_out_dir/developer/vendor.cil" ]
1276    outputs = [
1277      "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor_developer.cil",
1278    ]
1279  }
1280
1281  group("eng_system_selinux_group") {
1282    deps = [
1283      ":eng_system_compatible",
1284      ":eng_system_compatible_developer",
1285      ":eng_system_system_cil",
1286      ":eng_system_system_cil_sha256",
1287      ":eng_system_system_common_cil",
1288      ":eng_system_system_developer_cil",
1289      ":eng_system_system_developer_cil_sha256",
1290      ":filecontexts_toolchain",
1291    ]
1292  }
1293
1294  group("eng_chipset_selinux_group") {
1295    deps = [
1296      ":eng_chipset_developer_policy",
1297      ":eng_chipset_policy",
1298      ":eng_chipset_public_cil",
1299      ":eng_chipset_public_common_cil",
1300      ":eng_chipset_public_developer_cil",
1301      ":eng_chipset_system_cil_sha256",
1302      ":eng_chipset_system_developer_cil_sha256",
1303      ":eng_chipset_vendor_cil",
1304      ":eng_chipset_vendor_common_cil",
1305      ":eng_chipset_vendor_developer_cil",
1306      ":filecontexts_toolchain",
1307    ]
1308  }
1309}
1310
1311group("selinux_group") {
1312  if (build_selinux) {
1313    if (!ohos_indep_compiler_enable) {
1314      deps = [
1315        ":build_updater_sepolicy",
1316        ":config",
1317        ":file_contexts",
1318        ":file_contexts_updater",
1319        ":filecontexts_toolchain",
1320        ":hap_restorecon",
1321        ":hdf_service_contexts",
1322        ":ignore_cfg",
1323        ":libpcre2_toolchain",
1324        ":libselinux_toolchain",
1325        ":load_policy",
1326        ":param_check",
1327        ":parameter_contexts",
1328        ":restorecon",
1329        ":sehap_contexts",
1330        ":selinux_check",
1331        ":service_check",
1332        ":service_contexts",
1333        ":updater_config",
1334      ]
1335      external_deps = [
1336        "selinux:checkpolicy($host_toolchain)",
1337        "selinux:chkcon",
1338        "selinux:getenforce",
1339        "selinux:getfilecon",
1340        "selinux:getpidcon",
1341        "selinux:secilc",
1342        "selinux:secilc($host_toolchain)",
1343        "selinux:sefcontext_compile($host_toolchain)",
1344        "selinux:selinux_check_access",
1345        "selinux:selinuxexeccon",
1346        "selinux:setenforce",
1347        "selinux:setfilecon",
1348      ]
1349      if (selinux_adapter_components == "system") {
1350        deps += [
1351          ":system_cil",
1352          ":system_cil_sha256",
1353          ":system_common_cil",
1354          ":version_cil",
1355        ]
1356        if (selinux_adapter_support_developer_mode) {
1357          deps += [
1358            ":system_developer_cil",
1359            ":system_developer_cil_sha256",
1360            ":version_developer_cil",
1361          ]
1362        }
1363      } else if (selinux_adapter_components == "vendor") {
1364        deps += [
1365          ":build_sepolicy",
1366          ":prebuild_sepolicy_system_cil_sha256",
1367          ":public_cil",
1368          ":public_common_cil",
1369          ":selinux_version",
1370          ":vendor_cil",
1371          ":vendor_common_cil",
1372        ]
1373        if (selinux_adapter_support_developer_mode) {
1374          deps += [
1375            ":developer_policy",
1376            ":prebuild_sepolicy_system_developer_cil_sha256",
1377            ":public_developer_cil",
1378            ":vendor_developer_cil",
1379          ]
1380        }
1381      } else {
1382        deps += [ ":build_sepolicy" ]
1383        if (selinux_adapter_support_developer_mode) {
1384          deps += [ ":developer_policy" ]
1385        }
1386      }
1387    } else {
1388      deps = [
1389        ":hap_restorecon",
1390        ":load_policy",
1391        ":param_check",
1392        ":restorecon",
1393        ":service_check",
1394      ]
1395    }
1396  }
1397}
1398