blob: 595c6b924db9bbf3c818c07763ff8a9ee61bf537 [file] [log] [blame]
Bob Badour370808d2021-02-12 14:17:41 -08001package {
2 default_applicable_licenses: ["external_android-clat_license"],
3}
4
5// Added automatically by a large-scale-change
6//
7// large-scale-change included anything that looked like it might be a license
8// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
9//
10// Please consider removing redundant or irrelevant files from 'license_text:'.
11// See: http://go/android-license-faq
12license {
13 name: "external_android-clat_license",
14 visibility: [":__subpackages__"],
15 license_kinds: [
16 "SPDX-license-identifier-Apache-2.0",
17 ],
18 license_text: [
19 "LICENSE",
20 "NOTICE",
21 ],
22}
23
Lorenzo Colittieb92f482019-01-04 14:59:11 +090024cc_defaults {
25 name: "clatd_defaults",
Dan Willemsen1e562182018-11-16 12:52:08 -080026
27 cflags: [
28 "-Wall",
29 "-Werror",
30 "-Wunused-parameter",
31
32 // Bug: http://b/33566695
33 "-Wno-address-of-packed-member",
34 ],
Lorenzo Colittieb92f482019-01-04 14:59:11 +090035}
36
37// Code used both by the daemon and by unit tests.
38filegroup {
39 name: "clatd_common",
40 srcs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +090041 "clatd.c",
Lorenzo Colittieb92f482019-01-04 14:59:11 +090042 "dump.c",
Lorenzo Colittieb92f482019-01-04 14:59:11 +090043 "icmp.c",
44 "ipv4.c",
45 "ipv6.c",
46 "logging.c",
Lorenzo Colittieb92f482019-01-04 14:59:11 +090047 "translate.c",
48 ],
49}
50
51// The clat daemon.
52cc_binary {
53 name: "clatd",
54 defaults: ["clatd_defaults"],
55 srcs: [
56 ":clatd_common",
57 "main.c"
58 ],
Lorenzo Colittia4e96812021-12-09 17:36:58 +090059 static_libs: [
Lorenzo Colitti0cd5aa52021-12-09 15:05:52 +090060 "libip_checksum",
Lorenzo Colittia4e96812021-12-09 17:36:58 +090061 ],
Dan Willemsen1e562182018-11-16 12:52:08 -080062 shared_libs: [
Dan Willemsen1e562182018-11-16 12:52:08 -080063 "liblog",
Dan Willemsen1e562182018-11-16 12:52:08 -080064 ],
Hungming Chenef9f62b2022-01-11 15:51:28 +080065 relative_install_path: "for-system",
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090066
Hungming Chen03486e02022-01-07 18:13:20 +080067 // Static libc++ for smaller apex size while shipping clatd in the mainline module.
68 // See b/213123047
69 stl: "libc++_static",
70
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090071 // Only enable clang-tidy for the daemon, not the tests, because enabling it for the
72 // tests substantially increases build/compile cycle times and doesn't really provide a
73 // security benefit.
74 tidy: true,
75 tidy_checks: [
76 "-*",
77 "cert-*",
78 "clang-analyzer-security*",
Chih-Hung Hsieh3abac002022-04-04 04:23:34 -070079 // b/2043314, warnings on memcpy_s, memset_s, snprintf_s calls
80 // are blocking the migration from gnu99 to gnu11.
81 // Until those warnings are fixed, disable these checks.
82 "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090083 "android-*",
84 ],
Chih-Hung Hsieh3abac002022-04-04 04:23:34 -070085 tidy_checks_as_errors: [
86 "clang-analyzer-security*",
87 "cert-*",
88 "android-*",
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090089 ],
Hungming Chen07125612021-12-16 12:38:34 +080090
91 apex_available: [
92 "com.android.tethering",
93 "//apex_available:platform",
94 ],
95 min_sdk_version: "30",
Dan Willemsen1e562182018-11-16 12:52:08 -080096}
97
Dan Willemsen1e562182018-11-16 12:52:08 -080098// Unit tests.
99cc_test {
100 name: "clatd_test",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900101 defaults: ["clatd_defaults"],
Dan Willemsen1e562182018-11-16 12:52:08 -0800102 srcs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900103 ":clatd_common",
104 "clatd_test.cpp"
Dan Willemsen1e562182018-11-16 12:52:08 -0800105 ],
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900106 static_libs: [
107 "libbase",
Lorenzo Colitti0cd5aa52021-12-09 15:05:52 +0900108 "libip_checksum",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900109 "libnetd_test_tun_interface",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900110 ],
Dan Willemsen1e562182018-11-16 12:52:08 -0800111 shared_libs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900112 "libcutils",
Dan Willemsen1e562182018-11-16 12:52:08 -0800113 "liblog",
114 "libnetutils",
115 ],
Lorenzo Colitti33351932019-01-04 19:36:51 +0900116 test_suites: ["device-tests"],
Maciej Żenczykowski76f4b742019-09-19 14:38:34 -0700117 require_root: true,
Dan Willemsen1e562182018-11-16 12:52:08 -0800118}