From 00a2b3bc9fd67933a902e3571f2e6747b6a66ba3 Mon Sep 17 00:00:00 2001 From: Aditya Bhaskar Date: Sat, 16 Mar 2024 20:49:19 +0000 Subject: [PATCH 1/5] Add gradle lint plugin --- gradle/libs.versions.toml | 4 ++++ plugin-build/plugin/build.gradle.kts | 4 +++- plugin-build/settings.gradle.kts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 68d057d..706bea3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,6 +4,8 @@ kotlin = "1.9.23" ktlintGradle = "11.6.1" pluginPublish = "1.2.1" versionCheck = "0.51.0" +android-lint = "8.3.0" +android-lint-gradle = "1.0.0-alpha01" [plugins] detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt"} @@ -11,6 +13,8 @@ kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin"} ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintGradle"} pluginPublish = { id = "com.gradle.plugin-publish", version.ref = "pluginPublish"} versionCheck = { id = "com.github.ben-manes.versions", version.ref = "versionCheck"} +lint = { id = "com.android.lint", version.ref = "android-lint"} [libraries] junit = "junit:junit:4.13.2" +android-lint-gradle = { module = "androidx.lint:lint-gradle", version.ref = "android-lint-gradle" } \ No newline at end of file diff --git a/plugin-build/plugin/build.gradle.kts b/plugin-build/plugin/build.gradle.kts index 629e19d..e41abfd 100644 --- a/plugin-build/plugin/build.gradle.kts +++ b/plugin-build/plugin/build.gradle.kts @@ -1,16 +1,18 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -@Suppress("DSL_SCOPE_VIOLATION") plugins { kotlin("jvm") `java-gradle-plugin` alias(libs.plugins.pluginPublish) + alias(libs.plugins.lint) } dependencies { implementation(kotlin("stdlib")) implementation(gradleApi()) + lintChecks(libs.android.lint.gradle) + testImplementation(libs.junit) } diff --git a/plugin-build/settings.gradle.kts b/plugin-build/settings.gradle.kts index 5d94b44..d75dbd5 100644 --- a/plugin-build/settings.gradle.kts +++ b/plugin-build/settings.gradle.kts @@ -2,6 +2,7 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() + google() } } From c5fca8ed69ce9d041caa40b9c7508f909d7c4075 Mon Sep 17 00:00:00 2001 From: Aditya Bhaskar Date: Sat, 16 Mar 2024 20:51:31 +0000 Subject: [PATCH 2/5] Fix lint errors --- .../adityabhaskar/dependencygraph/plugin/core/ParseGraph.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/ParseGraph.kt b/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/ParseGraph.kt index 9dc3ff4..3881ea3 100644 --- a/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/ParseGraph.kt +++ b/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/ParseGraph.kt @@ -65,9 +65,9 @@ internal fun parseDependencyGraph( javaProjects.add(project) } - project.configurations.all { config -> + project.configurations.configureEach { config -> config.dependencies - .filterIsInstance(ProjectDependency::class.java) + .filterIsInstance() .map { it.dependencyProject } .filter { it.path !in ignoredModules } .forEach { dependency -> @@ -100,7 +100,7 @@ internal fun parseDependencyGraph( val allDependencies = it.configurations .map { config -> config.dependencies - .filterIsInstance(ProjectDependency::class.java) + .filterIsInstance() .filter { dependency -> dependency.dependencyProject.path != it.path } From 2369bf2f9a8ae7ab4fb3d88ea54073c778e43f7c Mon Sep 17 00:00:00 2001 From: Aditya Bhaskar Date: Sat, 16 Mar 2024 20:55:34 +0000 Subject: [PATCH 3/5] Update patch version --- plugin-build/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin-build/gradle.properties b/plugin-build/gradle.properties index 0eb4866..14d60f4 100644 --- a/plugin-build/gradle.properties +++ b/plugin-build/gradle.properties @@ -1,5 +1,5 @@ ID=io.github.adityabhaskar.dependencygraph -VERSION=0.1.5 +VERSION=0.1.6 GROUP=io.github.adityabhaskar DISPLAY_NAME=Gradle module dependency graphs DESCRIPTION=A plugin to automatically produce Github/mermaid compatible dependency graphs From ed7657327483779b89f61465145696625ce44e9b Mon Sep 17 00:00:00 2001 From: Aditya Bhaskar Date: Sat, 16 Mar 2024 21:04:12 +0000 Subject: [PATCH 4/5] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4d05967..b1e2f7b 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,14 @@ The plugin is available in the [Gradle plugins repository](https://plugins.gradl Kotlin: ```kotlin plugins { - id("io.github.adityabhaskar.dependencygraph") version "0.1.4" + id("io.github.adityabhaskar.dependencygraph") version "" } ``` Groovy: ```groovy plugins { - id "io.github.adityabhaskar.dependencygraph" version "0.1.4" + id "io.github.adityabhaskar.dependencygraph" version "" } ``` @@ -97,7 +97,7 @@ classDef andNode fill:#baffc9,color:#333333; classDef javaNode fill:#ffb3ba,color:#333333; %% Modules -subgraph +subgraph direction LR; :example:feature{{:example:feature}}:::javaNode; :example:models{{:example:models}}:::javaNode; @@ -132,7 +132,7 @@ classDef andNode fill:#baffc9,color:#333333; classDef javaNode fill:#ffb3ba,color:#333333; %% Modules -subgraph +subgraph direction LR; :example:data{{:example:data}}:::javaNode; :example:domain[:example:domain]:::javaNode; From 7e42fc6fc3bf5d230fd5e82b5fe8369d2412f350 Mon Sep 17 00:00:00 2001 From: Aditya Date: Sat, 16 Mar 2024 21:10:58 +0000 Subject: [PATCH 5/5] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b1e2f7b..f6d1084 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ classDef andNode fill:#baffc9,color:#333333; classDef javaNode fill:#ffb3ba,color:#333333; %% Modules -subgraph +subgraph direction LR; :example:feature{{:example:feature}}:::javaNode; :example:models{{:example:models}}:::javaNode; @@ -132,7 +132,7 @@ classDef andNode fill:#baffc9,color:#333333; classDef javaNode fill:#ffb3ba,color:#333333; %% Modules -subgraph +subgraph direction LR; :example:data{{:example:data}}:::javaNode; :example:domain[:example:domain]:::javaNode; @@ -173,4 +173,4 @@ Feel free to open a issue or submit a pull request for any bugs/improvements. ## License 📄 -This template is licensed under the MIT License - see the [License](License) file for details. \ No newline at end of file +This template is licensed under the MIT License - see the [License](License) file for details.