build: use a convention plugin for kotlin-jvm
authorDa Risk <da_risk@geekorum.com>
Mon, 02 Oct 2023 19:35:17 -0400
changeset 1144 d6c1637eb4ab
parent 1143 77db7f79e9de
child 1145 b991e9a02478
build: use a convention plugin for kotlin-jvm
buildSrc/src/main/kotlin/conventions/android.kt
buildSrc/src/main/kotlin/conventions/jvm-library.gradle.kts
buildSrc/src/main/kotlin/conventions/kotlin-project.kt
faviKonSnoop/build.gradle.kts
htmlparsers/build.gradle.kts
webapi/build.gradle.kts
--- a/buildSrc/src/main/kotlin/conventions/android.kt	Mon Oct 02 19:16:33 2023 -0400
+++ b/buildSrc/src/main/kotlin/conventions/android.kt	Mon Oct 02 19:35:17 2023 -0400
@@ -24,32 +24,17 @@
 import com.geekorum.build.configureAnnotationProcessorDeps
 import com.geekorum.build.createComponentsPlatforms
 import org.gradle.api.Project
-import org.gradle.kotlin.dsl.configure
 import org.gradle.kotlin.dsl.dependencies
 import org.gradle.kotlin.dsl.findByType
-import org.gradle.kotlin.dsl.withType
-import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
-import org.jetbrains.kotlin.gradle.plugin.KaptExtension
-import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 fun Project.conventionForAndroidProject() {
+    conventionForKotlinProject()
+
     dependencies {
         createComponentsPlatforms()
     }
     configureAnnotationProcessorDeps()
 
-    plugins.withType<KotlinBasePlugin> {
-        extensions.configure<KotlinTopLevelExtension> {
-            jvmToolchain(17)
-        }
-    }
-
-    tasks.withType<KotlinCompile> {
-        kotlinOptions {
-            freeCompilerArgs = listOf("-Xjvm-default=all")
-        }
-    }
 
     extensions.findByType<BaseExtension>()?.apply {
         setCompileSdkVersion(34)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildSrc/src/main/kotlin/conventions/jvm-library.gradle.kts	Mon Oct 02 19:35:17 2023 -0400
@@ -0,0 +1,28 @@
+/*
+ * Geekttrss is a RSS feed reader application on the Android Platform.
+ *
+ * Copyright (C) 2017-2023 by Frederic-Charles Barthelery.
+ *
+ * This file is part of Geekttrss.
+ *
+ * Geekttrss is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Geekttrss is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.geekorum.build.conventions
+
+plugins {
+    kotlin("jvm")
+    id("com.geekorum.build.source-license-checker")
+}
+
+conventionForKotlinProject()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildSrc/src/main/kotlin/conventions/kotlin-project.kt	Mon Oct 02 19:35:17 2023 -0400
@@ -0,0 +1,42 @@
+/*
+ * Geekttrss is a RSS feed reader application on the Android Platform.
+ *
+ * Copyright (C) 2017-2023 by Frederic-Charles Barthelery.
+ *
+ * This file is part of Geekttrss.
+ *
+ * Geekttrss is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Geekttrss is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.geekorum.build.conventions
+
+import org.gradle.api.Project
+import org.gradle.kotlin.dsl.configure
+import org.gradle.kotlin.dsl.withType
+import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
+import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+fun Project.conventionForKotlinProject() {
+    plugins.withType<KotlinBasePlugin> {
+        extensions.configure<KotlinTopLevelExtension> {
+            jvmToolchain(17)
+        }
+    }
+
+    tasks.withType<KotlinCompile> {
+        kotlinOptions {
+            freeCompilerArgs = listOf("-Xjvm-default=all")
+        }
+    }
+}
\ No newline at end of file
--- a/faviKonSnoop/build.gradle.kts	Mon Oct 02 19:16:33 2023 -0400
+++ b/faviKonSnoop/build.gradle.kts	Mon Oct 02 19:35:17 2023 -0400
@@ -19,9 +19,7 @@
  * along with Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
  */
 plugins {
-//    alias(libs.plugins.kotlin.jvm)
-//    alias(libs.plugins.kotlinx.serialization)
-    kotlin("jvm")
+    id("com.geekorum.build.conventions.jvm-library")
     kotlin("plugin.serialization")
 }
 
--- a/htmlparsers/build.gradle.kts	Mon Oct 02 19:16:33 2023 -0400
+++ b/htmlparsers/build.gradle.kts	Mon Oct 02 19:35:17 2023 -0400
@@ -19,8 +19,7 @@
  * along with Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
  */
 plugins {
-//    alias(libs.plugins.kotlin.jvm)
-    kotlin("jvm")
+    id("com.geekorum.build.conventions.jvm-library")
 }
 
 dependencies {
--- a/webapi/build.gradle.kts	Mon Oct 02 19:16:33 2023 -0400
+++ b/webapi/build.gradle.kts	Mon Oct 02 19:35:17 2023 -0400
@@ -20,9 +20,7 @@
  */
 
 plugins {
-//    alias(libs.plugins.kotlin.jvm)
-//    alias(libs.plugins.kotlinx.serialization)
-    kotlin("jvm")
+    id("com.geekorum.build.conventions.jvm-library")
     kotlin("plugin.serialization")
 }