diff --git a/WORKSPACE b/WORKSPACE index fabb5896..4475bc10 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -27,7 +27,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "grab_bazel_common", - commit = "1e751cfd185fd205555f50a5ea6e6c1b52dcdc63", + commit = "fe47feaee47d9f872514d29ca4ac4c462e1811eb", remote = "https://github.com/grab/grab-bazel-common.git", ) diff --git a/build.gradle b/build.gradle index 464b37f6..1710fa22 100644 --- a/build.gradle +++ b/build.gradle @@ -98,7 +98,7 @@ grazel { rules { bazelCommon { gitRepository { - commit = "1e751cfd185fd205555f50a5ea6e6c1b52dcdc63" + commit = "fe47feaee47d9f872514d29ca4ac4c462e1811eb" remote = "https://github.com/grab/grab-bazel-common.git" } toolchains { diff --git a/constants.gradle b/constants.gradle index 8f99783c..0e0c2692 100644 --- a/constants.gradle +++ b/constants.gradle @@ -15,7 +15,7 @@ */ ext { groupId = "com.grab.grazel" - versionName = "0.4.1-alpha.22" + versionName = "0.4.1-alpha.23" website = "https://grab.github.io/Grazel/" } diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/starlark/LintConfigs.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/starlark/LintConfigs.kt index 63de8367..628f7a51 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/starlark/LintConfigs.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/starlark/LintConfigs.kt @@ -16,8 +16,13 @@ package com.grab.grazel.bazel.starlark -data class LintConfigs(val configPath: String? = null, val baselinePath: String? = null) { +data class LintConfigs( + val enabled: Boolean = true, + val configPath: String? = null, + val baselinePath: String? = null +) { val merged: Map = mapOf( + "enabled" to enabled.toString(), "config" to configPath, "baseline" to baselinePath ).filterValues { it != null } as Map diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidExtractor.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidExtractor.kt index 1faa3ea3..e3f36088 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidExtractor.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidExtractor.kt @@ -167,6 +167,9 @@ private fun lintConfigs( lintOptions: LintOptions, project: Project ): LintConfigs { + // enable lint for all targets by default + val enabled = true + val configPath = if (lintOptions.lintConfig?.absolutePath != null) { project.relativePath(lintOptions.lintConfig!!.absolutePath) } else { @@ -177,7 +180,7 @@ private fun lintConfigs( } else { null } - return LintConfigs(configPath, baseLinePath) + return LintConfigs(enabled, configPath, baseLinePath) } internal interface AndroidBinaryDataExtractor : AndroidExtractor diff --git a/sample-android-flavor/BUILD.bazel b/sample-android-flavor/BUILD.bazel index 93c3ab21..02d6bcd2 100644 --- a/sample-android-flavor/BUILD.bazel +++ b/sample-android-flavor/BUILD.bazel @@ -9,6 +9,9 @@ android_library( custom_package = "com.grab.grazel.android.flavor", enable_compose = True, enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", res_values = { "strings": { @@ -44,6 +47,9 @@ android_library( custom_package = "com.grab.grazel.android.flavor", enable_compose = True, enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", res_values = { "strings": { @@ -79,6 +85,9 @@ android_library( custom_package = "com.grab.grazel.android.flavor", enable_compose = True, enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", res_values = { "strings": { @@ -114,6 +123,9 @@ android_library( custom_package = "com.grab.grazel.android.flavor", enable_compose = True, enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", res_values = { "strings": { diff --git a/sample-android-library/BUILD.bazel b/sample-android-library/BUILD.bazel index 0f8a7fd6..338e5d54 100644 --- a/sample-android-library/BUILD.bazel +++ b/sample-android-library/BUILD.bazel @@ -7,6 +7,9 @@ android_library( ]), custom_package = "com.grab.grazel.android.sample.lib", enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", visibility = [ "//visibility:public", @@ -23,6 +26,9 @@ android_library( ]), custom_package = "com.grab.grazel.android.sample.lib", enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", visibility = [ "//visibility:public", @@ -39,6 +45,9 @@ android_library( ]), custom_package = "com.grab.grazel.android.sample.lib", enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", visibility = [ "//visibility:public", @@ -55,6 +64,9 @@ android_library( ]), custom_package = "com.grab.grazel.android.sample.lib", enable_data_binding = True, + lint_options = { + "enabled": "true", + }, manifest = "src/main/AndroidManifest.xml", visibility = [ "//visibility:public", diff --git a/sample-android/BUILD.bazel b/sample-android/BUILD.bazel index ee3d5ce2..935b7677 100644 --- a/sample-android/BUILD.bazel +++ b/sample-android/BUILD.bazel @@ -35,6 +35,7 @@ android_binary( enable_data_binding = True, incremental_dexing = True, lint_options = { + "enabled": "true", "baseline": "lint_baseline.xml", }, manifest = "src/debug/AndroidManifest.xml", @@ -125,6 +126,7 @@ android_binary( enable_data_binding = True, incremental_dexing = True, lint_options = { + "enabled": "true", "baseline": "lint_baseline.xml", }, manifest = "src/debug/AndroidManifest.xml", @@ -215,6 +217,7 @@ android_binary( enable_data_binding = True, incremental_dexing = True, lint_options = { + "enabled": "true", "baseline": "lint_baseline.xml", }, manifest = "src/debug/AndroidManifest.xml", @@ -305,6 +308,7 @@ android_binary( enable_data_binding = True, incremental_dexing = True, lint_options = { + "enabled": "true", "baseline": "lint_baseline.xml", }, manifest = "src/debug/AndroidManifest.xml", diff --git a/sample-android/lint_baseline.xml b/sample-android/lint_baseline.xml index a24b6a4a..1042e85c 100755 --- a/sample-android/lint_baseline.xml +++ b/sample-android/lint_baseline.xml @@ -12,6 +12,28 @@ column="13"/> + + + + + + + + @@ -21,6 +43,28 @@ column="37"/> + + + + + + + +