Add logging functionality and Maven publishing setup

Added Logger class with various log levels to `commonMain`. Integrated `maven-publish` and `signing` plugins in `build.gradle.kts` to facilitate publishing artifacts to the Maven repository with proper credentials and metadata. Removed `gradle.properties` and updated `.gitignore` accordingly.
This commit is contained in:
2024-10-26 15:26:21 +02:00
parent fd81c0fcb4
commit 63625873be
7 changed files with 116 additions and 43 deletions

View File

@@ -2,6 +2,8 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
plugins {
kotlin("multiplatform") version "2.0.21"
`maven-publish`
signing
}
group = "nl.astraeus"
@@ -9,57 +11,65 @@ version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
maven {
url = uri("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
}
maven {
url = uri("https://gitea.astraeus.nl:8443/api/packages/rnentjes/maven")
}
}
kotlin {
jvmToolchain(17)
jvm {
withJava()
}
js {
binaries.executable()
browser {
distribution {
outputDirectory.set(File("$projectDir/web/"))
}
}
}
jvm {}
js {}
sourceSets {
val commonMain by getting {
dependencies {
api("nl.astraeus:kotlin-css-generator:1.0.10")
val commonMain by getting
val jvmMain by getting
val jsMain by getting
}
}
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
publishing {
repositories {
maven {
name = "gitea"
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
credentials() {
val giteaUsername: kotlin.String? by project
val giteaPassword: kotlin.String? by project
username = giteaUsername
password = giteaPassword
}
}
val commonTest by getting
val jvmMain by getting {
dependencies {
implementation("io.undertow:undertow-core:2.3.14.Final")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.11.0")
}
implementation("org.xerial:sqlite-jdbc:3.32.3.2")
implementation("com.zaxxer:HikariCP:4.0.3")
implementation("nl.astraeus:simple-jdbc-stats:1.6.1") {
exclude(group = "org.slf4j", module = "slf4j-api")
// Configure all publications
publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
artifact(javadocJar.get())
// Provide artifacts information requited by Maven Central
pom {
name.set("kotlin-komponent")
description.set("Kotlin komponent")
url.set("https://github.com/rnentjes/komponent")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
}
val jvmTest by getting {
dependencies {
developers {
developer {
id.set("rnentjes")
name.set("Rien Nentjes")
email.set("info@nentjes.com")
}
}
scm {
url.set("https://github.com/rnentjes/komponent")
}
}
val jsMain by getting {
dependencies {
implementation("nl.astraeus:kotlin-komponent:1.2.4")
}
}
val jsTest by getting
}
}
}
signing {
sign(publishing.publications)
}