diff --git a/packages/camera/camera_android/android/build.gradle b/packages/camera/camera_android/android/build.gradle index 476386ba6d2..8e2775a0e26 100644 --- a/packages/camera/camera_android/android/build.gradle +++ b/packages/camera/camera_android/android/build.gradle @@ -35,6 +35,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' baseline file("lint-baseline.xml") } diff --git a/packages/camera/camera_android/android/lint-baseline.xml b/packages/camera/camera_android/android/lint-baseline.xml index 4ddaafa8798..b0fc2e758df 100644 --- a/packages/camera/camera_android/android/lint-baseline.xml +++ b/packages/camera/camera_android/android/lint-baseline.xml @@ -1,114 +1,3106 @@ - + + + + + + file="src/main/java/io/flutter/plugins/camera/features/sensororientation/DeviceOrientationManager.java" + line="250" + column="5"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public static FocusMode getValueForString(String modeStr) {" + errorLine2=" ~~~~~~~~~"> + file="src/main/java/io/flutter/plugins/camera/features/autofocus/FocusMode.java" + line="18" + column="17"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public static FocusMode getValueForString(String modeStr) {" + errorLine2=" ~~~~~~"> + file="src/main/java/io/flutter/plugins/camera/features/autofocus/FocusMode.java" + line="18" + column="45"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public static FocusMode getValueForString(String modeStr) {" + errorLine2=" ~~~~~~~~~"> + file="src/main/java/io/flutter/plugins/camera/types/FocusMode.java" + line="18" + column="17"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public static FocusMode getValueForString(String modeStr) {" + errorLine2=" ~~~~~~"> + file="src/main/java/io/flutter/plugins/camera/types/FocusMode.java" + line="18" + column="45"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" CameraProperties cameraProperties, SensorOrientationFeature sensorOrientationFeature) {" + errorLine2=" ~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public void setValue(NoiseReductionMode value) {" + errorLine2=" ~~~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public void setValue(Integer value) {" + errorLine2=" ~~~~~~~"> + file="src/main/java/io/flutter/plugins/camera/features/sensororientation/SensorOrientationFeature.java" + line="56" + column="24"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public void updateBuilder(CaptureRequest.Builder requestBuilder) {" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~"> + file="src/main/java/io/flutter/plugins/camera/features/sensororientation/SensorOrientationFeature.java" + line="66" + column="29"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" + errorLine1=" public DeviceOrientationManager getDeviceOrientationManager() {" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + + + + + column="10"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/camera/camera_android_camerax/android/build.gradle b/packages/camera/camera_android_camerax/android/build.gradle index 336e1600989..492d1374b8a 100644 --- a/packages/camera/camera_android_camerax/android/build.gradle +++ b/packages/camera/camera_android_camerax/android/build.gradle @@ -49,8 +49,10 @@ android { } lintOptions { - disable 'AndroidGradlePluginVersion' - disable 'GradleDependency' + checkAllWarnings true + warningsAsErrors true + disable 'AndroidGradlePluginVersion', 'GradleDependency', 'InvalidPackage' + baseline file("lint-baseline.xml") } } diff --git a/packages/camera/camera_android_camerax/android/lint-baseline.xml b/packages/camera/camera_android_camerax/android/lint-baseline.xml new file mode 100644 index 00000000000..1142794741a --- /dev/null +++ b/packages/camera/camera_android_camerax/android/lint-baseline.xml @@ -0,0 +1,1434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/espresso/android/build.gradle b/packages/espresso/android/build.gradle index c4d8b149c34..2aac3452e03 100644 --- a/packages/espresso/android/build.gradle +++ b/packages/espresso/android/build.gradle @@ -29,6 +29,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' baseline file("lint-baseline.xml") } diff --git a/packages/espresso/android/lint-baseline.xml b/packages/espresso/android/lint-baseline.xml index 19b349f044b..c07e756707e 100644 --- a/packages/espresso/android/lint-baseline.xml +++ b/packages/espresso/android/lint-baseline.xml @@ -1,5 +1,5 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file="src/main/java/androidx/test/espresso/flutter/internal/idgenerator/IdException.java" + line="20" + column="22"/> + + + + + + + + + + + + + + + + + + + + + + + + + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public WidgetMatcher getAncestorMatcher() {" + errorLine2=" ~~~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/IsDescendantOfMatcher.java" + line="47" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public WidgetMatcher getWidgetMatcher() {" + errorLine2=" ~~~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/IsDescendantOfMatcher.java" + line="52" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" protected boolean matchesSafely(WidgetInfo widget) {" + errorLine2=" ~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/IsDescendantOfMatcher.java" + line="62" + column="35"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public void describeTo(Description description) {" + errorLine2=" ~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/IsDescendantOfMatcher.java" + line="68" + column="26"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" protected boolean matchesSafely(WidgetInfo widget) {" + errorLine2=" ~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/IsExistingMatcher.java" + line="23" + column="35"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public void describeTo(Description description) {" + errorLine2=" ~~~~~~~~~~~"> + + + + + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public JsonRpcClient(OkHttpClient client, URI webSocketUri) {" + errorLine2=" ~~~"> + file="src/main/java/androidx/test/espresso/flutter/internal/jsonrpc/JsonRpcClient.java" + line="45" + column="45"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public ListenableFuture<JsonRpcResponse> request(JsonRpcRequest request) {" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/internal/jsonrpc/JsonRpcClient.java" + line="74" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public ListenableFuture<JsonRpcResponse> request(JsonRpcRequest request) {" + errorLine2=" ~~~~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/internal/jsonrpc/JsonRpcClient.java" + line="74" + column="52"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public static JsonRpcRequest fromJson(String jsonString) {" + errorLine2=" ~~~~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/internal/jsonrpc/message/JsonRpcRequest.java" + line="51" + column="17"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public static JsonRpcRequest fromJson(String jsonString) {" + errorLine2=" ~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/internal/jsonrpc/message/JsonRpcRequest.java" + line="51" + column="41"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String getVersion() {" + errorLine2=" ~~~~~~"> + line="86" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String getId() {" + errorLine2=" ~~~~~~"> + line="95" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String getMethod() {" + errorLine2=" ~~~~~~"> + line="104" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public JsonObject getParams() {" + errorLine2=" ~~~~~~~~~~"> + line="109" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String toJson() {" + errorLine2=" ~~~~~~"> + line="118" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public Builder(String method) {" + errorLine2=" ~~~~~~"> + line="172" + column="20"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public Builder setId(@Nullable String id) {" + errorLine2=" ~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + line="49" + column="17"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public static JsonRpcResponse fromJson(String jsonString) {" + errorLine2=" ~~~~~~"> + line="49" + column="42"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public JsonRpcResponse(String id) {" + errorLine2=" ~~~~~~"> + line="62" + column="26"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String getVersion() {" + errorLine2=" ~~~~~~"> + line="72" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String getId() {" + errorLine2=" ~~~~~~"> + line="77" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public void setId(String id) {" + errorLine2=" ~~~~~~"> + line="86" + column="21"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public JsonObject getResult() {" + errorLine2=" ~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/internal/jsonrpc/message/JsonRpcResponse.java" + line="91" + column="10"/> + + + + + + + + + + + + + + + + + + + + + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" protected String actionId;" + errorLine2=" ~~~~~~"> + line="30" + column="13"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public Future<Void> perform(" + errorLine2=" ~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public Future<WidgetInfo> perform(" + errorLine2=" ~~~~~~~~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/action/WidgetInfoFetcher.java" + line="21" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" protected String matcherId;" + errorLine2=" ~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/api/WidgetMatcher.java" + line="31" + column="13"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public String getText() {" + errorLine2=" ~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/WithTextMatcher.java" + line="31" + column="10"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" protected boolean matchesSafely(WidgetInfo widget) {" + errorLine2=" ~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/WithTextMatcher.java" + line="41" + column="35"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" public void describeTo(Description description) {" + errorLine2=" ~~~~~~~~~~~"> + file="src/main/java/androidx/test/espresso/flutter/matcher/WithTextMatcher.java" + line="46" + column="26"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/flutter_plugin_android_lifecycle/android/build.gradle b/packages/flutter_plugin_android_lifecycle/android/build.gradle index 708eaff4175..8431e0bc2c8 100644 --- a/packages/flutter_plugin_android_lifecycle/android/build.gradle +++ b/packages/flutter_plugin_android_lifecycle/android/build.gradle @@ -30,7 +30,10 @@ android { consumerProguardFiles 'proguard.txt' } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } dependencies { diff --git a/packages/flutter_plugin_android_lifecycle/android/lint-baseline.xml b/packages/flutter_plugin_android_lifecycle/android/lint-baseline.xml new file mode 100644 index 00000000000..0c5fc18e5a6 --- /dev/null +++ b/packages/flutter_plugin_android_lifecycle/android/lint-baseline.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle index fef368e278b..61b79a90a37 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } dependencies { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/lint-baseline.xml b/packages/google_maps_flutter/google_maps_flutter_android/android/lint-baseline.xml new file mode 100644 index 00000000000..092b2d57e77 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/lint-baseline.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/google_sign_in/google_sign_in_android/android/build.gradle b/packages/google_sign_in/google_sign_in_android/android/build.gradle index ef56fb68f41..e7e0f043d9e 100644 --- a/packages/google_sign_in/google_sign_in_android/android/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } diff --git a/packages/google_sign_in/google_sign_in_android/android/lint-baseline.xml b/packages/google_sign_in/google_sign_in_android/android/lint-baseline.xml new file mode 100644 index 00000000000..c59558ae18a --- /dev/null +++ b/packages/google_sign_in/google_sign_in_android/android/lint-baseline.xml @@ -0,0 +1,730 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/image_picker/image_picker_android/android/build.gradle b/packages/image_picker/image_picker_android/android/build.gradle index 3af3ba471df..c4fb379533f 100644 --- a/packages/image_picker/image_picker_android/android/build.gradle +++ b/packages/image_picker/image_picker_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } dependencies { implementation 'androidx.core:core:1.9.0' diff --git a/packages/image_picker/image_picker_android/android/lint-baseline.xml b/packages/image_picker/image_picker_android/android/lint-baseline.xml new file mode 100644 index 00000000000..765a6ca914b --- /dev/null +++ b/packages/image_picker/image_picker_android/android/lint-baseline.xml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/in_app_purchase/in_app_purchase_android/android/build.gradle b/packages/in_app_purchase/in_app_purchase_android/android/build.gradle index 95a744d08ee..4385ad821f5 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/build.gradle +++ b/packages/in_app_purchase/in_app_purchase_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/packages/in_app_purchase/in_app_purchase_android/android/lint-baseline.xml b/packages/in_app_purchase/in_app_purchase_android/android/lint-baseline.xml new file mode 100644 index 00000000000..03eeb956885 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_android/android/lint-baseline.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/local_auth/local_auth_android/android/build.gradle b/packages/local_auth/local_auth_android/android/build.gradle index 8e116709d6c..6bd8e4d845d 100644 --- a/packages/local_auth/local_auth_android/android/build.gradle +++ b/packages/local_auth/local_auth_android/android/build.gradle @@ -29,6 +29,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' baseline file("lint-baseline.xml") } diff --git a/packages/local_auth/local_auth_android/android/lint-baseline.xml b/packages/local_auth/local_auth_android/android/lint-baseline.xml index e89eaadb3e6..3f0a47a6824 100644 --- a/packages/local_auth/local_auth_android/android/lint-baseline.xml +++ b/packages/local_auth/local_auth_android/android/lint-baseline.xml @@ -1,5 +1,5 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/path_provider/path_provider_android/android/build.gradle b/packages/path_provider/path_provider_android/android/build.gradle index 96558c4248b..7e348233d34 100644 --- a/packages/path_provider/path_provider_android/android/build.gradle +++ b/packages/path_provider/path_provider_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/packages/path_provider/path_provider_android/android/lint-baseline.xml b/packages/path_provider/path_provider_android/android/lint-baseline.xml new file mode 100644 index 00000000000..4ae0352f93c --- /dev/null +++ b/packages/path_provider/path_provider_android/android/lint-baseline.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/quick_actions/quick_actions_android/android/build.gradle b/packages/quick_actions/quick_actions_android/android/build.gradle index 269f44d66d6..a668fb05387 100644 --- a/packages/quick_actions/quick_actions_android/android/build.gradle +++ b/packages/quick_actions/quick_actions_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } dependencies { diff --git a/packages/quick_actions/quick_actions_android/android/lint-baseline.xml b/packages/quick_actions/quick_actions_android/android/lint-baseline.xml new file mode 100644 index 00000000000..2df302dcb73 --- /dev/null +++ b/packages/quick_actions/quick_actions_android/android/lint-baseline.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/shared_preferences/shared_preferences_android/android/build.gradle b/packages/shared_preferences/shared_preferences_android/android/build.gradle index 9893ba6219f..905150edf78 100644 --- a/packages/shared_preferences/shared_preferences_android/android/build.gradle +++ b/packages/shared_preferences/shared_preferences_android/android/build.gradle @@ -37,6 +37,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' baseline file("lint-baseline.xml") } diff --git a/packages/shared_preferences/shared_preferences_android/android/lint-baseline.xml b/packages/shared_preferences/shared_preferences_android/android/lint-baseline.xml index 6b2f35f5a15..ca2bc158739 100644 --- a/packages/shared_preferences/shared_preferences_android/android/lint-baseline.xml +++ b/packages/shared_preferences/shared_preferences_android/android/lint-baseline.xml @@ -1,5 +1,5 @@ - + @@ -63,7 +63,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~"> @@ -74,8 +74,52 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + diff --git a/packages/url_launcher/url_launcher_android/android/build.gradle b/packages/url_launcher/url_launcher_android/android/build.gradle index d066fde7b17..0b34862c646 100644 --- a/packages/url_launcher/url_launcher_android/android/build.gradle +++ b/packages/url_launcher/url_launcher_android/android/build.gradle @@ -29,7 +29,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } diff --git a/packages/url_launcher/url_launcher_android/android/lint-baseline.xml b/packages/url_launcher/url_launcher_android/android/lint-baseline.xml new file mode 100644 index 00000000000..fa3c2e350b4 --- /dev/null +++ b/packages/url_launcher/url_launcher_android/android/lint-baseline.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/video_player/video_player_android/android/build.gradle b/packages/video_player/video_player_android/android/build.gradle index 73b73526f61..9145f6c8b31 100644 --- a/packages/video_player/video_player_android/android/build.gradle +++ b/packages/video_player/video_player_android/android/build.gradle @@ -34,7 +34,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/packages/video_player/video_player_android/android/lint-baseline.xml b/packages/video_player/video_player_android/android/lint-baseline.xml new file mode 100644 index 00000000000..4649a80f7b9 --- /dev/null +++ b/packages/video_player/video_player_android/android/lint-baseline.xml @@ -0,0 +1,653 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/webview_flutter/webview_flutter_android/android/build.gradle b/packages/webview_flutter/webview_flutter_android/android/build.gradle index f50f273ab2b..540c208a189 100644 --- a/packages/webview_flutter/webview_flutter_android/android/build.gradle +++ b/packages/webview_flutter/webview_flutter_android/android/build.gradle @@ -30,10 +30,10 @@ android { } lintOptions { - // See https://sites.google.com/a/android.com/tools/tips/lint-checks for all available - // android lint checks. - error 'ViewConstructor' + checkAllWarnings true + warningsAsErrors true disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") } dependencies { diff --git a/packages/webview_flutter/webview_flutter_android/android/lint-baseline.xml b/packages/webview_flutter/webview_flutter_android/android/lint-baseline.xml new file mode 100644 index 00000000000..10821e05e8b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/lint-baseline.xml @@ -0,0 +1,4107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tool/lib/src/lint_android_command.dart b/script/tool/lib/src/lint_android_command.dart index f146b2d4fbb..3fe25eec283 100644 --- a/script/tool/lib/src/lint_android_command.dart +++ b/script/tool/lib/src/lint_android_command.dart @@ -39,11 +39,28 @@ class LintAndroidCommand extends PackageLoopingCommand { } bool failed = false; + + // Ensure that the plugin has a strict Gradle-driven lint configuration, so + // that this test actually catches most issues. + if (!_mainGradleHasLintConfig(package)) { + failed = true; + printError('This plugin is not configured to enable all Gradle-driven ' + 'lint warnings and treat them as errors. ' + 'Please add the following to the lintOptions section of ' + 'android/build.gradle:'); + print(''' + checkAllWarnings true + warningsAsErrors true +'''); + } + for (final RepositoryPackage example in package.getExamples()) { final GradleProject project = GradleProject(example, processRunner: processRunner, platform: platform); if (!project.isConfigured()) { + // TODO(stuartmorgan): Replace this with a --config-only build once + // that's available on stable. return PackageResult.fail(['Build examples before linting']); } @@ -61,25 +78,13 @@ class LintAndroidCommand extends PackageLoopingCommand { failed = true; } - // In addition to running the Gradle lint step, also ensure that the - // example project is configured to build with javac lints enabled and + // In addition to running the Gradle-driven lint step, also ensure that + // the example project is configured to build with javac lints enabled and // treated as errors. - final List gradleBuildContents = example - .platformDirectory(FlutterPlatform.android) - .childFile('build.gradle') - .readAsLinesSync(); - // The check here is intentionally somewhat loose, to allow for the - // possibility of variations (e.g., not using Xlint:all in some cases, or - // passing other arguments). - if (!gradleBuildContents.any( - (String line) => line.contains('project(":$packageName")')) || - !gradleBuildContents.any((String line) => - line.contains('options.compilerArgs') && - line.contains('-Xlint') && - line.contains('-Werror'))) { + if (!_exampleGradleHasJavacLintConfig(example, packageName)) { failed = true; printError('The example ' - '${getRelativePosixPath(example.directory, from: package.directory)} ' + '"${getRelativePosixPath(example.directory, from: package.directory)}" ' 'is not configured to treat javac lints and warnings as errors. ' 'Please add the following to its build.gradle:'); print(''' @@ -96,4 +101,36 @@ gradle.projectsEvaluated { return failed ? PackageResult.fail() : PackageResult.success(); } + + /// Returns whether the plugin project is configured to enable all Gradle + /// lints and treat them as errors. + bool _mainGradleHasLintConfig(RepositoryPackage package) { + final List gradleBuildContents = package + .platformDirectory(FlutterPlatform.android) + .childFile('build.gradle') + .readAsLinesSync(); + return gradleBuildContents + .any((String line) => line.contains('checkAllWarnings true')) && + gradleBuildContents + .any((String line) => line.contains('warningsAsErrors true')); + } + + /// Returns whether the example project is configured to build with javac + /// lints enabled and treated as errors. + bool _exampleGradleHasJavacLintConfig( + RepositoryPackage example, String pluginPackageName) { + final List gradleBuildContents = example + .platformDirectory(FlutterPlatform.android) + .childFile('build.gradle') + .readAsLinesSync(); + // The check here is intentionally somewhat loose, to allow for the + // possibility of variations (e.g., not using Xlint:all in some cases, or + // passing other arguments). + return gradleBuildContents.any( + (String line) => line.contains('project(":$pluginPackageName")')) && + gradleBuildContents.any((String line) => + line.contains('options.compilerArgs') && + line.contains('-Xlint') && + line.contains('-Werror')); + } } diff --git a/script/tool/test/lint_android_command_test.dart b/script/tool/test/lint_android_command_test.dart index ee1db42f104..614e60d105a 100644 --- a/script/tool/test/lint_android_command_test.dart +++ b/script/tool/test/lint_android_command_test.dart @@ -37,7 +37,46 @@ void main() { runner.addCommand(command); }); - void writeFakeBuildGradle(RepositoryPackage example, String pluginName, + void writeFakePluginBuildGradle(RepositoryPackage plugin, + {bool warningsConfigured = true}) { + const String warningConfig = ''' + lintOptions { + checkAllWarnings true + warningsAsErrors true + disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency' + baseline file("lint-baseline.xml") + } +'''; + final File gradleFile = plugin + .platformDirectory(FlutterPlatform.android) + .childFile('build.gradle'); + gradleFile.createSync(recursive: true); + gradleFile.writeAsStringSync(''' +android { + compileSdkVersion 33 + + defaultConfig { + minSdkVersion 16 + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } +${warningsConfigured ? warningConfig : ''} + testOptions { + unitTests.returnDefaultValues = true + unitTests.all { + testLogging { + events "passed", "skipped", "failed", "standardOut", "standardError" + outputs.upToDateWhen {false} + showStandardStreams = true + } + } + } +} + +'''); + } + + void writeFakeExampleBuildGradle( + RepositoryPackage example, String pluginName, {bool warningsConfigured = true}) { final String warningConfig = ''' gradle.projectsEvaluated { @@ -78,7 +117,8 @@ ${warningsConfigured ? warningConfig : ''} ], platformSupport: { platformAndroid: const PlatformDetails(PlatformSupport.inline) }); - writeFakeBuildGradle(plugin.getExamples().first, 'plugin1'); + writeFakePluginBuildGradle(plugin); + writeFakeExampleBuildGradle(plugin.getExamples().first, 'plugin1'); final Directory androidDir = plugin.getExamples().first.platformDirectory(FlutterPlatform.android); @@ -116,8 +156,9 @@ ${warningsConfigured ? warningConfig : ''} platformSupport: { platformAndroid: const PlatformDetails(PlatformSupport.inline) }); + writeFakePluginBuildGradle(plugin); for (final RepositoryPackage example in plugin.getExamples()) { - writeFakeBuildGradle(example, 'plugin1'); + writeFakeExampleBuildGradle(example, 'plugin1'); } final Iterable exampleAndroidDirs = plugin.getExamples().map( @@ -148,10 +189,11 @@ ${warningsConfigured ? warningConfig : ''} }); test('fails if gradlew is missing', () async { - createFakePlugin('plugin1', packagesDir, + final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir, platformSupport: { platformAndroid: const PlatformDetails(PlatformSupport.inline) }); + writeFakePluginBuildGradle(plugin); Error? commandError; final List output = await runCapturingPrint( @@ -176,7 +218,8 @@ ${warningsConfigured ? warningConfig : ''} ], platformSupport: { platformAndroid: const PlatformDetails(PlatformSupport.inline) }); - writeFakeBuildGradle(plugin.getExamples().first, 'plugin1'); + writeFakePluginBuildGradle(plugin); + writeFakeExampleBuildGradle(plugin.getExamples().first, 'plugin1'); final String gradlewPath = plugin .getExamples() @@ -204,6 +247,34 @@ ${warningsConfigured ? warningConfig : ''} )); }); + test('fails if gradle-driven lint-warnings-as-errors is missing', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin1', packagesDir, extraFiles: [ + 'example/android/gradlew', + ], platformSupport: { + platformAndroid: const PlatformDetails(PlatformSupport.inline) + }); + writeFakePluginBuildGradle(plugin, warningsConfigured: false); + writeFakeExampleBuildGradle(plugin.getExamples().first, 'plugin1'); + + Error? commandError; + final List output = await runCapturingPrint( + runner, ['lint-android'], errorHandler: (Error e) { + commandError = e; + }); + + expect(commandError, isA()); + expect( + output, + containsAllInOrder( + [ + contains('This plugin is not configured to enable all ' + 'Gradle-driven lint warnings and treat them as errors.'), + contains('The following packages had errors:'), + ], + )); + }); + test('fails if javac lint-warnings-as-errors is missing', () async { final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir, extraFiles: [ @@ -211,7 +282,8 @@ ${warningsConfigured ? warningConfig : ''} ], platformSupport: { platformAndroid: const PlatformDetails(PlatformSupport.inline) }); - writeFakeBuildGradle(plugin.getExamples().first, 'plugin1', + writeFakePluginBuildGradle(plugin); + writeFakeExampleBuildGradle(plugin.getExamples().first, 'plugin1', warningsConfigured: false); Error? commandError; @@ -225,7 +297,7 @@ ${warningsConfigured ? warningConfig : ''} output, containsAllInOrder( [ - contains('The example example is not configured to treat javac ' + contains('The example "example" is not configured to treat javac ' 'lints and warnings as errors.'), contains('The following packages had errors:'), ],