From a445f3c69cb484cffa1cb89d9dd6f4fb75c3bdb9 Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 10:47:21 +0200 Subject: [PATCH 1/8] Configure dokka as local gradle plugin --- buildSrc/build.gradle.kts | 1 + buildSrc/src/main/kotlin/local.base.gradle.kts | 1 + buildSrc/src/main/kotlin/local.dokka.gradle.kts | 3 +++ buildSrc/src/main/kotlin/local.publish.gradle.kts | 2 -- buildSrc/src/main/kotlin/util/Properties.kt | 11 ++--------- gradle/libs.versions.toml | 1 + lib/build.gradle.kts | 1 - misc/DeveloperReadme.md | 4 ++++ 8 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 buildSrc/src/main/kotlin/local.dokka.gradle.kts diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ccbbbfc38a..6d480039a8 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -7,6 +7,7 @@ dependencies { implementation(plugin(libs.plugins.spotless)) implementation(plugin(libs.plugins.testLogger)) implementation(plugin(libs.plugins.detekt)) + implementation(plugin(libs.plugins.dokka)) } kotlin { diff --git a/buildSrc/src/main/kotlin/local.base.gradle.kts b/buildSrc/src/main/kotlin/local.base.gradle.kts index 38deebfbd0..02ed8c0eea 100644 --- a/buildSrc/src/main/kotlin/local.base.gradle.kts +++ b/buildSrc/src/main/kotlin/local.base.gradle.kts @@ -3,6 +3,7 @@ plugins { id("local.spotless") id("local.test") id("local.javalibrary") + id("local.dokka") } repositories { diff --git a/buildSrc/src/main/kotlin/local.dokka.gradle.kts b/buildSrc/src/main/kotlin/local.dokka.gradle.kts new file mode 100644 index 0000000000..405a229a58 --- /dev/null +++ b/buildSrc/src/main/kotlin/local.dokka.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("org.jetbrains.dokka") +} diff --git a/buildSrc/src/main/kotlin/local.publish.gradle.kts b/buildSrc/src/main/kotlin/local.publish.gradle.kts index f1e75d7393..1eb2f6b288 100644 --- a/buildSrc/src/main/kotlin/local.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/local.publish.gradle.kts @@ -90,8 +90,6 @@ publishing { setCredentialsFromGradleProperties() } } - - println("Repository Url $url") } } } diff --git a/buildSrc/src/main/kotlin/util/Properties.kt b/buildSrc/src/main/kotlin/util/Properties.kt index c7d0d2effa..c9c518b4bf 100644 --- a/buildSrc/src/main/kotlin/util/Properties.kt +++ b/buildSrc/src/main/kotlin/util/Properties.kt @@ -6,15 +6,8 @@ import java.io.FileInputStream import java.io.InputStreamReader import java.util.* -fun Project.getLocalPropertyOrGradleProperty(propertyName: String): String? { - val property = gradleLocalProperty(propertyName) ?: getProjectProperty(propertyName) - - if (property == null) { - logger.warn("Property $propertyName not found.") - } - - return property -} +fun Project.getLocalPropertyOrGradleProperty(propertyName: String) = + gradleLocalProperty(propertyName) ?: getProjectProperty(propertyName) private fun Project.getProjectProperty(propertyName: String): String? = properties[propertyName] as String? diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a79fb52af8..6e4bd6b945 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,6 +19,7 @@ kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinVersion" } kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlinVersion" } kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlinVersion" } +dokka = "org.jetbrains.dokka:1.8.10" spotless = "com.diffplug.spotless:6.18.0" testLogger = "com.adarshr.test-logger:3.2.0" detekt = "io.gitlab.arturbosch.detekt:1.22.0" diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index be43d0a414..3df3529ab4 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -3,7 +3,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("local.base") id("local.publish") - id("org.jetbrains.dokka") version "1.8.10" } dependencies { diff --git a/misc/DeveloperReadme.md b/misc/DeveloperReadme.md index 4c5c8e2709..06238c797c 100644 --- a/misc/DeveloperReadme.md +++ b/misc/DeveloperReadme.md @@ -29,6 +29,10 @@ artefact will be transferred to [maven central](https://central.sonatype.com/artifact/com.lemonappdev/konsist) repository after some time. +## Generate KDocs + +- `./gradlew dokkaHtml` - generate KDocs in `./lib/build/dokka/html/index.html` + ## Layers Below is a diagram of the layers of the `konsist` library: From 5f0e31acc6f634af79f23b5ac32520a4da6463c0 Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 11:02:48 +0200 Subject: [PATCH 2/8] Increase memory --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8410dd611d..ffd6bcc930 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -org.gradle.jvmargs=-Xms512M -Xmx4g -Dkotlin.daemon.jvm.options="-Xmx1g" +org.gradle.jvmargs=-Xms512M -Xmx6g -Dkotlin.daemon.jvm.options="-Xmx1g" konsist.version=0.7.8 From 314399a1c95054f58a62c8cf594b10c5ed18dd2c Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 11:13:18 +0200 Subject: [PATCH 3/8] Test Rename --- .../konsist/core/APrintDeclaration.kt | 15 +++++++++++++ .../konsist/core/verify/PrintDeclaration.kt | 21 ------------------- 2 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt delete mode 100644 lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclaration.kt diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt new file mode 100644 index 0000000000..41cea50461 --- /dev/null +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt @@ -0,0 +1,15 @@ +package com.lemonappdev.konsist.core + +class APrintDeclaration { +// @Test +// fun `return value after printDeclaration() is equal to original value`() { +// // given +// val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") +// val sut = scope +// .classes() +// .withNamePrefix("KoScopeForC") +// +// // then +// sut.print() shouldBeEqualTo sut +// } +} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclaration.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclaration.kt deleted file mode 100644 index 47954013e9..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclaration.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.lemonappdev.konsist.core.verify - -import com.lemonappdev.konsist.api.Konsist -import com.lemonappdev.konsist.api.ext.sequence.print -import com.lemonappdev.konsist.api.ext.sequence.withNamePrefix -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class PrintDeclaration { - @Test - fun `return value after printDeclaration() is equal to original value`() { - // given - val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") - val sut = scope - .classes() - .withNamePrefix("KoScopeForC") - - // then - sut.print() shouldBeEqualTo sut - } -} From a9f58b407f36fc9ad75750a67c18d4199e7b9e40 Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 11:13:51 +0200 Subject: [PATCH 4/8] Test Rename --- .../konsist/core/APrintDeclaration.kt | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt index 41cea50461..2bf3729b9a 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt @@ -1,15 +1,21 @@ package com.lemonappdev.konsist.core +import com.lemonappdev.konsist.api.Konsist +import com.lemonappdev.konsist.api.ext.sequence.print +import com.lemonappdev.konsist.api.ext.sequence.withNamePrefix +import org.amshove.kluent.shouldBeEqualTo +import org.junit.jupiter.api.Test + class APrintDeclaration { -// @Test -// fun `return value after printDeclaration() is equal to original value`() { -// // given -// val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") -// val sut = scope -// .classes() -// .withNamePrefix("KoScopeForC") -// -// // then -// sut.print() shouldBeEqualTo sut -// } + @Test + fun `return value after printDeclaration() is equal to original value`() { + // given + val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") + val sut = scope + .classes() + .withNamePrefix("KoScopeForC") + + // then + sut.print() shouldBeEqualTo sut + } } From e0a1fb424bc4467213ccd7031d66b54ab4d7629c Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 13:01:06 +0200 Subject: [PATCH 5/8] Upd Test name --- .../{APrintDeclaration.kt => verify/PrintDeclarationTest.kt} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/{APrintDeclaration.kt => verify/PrintDeclarationTest.kt} (93%) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt similarity index 93% rename from lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt rename to lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt index 2bf3729b9a..369236b63e 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/APrintDeclaration.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt @@ -1,4 +1,4 @@ -package com.lemonappdev.konsist.core +package com.lemonappdev.konsist.core.verify import com.lemonappdev.konsist.api.Konsist import com.lemonappdev.konsist.api.ext.sequence.print From 0f77241819d03c3c3438e637cee3950710ea4607 Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 14:33:26 +0200 Subject: [PATCH 6/8] Rename test --- .../com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt index 369236b63e..40b3e8601f 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt @@ -6,7 +6,7 @@ import com.lemonappdev.konsist.api.ext.sequence.withNamePrefix import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test -class APrintDeclaration { +class PrintDeclarationTest { @Test fun `return value after printDeclaration() is equal to original value`() { // given From af27c229c7b730426526603ab999a05f0ed858c9 Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 19:34:17 +0200 Subject: [PATCH 7/8] Rename PrintDeclarationTest --- gradle.properties | 2 +- .../konsist/core/verify/HeapTest.kt | 28 +++++++++++++++++++ .../core/verify/PrintDeclarationTest.kt | 21 -------------- 3 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt delete mode 100644 lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt diff --git a/gradle.properties b/gradle.properties index ffd6bcc930..8572b4acd2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -org.gradle.jvmargs=-Xms512M -Xmx6g -Dkotlin.daemon.jvm.options="-Xmx1g" +org.gradle.jvmargs=-Xms512M -Xmx12g -Dkotlin.daemon.jvm.options="-Xmx1g" konsist.version=0.7.8 diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt new file mode 100644 index 0000000000..f58d32a61e --- /dev/null +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt @@ -0,0 +1,28 @@ +package com.lemonappdev.konsist.core.verify + +import com.lemonappdev.konsist.api.Konsist +import com.lemonappdev.konsist.api.ext.sequence.print +import com.lemonappdev.konsist.api.ext.sequence.withNamePrefix +import org.junit.jupiter.api.Test + +class HeapTest { + @Test + fun `return value after printDeclaration() is equal to original value`() { + List(100) { + Konsist + .scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") + .classes() + .withNamePrefix("KoScopeForC") + .print() + } + +// // given +// val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") +// val sut = scope +// .classes() +// .withNamePrefix("KoScopeForC") +// +// // then +// sut.print() shouldBeEqualTo sut + } +} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt deleted file mode 100644 index 40b3e8601f..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/PrintDeclarationTest.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.lemonappdev.konsist.core.verify - -import com.lemonappdev.konsist.api.Konsist -import com.lemonappdev.konsist.api.ext.sequence.print -import com.lemonappdev.konsist.api.ext.sequence.withNamePrefix -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class PrintDeclarationTest { - @Test - fun `return value after printDeclaration() is equal to original value`() { - // given - val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") - val sut = scope - .classes() - .withNamePrefix("KoScopeForC") - - // then - sut.print() shouldBeEqualTo sut - } -} From 06f19acf40f6b343c4aa908a51a4be3572cd756b Mon Sep 17 00:00:00 2001 From: Igor Wojda Date: Fri, 5 May 2023 19:39:30 +0200 Subject: [PATCH 8/8] Remove HeapTest --- .../konsist/core/verify/HeapTest.kt | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt deleted file mode 100644 index f58d32a61e..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/HeapTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.lemonappdev.konsist.core.verify - -import com.lemonappdev.konsist.api.Konsist -import com.lemonappdev.konsist.api.ext.sequence.print -import com.lemonappdev.konsist.api.ext.sequence.withNamePrefix -import org.junit.jupiter.api.Test - -class HeapTest { - @Test - fun `return value after printDeclaration() is equal to original value`() { - List(100) { - Konsist - .scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") - .classes() - .withNamePrefix("KoScopeForC") - .print() - } - -// // given -// val scope = Konsist.scopeFromPackage("com.lemonappdev.konsist.core.scope.koscope") -// val sut = scope -// .classes() -// .withNamePrefix("KoScopeForC") -// -// // then -// sut.print() shouldBeEqualTo sut - } -}