Skip to content

Commit

Permalink
add enabled property to lint options
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadkahelghi-grabtaxi committed Mar 11, 2024
1 parent 3ce0892 commit 7cb7bb8
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> = mapOf(
"enabled" to enabled.toString(),
"config" to configPath,
"baseline" to baselinePath
).filterValues { it != null } as Map<String, String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -177,7 +180,7 @@ private fun lintConfigs(
} else {
null
}
return LintConfigs(configPath, baseLinePath)
return LintConfigs(enabled, configPath, baseLinePath)
}

internal interface AndroidBinaryDataExtractor : AndroidExtractor<AndroidBinaryData>
Expand Down
12 changes: 12 additions & 0 deletions sample-android-flavor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
12 changes: 12 additions & 0 deletions sample-android-library/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions sample-android/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
mavenCentral()
}
Expand Down

0 comments on commit 7cb7bb8

Please sign in to comment.