blob: 3ef01151da07739277f6608993511747fef3a7ee [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",
43 "getaddr.c",
44 "icmp.c",
45 "ipv4.c",
46 "ipv6.c",
47 "logging.c",
Lorenzo Colittieb92f482019-01-04 14:59:11 +090048 "translate.c",
49 ],
50}
51
52// The clat daemon.
53cc_binary {
54 name: "clatd",
55 defaults: ["clatd_defaults"],
Hungming Chen98e86fa2022-01-05 19:14:53 +080056 // TODO: remove once drop_root_and_caps() is removed.
57 header_libs: [
58 "libcutils_headers", // for AID_CLAT
59 ],
Lorenzo Colittieb92f482019-01-04 14:59:11 +090060 srcs: [
61 ":clatd_common",
62 "main.c"
63 ],
Lorenzo Colittia4e96812021-12-09 17:36:58 +090064 static_libs: [
Lorenzo Colitti0cd5aa52021-12-09 15:05:52 +090065 "libip_checksum",
Lorenzo Colittia4e96812021-12-09 17:36:58 +090066 ],
Dan Willemsen1e562182018-11-16 12:52:08 -080067 shared_libs: [
Dan Willemsen1e562182018-11-16 12:52:08 -080068 "liblog",
Dan Willemsen1e562182018-11-16 12:52:08 -080069 ],
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090070
Hungming Chen03486e02022-01-07 18:13:20 +080071 // Static libc++ for smaller apex size while shipping clatd in the mainline module.
72 // See b/213123047
73 stl: "libc++_static",
74
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090075 // Only enable clang-tidy for the daemon, not the tests, because enabling it for the
76 // tests substantially increases build/compile cycle times and doesn't really provide a
77 // security benefit.
78 tidy: true,
79 tidy_checks: [
80 "-*",
81 "cert-*",
82 "clang-analyzer-security*",
83 "android-*",
84 ],
85 tidy_flags: [
86 "-warnings-as-errors=clang-analyzer-security*,cert-*,android-*",
87 ],
Lorenzo Colitti92928722021-01-18 17:40:34 +090088 // Actually not required for clatd itself. See comments in the rc file.
89 init_rc: [
90 "vendor-464xlat.rc",
91 ],
Evgenii Stepanovafe05e12021-05-21 16:33:45 -070092 sanitize: {
93 memtag_heap: true,
94 },
Hungming Chen07125612021-12-16 12:38:34 +080095
96 apex_available: [
97 "com.android.tethering",
98 "//apex_available:platform",
99 ],
100 min_sdk_version: "30",
Dan Willemsen1e562182018-11-16 12:52:08 -0800101}
102
Dan Willemsen1e562182018-11-16 12:52:08 -0800103// Unit tests.
104cc_test {
105 name: "clatd_test",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900106 defaults: ["clatd_defaults"],
Dan Willemsen1e562182018-11-16 12:52:08 -0800107 srcs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900108 ":clatd_common",
109 "clatd_test.cpp"
Dan Willemsen1e562182018-11-16 12:52:08 -0800110 ],
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900111 static_libs: [
112 "libbase",
Lorenzo Colitti0cd5aa52021-12-09 15:05:52 +0900113 "libip_checksum",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900114 "libnetd_test_tun_interface",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900115 ],
Dan Willemsen1e562182018-11-16 12:52:08 -0800116 shared_libs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900117 "libcutils",
Dan Willemsen1e562182018-11-16 12:52:08 -0800118 "liblog",
119 "libnetutils",
120 ],
Lorenzo Colitti33351932019-01-04 19:36:51 +0900121 test_suites: ["device-tests"],
Maciej Żenczykowski76f4b742019-09-19 14:38:34 -0700122 require_root: true,
Dan Willemsen1e562182018-11-16 12:52:08 -0800123}