blob: 4a5ba15f66476911c755b2a8ddb37f734a8cfec1 [file] [log] [blame]
Bob Badour92ecf7c2021-02-12 18:05:29 -08001package {
Etienne Ruffieux917abc32022-02-28 14:07:17 +00002 default_visibility: [":__subpackages__"],
Bob Badour92ecf7c2021-02-12 18:05:29 -08003 default_applicable_licenses: ["system_bt_license"],
4}
5
6// Added automatically by a large-scale-change that took the approach of
7// 'apply every license found to every target'. While this makes sure we respect
8// every license restriction, it may not be entirely correct.
9//
10// e.g. GPL in an MIT project might only apply to the contrib/ directory.
11//
12// Please consider splitting the single license below into multiple licenses,
13// taking care not to lose any license_kind information, and overriding the
14// default license using the 'licenses: [...]' property on targets as needed.
15//
16// For unused files, consider creating a 'fileGroup' with "//visibility:private"
17// to attach the license to, and including a comment whether the files may be
18// used in the current project.
19// See: http://go/android-license-faq
20license {
21 name: "system_bt_license",
22 visibility: [":__subpackages__"],
23 license_kinds: [
24 "SPDX-license-identifier-Apache-2.0",
25 "SPDX-license-identifier-BSD",
26 "SPDX-license-identifier-MIT",
27 "legacy_unencumbered",
28 ],
29 license_text: [
30 "NOTICE",
31 ],
32}
33
Jack Hecac30a22018-08-28 18:28:55 -070034filegroup {
Colin Cross03e29e52019-05-23 14:12:59 -070035 name: "BluetoothTestConfigTemplate",
36 srcs: [
37 "AndroidTestTemplate.xml",
38 ],
Jack Hecac30a22018-08-28 18:28:55 -070039}
David Duartea84ffd12023-03-28 17:58:57 +000040
David Duarte4043a702023-06-04 16:44:03 +000041// This default contains properties that should be common to all the cc targets
42// developed by the Bluetooth team.
43//
44// Be careful when adding new properties here:
45// - The option should not impact negatively any target, for example "-Wno-*"
46// options should not be added here but instead on every targets needing
47// them to avoid allowing adding new warnings in targets that didn't contained
48// them (you can use the bpmodify tool to ease the work of adding this warning
49// everywhere) and also allows cleaning them one at a time.
50//
51// - The option should apply to all the c/c++ code developed by the Bluetooth team:
52// test, tools, fuzzers, etc, not only production targets, if you need to add an option
53// for a subset of Bluetooth cc targets you should look at the defaults including this
54// defaults like "fluoride_defaults" and "gd_defaults".
55//
56// - Try to keep the name as precise as possible to document to the dependent of what
57// this default contains. This also means that if you add a new option that isn't
58// documented by the name of this default, rename it.
59//
William Escande22560942024-09-18 16:44:36 -070060// - Try avoiding adding option that would not fit "future" targets, for example dependencies,
David Duarte4043a702023-06-04 16:44:03 +000061// even if every modules of Bluetooth depends on a specific dependency it should be left out
62// from this default to not push it for future targets that might not need it.
63cc_defaults {
64 name: "bluetooth_cflags",
65 cflags: [
66 "-Wall",
67 "-Werror",
68 "-Wextra",
Henri Chataing22f5e112024-09-21 01:20:25 +000069 "-Wmissing-prototypes",
William Escande27297182023-10-09 17:15:04 -070070 // Override global.go that demote the error to a warning
David Duartec8d2a492024-04-11 18:02:38 +000071 "-Werror=format",
William Escande27297182023-10-09 17:15:04 -070072 "-Werror=reorder-init-list",
David Duarte4043a702023-06-04 16:44:03 +000073 ],
David Duarte19954d12023-08-01 14:07:56 +000074 c_std: "c99",
Myles Watsondbd43e72024-02-15 11:02:58 -080075 cpp_std: "c++20",
David Duarte4043a702023-06-04 16:44:03 +000076}
William Escande22560942024-09-18 16:44:36 -070077
Henri Chataing31dba772024-10-18 14:33:17 -070078// List of tidy checks that are enabled for cc targets.
79// Note that the goal is not to enable all checks, many of them will
80// appear as noise especially in the modernize-* range.
81bluetooth_tidy_checks = [
82 "-*",
83 "misc-*",
84
85 // This check implements detection of local variables which could be declared
86 // as const but are not.
87 "-misc-const-correctness",
88]
89
90// This default tidy checks that will be run against all the cc targets
91// developed by the Bluetooth team.
92cc_defaults {
93 name: "bluetooth_tidy",
94 tidy: true,
95 tidy_checks: bluetooth_tidy_checks,
96 tidy_checks_as_errors: bluetooth_tidy_checks,
97}
98
William Escande22560942024-09-18 16:44:36 -070099java_defaults {
100 name: "bluetooth_errorprone_rules",
101 errorprone: {
102 enabled: true,
103 javacflags: [
104 "-Xep:AlmostJavadoc:ERROR",
105 "-Xep:AlreadyChecked:ERROR",
106 "-Xep:BadImport:ERROR",
107 "-Xep:CatchAndPrintStackTrace:ERROR",
108 "-Xep:CatchFail:ERROR",
109 "-Xep:CheckReturnValue:ERROR",
110 "-Xep:ClassCanBeStatic:ERROR",
111 "-Xep:DateFormatConstant:ERROR",
112 "-Xep:DirectInvocationOnMock:ERROR",
113 "-Xep:EmptyBlockTag:ERROR",
114 "-Xep:EmptyCatch:ERROR",
William Escande023cccb2024-10-17 17:56:01 -0700115 "-Xep:EnumOrdinal:ERROR",
William Escande22560942024-09-18 16:44:36 -0700116 "-Xep:EqualsGetClass:ERROR",
117 "-Xep:EqualsHashCode:ERROR",
118 "-Xep:EqualsIncompatibleType:ERROR",
119 "-Xep:FallThrough:ERROR",
120 "-Xep:Finalize:ERROR",
121 "-Xep:FutureReturnValueIgnored:ERROR",
122 "-Xep:GuardedBy:ERROR",
123 "-Xep:HidingField:ERROR",
124 "-Xep:InconsistentHashCode:ERROR",
125 "-Xep:InlineFormatString:ERROR",
126 "-Xep:InlineMeInliner:ERROR",
127 "-Xep:InvalidBlockTag:ERROR",
128 "-Xep:InvalidInlineTag:ERROR",
129 "-Xep:InvalidParam:ERROR",
130 "-Xep:JavaUtilDate:ERROR",
131 "-Xep:JdkObsolete:ERROR",
132 "-Xep:LockOnNonEnclosingClassLiteral:ERROR",
133 "-Xep:LongFloatConversion:ERROR",
134 "-Xep:LoopOverCharArray:ERROR",
135 "-Xep:MissingCasesInEnumSwitch:ERROR",
136 "-Xep:MixedMutabilityReturnType:ERROR",
137 "-Xep:MockNotUsedInProduction:ERROR",
138 "-Xep:ModifiedButNotUsed:ERROR",
139 "-Xep:ModifyCollectionInEnhancedForLoop:ERROR",
140 "-Xep:NarrowCalculation:ERROR",
141 "-Xep:NarrowingCompoundAssignment:ERROR",
142 "-Xep:NonApiType:ERROR",
143 "-Xep:NonAtomicVolatileUpdate:ERROR",
144 "-Xep:NonCanonicalType:ERROR",
145 "-Xep:NotJavadoc:ERROR",
146 "-Xep:ObjectEqualsForPrimitives:ERROR",
147 "-Xep:OperatorPrecedence:ERROR",
148 "-Xep:ReferenceEquality:ERROR",
149 "-Xep:ReturnAtTheEndOfVoidFunction:ERROR",
150 "-Xep:StaticAssignmentInConstructor:ERROR",
151 "-Xep:StaticGuardedByInstance:ERROR",
152 "-Xep:StringCaseLocaleUsage:ERROR",
153 "-Xep:StringCharset:ERROR",
154 "-Xep:SynchronizeOnNonFinalField:ERROR",
155 "-Xep:ToStringReturnsNull:ERROR",
156 "-Xep:TruthConstantAsserts:ERROR",
157 "-Xep:TruthIncompatibleType:ERROR",
158 "-Xep:UndefinedEquals:ERROR",
159 "-Xep:UnnecessaryAssignment:ERROR",
160 "-Xep:UnnecessaryAsync:ERROR",
161 "-Xep:UnnecessaryStringBuilder:ERROR",
162 "-Xep:UnrecognisedJavadocTag:ERROR",
163 "-Xep:UnusedMethod:ERROR",
164 "-Xep:UnusedNestedClass:ERROR",
165 "-Xep:UnusedVariable:ERROR",
166 "-Xep:WaitNotInLoop:ERROR",
167 "-Xep:WakelockReleasedDangerously:ERROR",
168
169 // Exclude generated files
170 "-XepExcludedPaths:.*/srcjars/.*",
171
William Escandebed62da2024-10-21 14:16:20 -0700172 // The @InlineMe annotation could be made available, but it would
173 // apply on external facing API. This is not desired. For more
174 // context, see https://r.android.com/3303475
175 "-Xep:InlineMeSuggester:OFF",
William Escande22560942024-09-18 16:44:36 -0700176 ],
177 },
178}
179
180java_defaults {
181 name: "bluetooth_framework_errorprone_rules",
182 defaults: ["bluetooth_errorprone_rules"],
183 plugins: [
184 "error_prone_android_framework",
185 ],
186 errorprone: {
187 javacflags: [
188 "-Xep:AndroidFrameworkBinderIdentity:ERROR",
189 "-Xep:AndroidFrameworkBluetoothPermission:ERROR",
190 "-Xep:AndroidFrameworkCompatChange:ERROR",
191 "-Xep:AndroidFrameworkEfficientParcelable:ERROR",
192 "-Xep:AndroidFrameworkEfficientStrings:ERROR",
193 "-Xep:AndroidFrameworkPendingIntentMutability:ERROR",
194 "-Xep:AndroidFrameworkRequiresPermission:ERROR",
195 "-Xep:AndroidFrameworkRethrowFromSystem:ERROR",
196 "-Xep:AndroidFrameworkTargetSdk:ERROR",
197 "-Xep:AndroidHideInComments:ERROR",
198
199 // After fixing this errorprone, we decided to not merge the change.
200 // It is not very readable and the benefits are minimal when looking
201 // at the size of the maps used in the Bluetooth application.
202 // See https://r.android.com/3200511
203 "-Xep:AndroidFrameworkEfficientCollections:OFF",
204
205 // Does not look pertinent in our situation
206 "-Xep:AndroidFrameworkEfficientXml:OFF",
207 ],
208 },
209}