1// Copyright (C) 2020 The Android Open Source Project
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// List of clang-tidy checks that are reported as errors.
15// Please keep this list ordered lexicographically.
16
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "system_security_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["system_security_license"],
24}
25
26tidy_errors = [
27  "cert-err34-c",
28  "google-default-arguments",
29  "google-runtime-int",
30  "google-runtime-member-string-references",
31  "misc-move-const-arg",
32  "misc-move-forwarding-reference",
33  "misc-unused-parameters",
34  "misc-unused-using-decls",
35  "misc-use-after-move",
36  "modernize-pass-by-value",
37  "performance-faster-string-find",
38  "performance-for-range-copy",
39  "performance-implicit-conversion-in-loop",
40  "performance-inefficient-vector-operation",
41  "performance-move-const-arg",
42  "performance-move-constructor-init",
43  "performance-noexcept-move-constructor",
44  "performance-unnecessary-value-param",
45]
46
47cc_defaults {
48  cpp_std: "experimental",
49  name: "odsign_flags_defaults",
50  cflags: [
51    "-Wall",
52    "-Wextra",
53    "-Werror",
54    "-Wno-unused-parameter",
55
56    // Some extra flags.
57    "-fstrict-aliasing",
58    "-Wredundant-decls",
59    "-Wshadow",
60    "-Wstrict-aliasing",
61    "-Wthread-safety",
62    "-Wthread-safety-negative",
63    "-Wunreachable-code",
64    "-Wunreachable-code-break",
65    "-Wunreachable-code-return",
66    "-Wunused",
67    "-Wused-but-marked-unused",
68  ],
69  tidy: true,
70  tidy_checks: tidy_errors,
71  tidy_checks_as_errors: tidy_errors,
72  tidy_flags: [
73    "-format-style=file",
74  ],
75}
76
77cc_binary {
78  name: "odsign",
79  defaults: [
80    "odsign_flags_defaults",
81  ],
82  cpp_std: "experimental",
83  init_rc: ["odsign.rc"],
84  srcs: [
85    "odsign_main.cpp",
86    "CertUtils.cpp",
87    "KeystoreKey.cpp",
88    "KeystoreHmacKey.cpp",
89    "VerityUtils.cpp",
90  ],
91
92  header_libs: ["odrefresh_headers"],
93
94  static_libs: [
95    "libc++fs",
96    "lib_odsign_proto",
97  ],
98
99  shared_libs: [
100    "android.system.keystore2-V1-cpp",
101    "android.hardware.security.keymint-V1-cpp",
102    "libbase",
103    "libbinder",
104    "libcrypto",
105    "libcrypto_utils",
106    "libfsverity",
107    "liblogwrap",
108    "libprotobuf-cpp-full",
109    "libutils",
110  ],
111}
112