Bob Badour | 92ecf7c | 2021-02-12 18:05:29 -0800 | [diff] [blame] | 1 | package { |
Etienne Ruffieux | 917abc3 | 2022-02-28 14:07:17 +0000 | [diff] [blame] | 2 | default_visibility: [":__subpackages__"], |
Bob Badour | 92ecf7c | 2021-02-12 18:05:29 -0800 | [diff] [blame] | 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 |
| 20 | license { |
| 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 He | cac30a2 | 2018-08-28 18:28:55 -0700 | [diff] [blame] | 34 | filegroup { |
Colin Cross | 03e29e5 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 35 | name: "BluetoothTestConfigTemplate", |
| 36 | srcs: [ |
| 37 | "AndroidTestTemplate.xml", |
| 38 | ], |
Jack He | cac30a2 | 2018-08-28 18:28:55 -0700 | [diff] [blame] | 39 | } |
David Duarte | a84ffd1 | 2023-03-28 17:58:57 +0000 | [diff] [blame] | 40 | |
David Duarte | 4043a70 | 2023-06-04 16:44:03 +0000 | [diff] [blame] | 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 | // |
William Escande | 2256094 | 2024-09-18 16:44:36 -0700 | [diff] [blame] | 60 | // - Try avoiding adding option that would not fit "future" targets, for example dependencies, |
David Duarte | 4043a70 | 2023-06-04 16:44:03 +0000 | [diff] [blame] | 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. |
| 63 | cc_defaults { |
| 64 | name: "bluetooth_cflags", |
| 65 | cflags: [ |
| 66 | "-Wall", |
| 67 | "-Werror", |
| 68 | "-Wextra", |
William Escande | 2729718 | 2023-10-09 17:15:04 -0700 | [diff] [blame] | 69 | // Override global.go that demote the error to a warning |
David Duarte | c8d2a49 | 2024-04-11 18:02:38 +0000 | [diff] [blame] | 70 | "-Werror=format", |
William Escande | 2729718 | 2023-10-09 17:15:04 -0700 | [diff] [blame] | 71 | "-Werror=reorder-init-list", |
David Duarte | 4043a70 | 2023-06-04 16:44:03 +0000 | [diff] [blame] | 72 | ], |
David Duarte | 19954d1 | 2023-08-01 14:07:56 +0000 | [diff] [blame] | 73 | c_std: "c99", |
Myles Watson | dbd43e7 | 2024-02-15 11:02:58 -0800 | [diff] [blame] | 74 | cpp_std: "c++20", |
David Duarte | 4043a70 | 2023-06-04 16:44:03 +0000 | [diff] [blame] | 75 | } |
William Escande | 2256094 | 2024-09-18 16:44:36 -0700 | [diff] [blame] | 76 | |
| 77 | java_defaults { |
| 78 | name: "bluetooth_errorprone_rules", |
| 79 | errorprone: { |
| 80 | enabled: true, |
| 81 | javacflags: [ |
| 82 | "-Xep:AlmostJavadoc:ERROR", |
| 83 | "-Xep:AlreadyChecked:ERROR", |
| 84 | "-Xep:BadImport:ERROR", |
| 85 | "-Xep:CatchAndPrintStackTrace:ERROR", |
| 86 | "-Xep:CatchFail:ERROR", |
| 87 | "-Xep:CheckReturnValue:ERROR", |
| 88 | "-Xep:ClassCanBeStatic:ERROR", |
| 89 | "-Xep:DateFormatConstant:ERROR", |
| 90 | "-Xep:DirectInvocationOnMock:ERROR", |
| 91 | "-Xep:EmptyBlockTag:ERROR", |
| 92 | "-Xep:EmptyCatch:ERROR", |
| 93 | "-Xep:EqualsGetClass:ERROR", |
| 94 | "-Xep:EqualsHashCode:ERROR", |
| 95 | "-Xep:EqualsIncompatibleType:ERROR", |
| 96 | "-Xep:FallThrough:ERROR", |
| 97 | "-Xep:Finalize:ERROR", |
| 98 | "-Xep:FutureReturnValueIgnored:ERROR", |
| 99 | "-Xep:GuardedBy:ERROR", |
| 100 | "-Xep:HidingField:ERROR", |
| 101 | "-Xep:InconsistentHashCode:ERROR", |
| 102 | "-Xep:InlineFormatString:ERROR", |
| 103 | "-Xep:InlineMeInliner:ERROR", |
| 104 | "-Xep:InvalidBlockTag:ERROR", |
| 105 | "-Xep:InvalidInlineTag:ERROR", |
| 106 | "-Xep:InvalidParam:ERROR", |
| 107 | "-Xep:JavaUtilDate:ERROR", |
| 108 | "-Xep:JdkObsolete:ERROR", |
| 109 | "-Xep:LockOnNonEnclosingClassLiteral:ERROR", |
| 110 | "-Xep:LongFloatConversion:ERROR", |
| 111 | "-Xep:LoopOverCharArray:ERROR", |
| 112 | "-Xep:MissingCasesInEnumSwitch:ERROR", |
| 113 | "-Xep:MixedMutabilityReturnType:ERROR", |
| 114 | "-Xep:MockNotUsedInProduction:ERROR", |
| 115 | "-Xep:ModifiedButNotUsed:ERROR", |
| 116 | "-Xep:ModifyCollectionInEnhancedForLoop:ERROR", |
| 117 | "-Xep:NarrowCalculation:ERROR", |
| 118 | "-Xep:NarrowingCompoundAssignment:ERROR", |
| 119 | "-Xep:NonApiType:ERROR", |
| 120 | "-Xep:NonAtomicVolatileUpdate:ERROR", |
| 121 | "-Xep:NonCanonicalType:ERROR", |
| 122 | "-Xep:NotJavadoc:ERROR", |
| 123 | "-Xep:ObjectEqualsForPrimitives:ERROR", |
| 124 | "-Xep:OperatorPrecedence:ERROR", |
| 125 | "-Xep:ReferenceEquality:ERROR", |
| 126 | "-Xep:ReturnAtTheEndOfVoidFunction:ERROR", |
| 127 | "-Xep:StaticAssignmentInConstructor:ERROR", |
| 128 | "-Xep:StaticGuardedByInstance:ERROR", |
| 129 | "-Xep:StringCaseLocaleUsage:ERROR", |
| 130 | "-Xep:StringCharset:ERROR", |
| 131 | "-Xep:SynchronizeOnNonFinalField:ERROR", |
| 132 | "-Xep:ToStringReturnsNull:ERROR", |
| 133 | "-Xep:TruthConstantAsserts:ERROR", |
| 134 | "-Xep:TruthIncompatibleType:ERROR", |
| 135 | "-Xep:UndefinedEquals:ERROR", |
| 136 | "-Xep:UnnecessaryAssignment:ERROR", |
| 137 | "-Xep:UnnecessaryAsync:ERROR", |
| 138 | "-Xep:UnnecessaryStringBuilder:ERROR", |
| 139 | "-Xep:UnrecognisedJavadocTag:ERROR", |
| 140 | "-Xep:UnusedMethod:ERROR", |
| 141 | "-Xep:UnusedNestedClass:ERROR", |
| 142 | "-Xep:UnusedVariable:ERROR", |
| 143 | "-Xep:WaitNotInLoop:ERROR", |
| 144 | "-Xep:WakelockReleasedDangerously:ERROR", |
| 145 | |
| 146 | // Exclude generated files |
| 147 | "-XepExcludedPaths:.*/srcjars/.*", |
| 148 | |
| 149 | // The @InlineMe annotation is not available |
| 150 | // "-Xep:InlineMeSuggester:OFF", |
| 151 | ], |
| 152 | }, |
| 153 | } |
| 154 | |
| 155 | java_defaults { |
| 156 | name: "bluetooth_framework_errorprone_rules", |
| 157 | defaults: ["bluetooth_errorprone_rules"], |
| 158 | plugins: [ |
| 159 | "error_prone_android_framework", |
| 160 | ], |
| 161 | errorprone: { |
| 162 | javacflags: [ |
| 163 | "-Xep:AndroidFrameworkBinderIdentity:ERROR", |
| 164 | "-Xep:AndroidFrameworkBluetoothPermission:ERROR", |
| 165 | "-Xep:AndroidFrameworkCompatChange:ERROR", |
| 166 | "-Xep:AndroidFrameworkEfficientParcelable:ERROR", |
| 167 | "-Xep:AndroidFrameworkEfficientStrings:ERROR", |
| 168 | "-Xep:AndroidFrameworkPendingIntentMutability:ERROR", |
| 169 | "-Xep:AndroidFrameworkRequiresPermission:ERROR", |
| 170 | "-Xep:AndroidFrameworkRethrowFromSystem:ERROR", |
| 171 | "-Xep:AndroidFrameworkTargetSdk:ERROR", |
| 172 | "-Xep:AndroidHideInComments:ERROR", |
| 173 | |
| 174 | // After fixing this errorprone, we decided to not merge the change. |
| 175 | // It is not very readable and the benefits are minimal when looking |
| 176 | // at the size of the maps used in the Bluetooth application. |
| 177 | // See https://r.android.com/3200511 |
| 178 | "-Xep:AndroidFrameworkEfficientCollections:OFF", |
| 179 | |
| 180 | // Does not look pertinent in our situation |
| 181 | "-Xep:AndroidFrameworkEfficientXml:OFF", |
| 182 | ], |
| 183 | }, |
| 184 | } |