1package { 2 default_visibility: [":__subpackages__"], 3 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 34filegroup { 35 name: "BluetoothTestConfigTemplate", 36 srcs: [ 37 "AndroidTestTemplate.xml", 38 ], 39} 40 41// 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// 60// - Try avoiding adding option that would not fit "future" targets, for example dependencies, 61// 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", 69 "-Wmissing-prototypes", 70 // Override global.go that demote the error to a warning 71 "-Werror=format", 72 "-Werror=reorder-init-list", 73 ], 74 c_std: "c99", 75 cpp_std: "c++20", 76} 77 78// 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 // Finds classes that contain non-static data members in addition to user-declared 90 // non-static member functions and diagnose all data members declared with a 91 // non-public access specifier. 92 "-misc-non-private-member-variables-in-classes", 93] 94 95// This default tidy checks that will be run against all the cc targets 96// developed by the Bluetooth team. 97cc_defaults { 98 name: "bluetooth_tidy", 99 tidy: true, 100 tidy_checks: bluetooth_tidy_checks, 101 tidy_checks_as_errors: bluetooth_tidy_checks, 102} 103 104java_defaults { 105 name: "bluetooth_errorprone_rules", 106 errorprone: { 107 enabled: true, 108 javacflags: [ 109 "-Xep:AlmostJavadoc:ERROR", 110 "-Xep:AlreadyChecked:ERROR", 111 "-Xep:BadImport:ERROR", 112 "-Xep:CatchAndPrintStackTrace:ERROR", 113 "-Xep:CatchFail:ERROR", 114 "-Xep:CheckReturnValue:ERROR", 115 "-Xep:ClassCanBeStatic:ERROR", 116 "-Xep:DateFormatConstant:ERROR", 117 "-Xep:DirectInvocationOnMock:ERROR", 118 "-Xep:EmptyBlockTag:ERROR", 119 "-Xep:EmptyCatch:ERROR", 120 "-Xep:EnumOrdinal:ERROR", 121 "-Xep:EqualsGetClass:ERROR", 122 "-Xep:EqualsHashCode:ERROR", 123 "-Xep:EqualsIncompatibleType:ERROR", 124 "-Xep:FallThrough:ERROR", 125 "-Xep:Finalize:ERROR", 126 "-Xep:FutureReturnValueIgnored:ERROR", 127 "-Xep:GuardedBy:ERROR", 128 "-Xep:HidingField:ERROR", 129 "-Xep:InconsistentHashCode:ERROR", 130 "-Xep:InlineFormatString:ERROR", 131 "-Xep:InlineMeInliner:ERROR", 132 "-Xep:InvalidBlockTag:ERROR", 133 "-Xep:InvalidInlineTag:ERROR", 134 "-Xep:InvalidParam:ERROR", 135 "-Xep:JavaUtilDate:ERROR", 136 "-Xep:JdkObsolete:ERROR", 137 "-Xep:LockOnNonEnclosingClassLiteral:ERROR", 138 "-Xep:LongFloatConversion:ERROR", 139 "-Xep:LoopOverCharArray:ERROR", 140 "-Xep:MissingCasesInEnumSwitch:ERROR", 141 "-Xep:MixedMutabilityReturnType:ERROR", 142 "-Xep:MockNotUsedInProduction:ERROR", 143 "-Xep:ModifiedButNotUsed:ERROR", 144 "-Xep:ModifyCollectionInEnhancedForLoop:ERROR", 145 "-Xep:NarrowCalculation:ERROR", 146 "-Xep:NarrowingCompoundAssignment:ERROR", 147 "-Xep:NonApiType:ERROR", 148 "-Xep:NonAtomicVolatileUpdate:ERROR", 149 "-Xep:NonCanonicalType:ERROR", 150 "-Xep:NotJavadoc:ERROR", 151 "-Xep:NullablePrimitive:ERROR", 152 "-Xep:NullableVoid:ERROR", 153 "-Xep:ObjectEqualsForPrimitives:ERROR", 154 "-Xep:OperatorPrecedence:ERROR", 155 "-Xep:ReferenceEquality:ERROR", 156 "-Xep:ReturnAtTheEndOfVoidFunction:ERROR", 157 "-Xep:ReturnFromVoid:ERROR", 158 "-Xep:StaticAssignmentInConstructor:ERROR", 159 "-Xep:StaticGuardedByInstance:ERROR", 160 "-Xep:StringCaseLocaleUsage:ERROR", 161 "-Xep:StringCharset:ERROR", 162 "-Xep:SynchronizeOnNonFinalField:ERROR", 163 "-Xep:ToStringReturnsNull:ERROR", 164 "-Xep:TruthConstantAsserts:ERROR", 165 "-Xep:TruthIncompatibleType:ERROR", 166 "-Xep:UndefinedEquals:ERROR", 167 "-Xep:UnnecessaryAssignment:ERROR", 168 "-Xep:UnnecessaryAsync:ERROR", 169 "-Xep:UnnecessaryStringBuilder:ERROR", 170 "-Xep:UnrecognisedJavadocTag:ERROR", 171 "-Xep:UnusedMethod:ERROR", 172 "-Xep:UnusedNestedClass:ERROR", 173 "-Xep:UnusedVariable:ERROR", 174 "-Xep:VariableNameSameAsType:ERROR", 175 "-Xep:WaitNotInLoop:ERROR", 176 "-Xep:WakelockReleasedDangerously:ERROR", 177 178 // Exclude generated files 179 "-XepExcludedPaths:.*/srcjars/.*", 180 181 // The @InlineMe annotation could be made available, but it would 182 // apply on external facing API. This is not desired. 183 // For more context, see https://r.android.com/3303475 184 "-Xep:InlineMeSuggester:OFF", 185 ], 186 }, 187} 188 189java_defaults { 190 name: "bluetooth_framework_errorprone_rules", 191 defaults: ["bluetooth_errorprone_rules"], 192 errorprone: { 193 extra_check_modules: ["error_prone_android_framework"], 194 195 javacflags: [ 196 "-Xep:AndroidFrameworkBinderIdentity:ERROR", 197 "-Xep:AndroidFrameworkBluetoothPermission:ERROR", 198 "-Xep:AndroidFrameworkCompatChange:ERROR", 199 "-Xep:AndroidFrameworkEfficientParcelable:ERROR", 200 "-Xep:AndroidFrameworkEfficientStrings:ERROR", 201 "-Xep:AndroidFrameworkPendingIntentMutability:ERROR", 202 "-Xep:AndroidFrameworkRequiresPermission:ERROR", 203 "-Xep:AndroidFrameworkRethrowFromSystem:ERROR", 204 "-Xep:AndroidFrameworkTargetSdk:ERROR", 205 "-Xep:AndroidHideInComments:ERROR", 206 207 // After fixing this errorprone, we decided to not merge the change. 208 // It is not very readable and the benefits are minimal when looking 209 // at the size of the maps used in the Bluetooth application. 210 // See https://r.android.com/3200511 211 "-Xep:AndroidFrameworkEfficientCollections:OFF", 212 213 // Does not look pertinent in our situation 214 "-Xep:AndroidFrameworkEfficientXml:OFF", 215 ], 216 }, 217} 218