From ed83ff92760585599d9ad370b35bf301ed49c353 Mon Sep 17 00:00:00 2001 From: herrrta <@> Date: Tue, 19 Nov 2024 13:43:27 -0500 Subject: [PATCH] # Add publishing to central sonatype --- .gitignore | 1 + auth/build.gradle.kts | 5 +++-- build.gradle.kts | 46 +++++++++++++++++++++++++++++++++++++-- core/build.gradle.kts | 2 +- gradle.properties | 5 ++++- gradle/libs.versions.toml | 4 +++- local.properties | 8 ------- sample/build.gradle.kts | 2 +- settings.gradle.kts | 24 ++++++-------------- 9 files changed, 64 insertions(+), 33 deletions(-) delete mode 100644 local.properties diff --git a/.gitignore b/.gitignore index 125cf74..d2e2f5a 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ local.properties /auth/build/ /core/build/ /sample/build/ +/build/ diff --git a/auth/build.gradle.kts b/auth/build.gradle.kts index 2eb44f6..a34a53a 100644 --- a/auth/build.gradle.kts +++ b/auth/build.gradle.kts @@ -15,7 +15,8 @@ kotlin { } dependencies { - implementation(projects.core) + api(projects.core) + implementation(libs.ktor.server.core) implementation(libs.ktor.server.auth) -} +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2d0d27b..bda9a64 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,47 @@ +import com.vanniktech.maven.publish.SonatypeHost + plugins { - // this is necessary to avoid the plugins to be loaded multiple times - // in each subproject's classloader + alias(libs.plugins.gradle.maven.publish) alias(libs.plugins.kotlinJvm) apply false +} + +val ktorcefulVersion: String by project + +allprojects { + group = "dev.herrrta.ktorceful" + version = ktorcefulVersion +} + +subprojects { + apply(plugin = "com.vanniktech.maven.publish") + if (name != "sample") { + mavenPublishing { + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true) + signAllPublications() + + coordinates("dev.herrrta.ktorceful", name, ktorcefulVersion) + + pom { + name.set("Ktorceful") + description.set("Ktorceful - Ktor class based resource routing") + url.set("https://github.com/herrrta/ktorceful/") + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + scm { + url.set("https://github.com/herrrta/ktorceful") + connection.set("scm:git:https://github.com/herrrta/ktorceful.git") + } + developers { + developer { + name.set("herrrta") + url.set("https://github.com/herrrta/") + } + } + } + } + } } \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 27fd402..2713f9d 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -21,4 +21,4 @@ dependencies { testImplementation(libs.ktor.server.test.host) testImplementation(libs.kotlin.test.junit) -} +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 3c8f714..3e10c90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,7 @@ kotlin.daemon.jvmargs=-Xmx2048M org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 #Ktor -io.ktor.development=true \ No newline at end of file +io.ktor.development=true + +#Ktorceful +ktorcefulVersion=0.1 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a929c9..2b8ddab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,7 @@ junit = "4.13.2" kotlin = "2.0.21" ktor = "3.0.0" logback = "1.5.11" +maven-publish = "0.30.0" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } @@ -20,4 +21,5 @@ ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref [plugins] kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } ktor = { id = "io.ktor.plugin", version.ref = "ktor" } -kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } \ No newline at end of file +kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +gradle-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" } \ No newline at end of file diff --git a/local.properties b/local.properties deleted file mode 100644 index 8de6038..0000000 --- a/local.properties +++ /dev/null @@ -1,8 +0,0 @@ -## This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# Location of the SDK. This is only used by Gradle. -# For customization when using a Version Control System, please read the -# header note. -#Tue Nov 19 09:07:25 EST 2024 -sdk.dir=/Users/ivan/Library/Android/sdk diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index c92c969..df38e2d 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -13,7 +13,7 @@ application { } dependencies { - implementation(projects.core) + api(projects.core) implementation(libs.logback) implementation(libs.ktor.server.core) diff --git a/settings.gradle.kts b/settings.gradle.kts index c906923..14eff65 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,13 +3,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement { repositories { - google { - mavenContent { - includeGroupAndSubgroups("androidx") - includeGroupAndSubgroups("com.android") - includeGroupAndSubgroups("com.google") - } - } + google() mavenCentral() gradlePluginPortal() } @@ -17,17 +11,13 @@ pluginManagement { dependencyResolutionManagement { repositories { - google { - mavenContent { - includeGroupAndSubgroups("androidx") - includeGroupAndSubgroups("com.android") - includeGroupAndSubgroups("com.google") - } - } + google() mavenCentral() } } -include(":core") -include(":auth") -include(":sample") +include( + ":core", + ":auth", + ":sample" +)