Repository: jraska/modules-graph-assert
Pull request #251 (2024-03-08 00:22:34)

Fix various inconsistencies and a build error
I fixed a typo, some inconsistencies with final newlines, a Gradle task configuration optimization and a Gradle deprecation warning. I also fixed a build error (inconsistent JVM-target compatibility)

jraska: Thanks for the contribution 👍 

Patch:
diff --git a/build.gradle b/build.gradle
index f9d8a33..51df018 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,6 +16,6 @@ allprojects {
   }
 }
 
-task clean(type: Delete) {
-  delete rootProject.buildDir
+tasks.register('clean', Delete) { Delete _ ->
+  delete rootProject.layout.buildDirectory
 }
diff --git a/gradle.properties b/gradle.properties
index a96aa49..91d01c4 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,4 +4,3 @@ org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF
 org.gradle.parallel=true
 org.gradle.daemon=true
 VERSION_NAME=0.1.0
-
diff --git a/plugin/build.gradle b/plugin/build.gradle
index 67d56eb..5896446 100644
--- a/plugin/build.gradle
+++ b/plugin/build.gradle
@@ -18,14 +18,18 @@ dependencies {
 
 compileKotlin {
   kotlinOptions {
-    jvmTarget = "11"
+    jvmTarget = JavaVersion.VERSION_11
   }
 }
 compileTestKotlin {
   kotlinOptions {
-    jvmTarget = "11"
+    jvmTarget = JavaVersion.VERSION_11
   }
 }
+java {
+  sourceCompatibility JavaVersion.VERSION_11
+  targetCompatibility JavaVersion.VERSION_11
+}
 
 group = 'com.jraska.module.graph.assertion'
 
diff --git a/plugin/src/main/kotlin/com/jraska/module/graph/assertion/Api.kt b/plugin/src/main/kotlin/com/jraska/module/graph/assertion/Api.kt
index 0b92e30..47ced4c 100644
--- a/plugin/src/main/kotlin/com/jraska/module/graph/assertion/Api.kt
+++ b/plugin/src/main/kotlin/com/jraska/module/graph/assertion/Api.kt
@@ -22,6 +22,6 @@ object Api {
 
   const val EXTENSION_ROOT = "moduleGraphAssert"
 
-  val API_IMPLEMENTATON_CONFIGURATIONS = setOf("api", "implementation")
+  val API_IMPLEMENTATION_CONFIGURATIONS = setOf("api", "implementation")
 }
 
diff --git a/plugin/src/main/kotlin/com/jraska/module/graph/assertion/GraphRulesExtension.kt b/plugin/src/main/kotlin/com/jraska/module/graph/assertion/GraphRulesExtension.kt
index 325c760..7ff9b1d 100644
--- a/plugin/src/main/kotlin/com/jraska/module/graph/assertion/GraphRulesExtension.kt
+++ b/plugin/src/main/kotlin/com/jraska/module/graph/assertion/GraphRulesExtension.kt
@@ -4,7 +4,7 @@ open class GraphRulesExtension {
   var maxHeight: Int = 0
   var restricted = emptyArray<String>() // each restriction in format "regexp -X> regexp" e.g.: ":feature-[a-z]* -X> :forbidden-lib"
   var allowed = emptyArray<String>() // each allowance in format "regexp -> regexp" e.g.: ":feature-[a-z]* -> :forbidden-lib"
-  var configurations: Set<String> = Api.API_IMPLEMENTATON_CONFIGURATIONS
+  var configurations: Set<String> = Api.API_IMPLEMENTATION_CONFIGURATIONS
   var assertOnAnyBuild: Boolean = false
 
   internal fun shouldAssertHeight() = maxHeight > 0
diff --git a/settings.gradle b/settings.gradle
index 3e27ec9..c1d1ef1 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,1 +1,1 @@
-include ':plugin'
\ No newline at end of file
+include ':plugin'


Test patch:
diff --git a/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactorySingleModuleProjectTest.kt b/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactorySingleModuleProjectTest.kt
index 7e46c30..820bc6b 100644
--- a/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactorySingleModuleProjectTest.kt
+++ b/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactorySingleModuleProjectTest.kt
@@ -28,7 +28,7 @@ class GradleDependencyGraphFactorySingleModuleProjectTest {
 
   @Test
   fun generatesProperGraph() {
-    val dependencyGraph = GradleDependencyGraphFactory.create(singleModule, Api.API_IMPLEMENTATON_CONFIGURATIONS)
+    val dependencyGraph = GradleDependencyGraphFactory.create(singleModule, Api.API_IMPLEMENTATION_CONFIGURATIONS)
 
     val graphvizText = GraphvizWriter.toGraphviz(dependencyGraph)
     assert(EXPECTED_SINGLE_MODULE == graphvizText)
@@ -36,7 +36,7 @@ class GradleDependencyGraphFactorySingleModuleProjectTest {
 
   @Test
   fun generatesProperGraphOnRootModule() {
-    val dependencyGraph = GradleDependencyGraphFactory.create(rootProject!!, Api.API_IMPLEMENTATON_CONFIGURATIONS)
+    val dependencyGraph = GradleDependencyGraphFactory.create(rootProject!!, Api.API_IMPLEMENTATION_CONFIGURATIONS)
 
     val graphvizText = GraphvizWriter.toGraphviz(dependencyGraph)
     assert(EXPECTED_ROOT_MODULE == graphvizText)
diff --git a/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactoryTest.kt b/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactoryTest.kt
index 7cf9dd4..1b3ac07 100644
--- a/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactoryTest.kt
+++ b/plugin/src/test/kotlin/com/jraska/module/graph/assertion/GradleDependencyGraphFactoryTest.kt
@@ -56,7 +56,7 @@ class GradleDependencyGraphFactoryTest {
 
   @Test
   fun generatesProperGraph() {
-    val dependencyGraph = GradleDependencyGraphFactory.create(appProject, Api.API_IMPLEMENTATON_CONFIGURATIONS)
+    val dependencyGraph = GradleDependencyGraphFactory.create(appProject, Api.API_IMPLEMENTATION_CONFIGURATIONS)
 
     val graphvizText = GraphvizWriter.toGraphviz(dependencyGraph)
     assert(EXPECTED_GRAPHVIZ == graphvizText)
@@ -72,7 +72,7 @@ class GradleDependencyGraphFactoryTest {
 
   @Test
   fun generatesSingleModuleGraphOnNoDependencyModule() {
-    val dependencyGraph = GradleDependencyGraphFactory.create(coreProject, Api.API_IMPLEMENTATON_CONFIGURATIONS)
+    val dependencyGraph = GradleDependencyGraphFactory.create(coreProject, Api.API_IMPLEMENTATION_CONFIGURATIONS)
 
     val graphvizText = GraphvizWriter.toGraphviz(dependencyGraph)
     assert(EXPECTED_SINGLE_MODULE == graphvizText)