From 0362e50856533d920d5e212298203687d26b1489 Mon Sep 17 00:00:00 2001 From: tursom Date: Fri, 13 Aug 2021 21:23:48 +0800 Subject: [PATCH] update maven pusblish --- .gitignore | 3 +- build.gradle.kts | 30 +++++++++++++++++-- ts-core/build.gradle.kts | 2 ++ ts-core/ts-async-http/build.gradle.kts | 2 ++ ts-core/ts-buffer/build.gradle.kts | 2 ++ ts-core/ts-clone/build.gradle.kts | 2 ++ ts-core/ts-coroutine/build.gradle.kts | 2 ++ .../ts-coroutine-lock/build.gradle.kts | 2 ++ ts-core/ts-datastruct/build.gradle.kts | 2 ++ ts-core/ts-delegation/build.gradle.kts | 2 ++ .../ts-observer/build.gradle.kts | 2 ++ ts-core/ts-encrypt/build.gradle.kts | 2 ++ ts-core/ts-hash/build.gradle.kts | 2 ++ ts-core/ts-json/build.gradle.kts | 2 ++ ts-core/ts-log/build.gradle.kts | 2 ++ ts-core/ts-mail/build.gradle.kts | 2 ++ ts-core/ts-pool/build.gradle.kts | 2 ++ ts-core/ts-ws-client/build.gradle.kts | 2 ++ ts-core/ts-xml/build.gradle.kts | 2 ++ ts-core/ts-yaml/build.gradle.kts | 2 ++ ts-database/build.gradle.kts | 2 ++ ts-database/ts-mongodb/build.gradle.kts | 2 ++ .../ts-mongodb-spring/build.gradle.kts | 2 ++ ts-database/ts-redis/build.gradle.kts | 2 ++ ts-socket/build.gradle.kts | 2 ++ ts-web/build.gradle.kts | 2 ++ ts-web/ts-web-coroutine/build.gradle.kts | 2 ++ ts-web/ts-web-netty/build.gradle.kts | 2 ++ 28 files changed, 82 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 622473f..9c0add7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ build */build/ #gradle.properties -local.properties \ No newline at end of file +local.properties +!.idea/codeStyles \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index e98ca92..927fb33 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import java.util.* ext["netty.version"] = "4.1.59.Final" ext["excludeTest"] = { project: Project, tasks: TaskContainer -> @@ -14,7 +15,30 @@ ext["excludeTest"] = { project: Project, tasks: TaskContainer -> } } } +ext["publishRepositories"] = { project: Project, p: PublishingExtension -> + val artifactoryUser: String by rootProject + val artifactoryPassword: String by rootProject + p.repositories { + maven { + val releasesRepoUrl = uri("https://nvm.tursom.cn/repository/maven-releases/") + val snapshotRepoUrl = uri("https://nvm.tursom.cn/repository/maven-snapshots/") + url = if (project.version.toString().endsWith("SNAPSHOT")) snapshotRepoUrl else releasesRepoUrl + credentials { + username = artifactoryUser + password = artifactoryPassword + } + } + } +} +try { + val properties = Properties() + properties.load(rootProject.file("local.properties").inputStream()) + properties.forEach { (k, v) -> + rootProject.ext.set(k.toString(), v) + } +} catch (e: Exception) { +} plugins { kotlin("jvm") version "1.5.21" @@ -23,7 +47,7 @@ plugins { allprojects { group = "cn.tursom" - version = "0.2" + version = "1.0" repositories { mavenLocal() @@ -52,7 +76,7 @@ allprojects { } } -@kotlin.Suppress("UNCHECKED_CAST") +@Suppress("UNCHECKED_CAST") (rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks) dependencies { @@ -70,6 +94,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/build.gradle.kts b/ts-core/build.gradle.kts index 2be6f61..d504a85 100644 --- a/ts-core/build.gradle.kts +++ b/ts-core/build.gradle.kts @@ -19,6 +19,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-async-http/build.gradle.kts b/ts-core/ts-async-http/build.gradle.kts index 7587a0c..2aaa010 100644 --- a/ts-core/ts-async-http/build.gradle.kts +++ b/ts-core/ts-async-http/build.gradle.kts @@ -32,6 +32,8 @@ artifacts { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-buffer/build.gradle.kts b/ts-core/ts-buffer/build.gradle.kts index 4154cf0..1f2864d 100644 --- a/ts-core/ts-buffer/build.gradle.kts +++ b/ts-core/ts-buffer/build.gradle.kts @@ -21,6 +21,8 @@ artifacts { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-clone/build.gradle.kts b/ts-core/ts-clone/build.gradle.kts index 0316bd0..9f7bd9d 100644 --- a/ts-core/ts-clone/build.gradle.kts +++ b/ts-core/ts-clone/build.gradle.kts @@ -18,6 +18,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-coroutine/build.gradle.kts b/ts-core/ts-coroutine/build.gradle.kts index d442221..e96f8d0 100644 --- a/ts-core/ts-coroutine/build.gradle.kts +++ b/ts-core/ts-coroutine/build.gradle.kts @@ -16,6 +16,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts b/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts index d442221..e96f8d0 100644 --- a/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts +++ b/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts @@ -16,6 +16,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-datastruct/build.gradle.kts b/ts-core/ts-datastruct/build.gradle.kts index de6aa59..dda140b 100644 --- a/ts-core/ts-datastruct/build.gradle.kts +++ b/ts-core/ts-datastruct/build.gradle.kts @@ -18,6 +18,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-delegation/build.gradle.kts b/ts-core/ts-delegation/build.gradle.kts index 15d7809..bc2617a 100644 --- a/ts-core/ts-delegation/build.gradle.kts +++ b/ts-core/ts-delegation/build.gradle.kts @@ -16,6 +16,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-delegation/ts-observer/build.gradle.kts b/ts-core/ts-delegation/ts-observer/build.gradle.kts index f679ea0..1a7d2c6 100644 --- a/ts-core/ts-delegation/ts-observer/build.gradle.kts +++ b/ts-core/ts-delegation/ts-observer/build.gradle.kts @@ -16,6 +16,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-encrypt/build.gradle.kts b/ts-core/ts-encrypt/build.gradle.kts index 7bce2f6..8b80faf 100644 --- a/ts-core/ts-encrypt/build.gradle.kts +++ b/ts-core/ts-encrypt/build.gradle.kts @@ -18,6 +18,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-hash/build.gradle.kts b/ts-core/ts-hash/build.gradle.kts index 1afbb38..c1b8bee 100644 --- a/ts-core/ts-hash/build.gradle.kts +++ b/ts-core/ts-hash/build.gradle.kts @@ -16,6 +16,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-json/build.gradle.kts b/ts-core/ts-json/build.gradle.kts index 9877fba..1d92fc7 100644 --- a/ts-core/ts-json/build.gradle.kts +++ b/ts-core/ts-json/build.gradle.kts @@ -18,6 +18,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-log/build.gradle.kts b/ts-core/ts-log/build.gradle.kts index 137934b..11887b6 100644 --- a/ts-core/ts-log/build.gradle.kts +++ b/ts-core/ts-log/build.gradle.kts @@ -21,6 +21,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-mail/build.gradle.kts b/ts-core/ts-mail/build.gradle.kts index b902885..c2b3eee 100644 --- a/ts-core/ts-mail/build.gradle.kts +++ b/ts-core/ts-mail/build.gradle.kts @@ -16,6 +16,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-pool/build.gradle.kts b/ts-core/ts-pool/build.gradle.kts index 52c3a95..918d9dd 100644 --- a/ts-core/ts-pool/build.gradle.kts +++ b/ts-core/ts-pool/build.gradle.kts @@ -18,6 +18,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-ws-client/build.gradle.kts b/ts-core/ts-ws-client/build.gradle.kts index 2c5578a..eade26c 100644 --- a/ts-core/ts-ws-client/build.gradle.kts +++ b/ts-core/ts-ws-client/build.gradle.kts @@ -23,6 +23,8 @@ artifacts { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-xml/build.gradle.kts b/ts-core/ts-xml/build.gradle.kts index 10cc33e..6e2552d 100644 --- a/ts-core/ts-xml/build.gradle.kts +++ b/ts-core/ts-xml/build.gradle.kts @@ -17,6 +17,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-core/ts-yaml/build.gradle.kts b/ts-core/ts-yaml/build.gradle.kts index f3eaef8..1262398 100644 --- a/ts-core/ts-yaml/build.gradle.kts +++ b/ts-core/ts-yaml/build.gradle.kts @@ -17,6 +17,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-database/build.gradle.kts b/ts-database/build.gradle.kts index 789f79f..eae886a 100644 --- a/ts-database/build.gradle.kts +++ b/ts-database/build.gradle.kts @@ -21,6 +21,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-database/ts-mongodb/build.gradle.kts b/ts-database/ts-mongodb/build.gradle.kts index 0cf84f4..e4cba5e 100644 --- a/ts-database/ts-mongodb/build.gradle.kts +++ b/ts-database/ts-mongodb/build.gradle.kts @@ -20,6 +20,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts b/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts index 5f4e1cd..6115d02 100644 --- a/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts +++ b/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts @@ -17,6 +17,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-database/ts-redis/build.gradle.kts b/ts-database/ts-redis/build.gradle.kts index f854729..9cec4a7 100644 --- a/ts-database/ts-redis/build.gradle.kts +++ b/ts-database/ts-redis/build.gradle.kts @@ -18,6 +18,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-socket/build.gradle.kts b/ts-socket/build.gradle.kts index 0b46942..81be397 100644 --- a/ts-socket/build.gradle.kts +++ b/ts-socket/build.gradle.kts @@ -20,6 +20,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-web/build.gradle.kts b/ts-web/build.gradle.kts index ebb36a9..72795bb 100644 --- a/ts-web/build.gradle.kts +++ b/ts-web/build.gradle.kts @@ -19,6 +19,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-web/ts-web-coroutine/build.gradle.kts b/ts-web/ts-web-coroutine/build.gradle.kts index 1abde95..6249fba 100644 --- a/ts-web/ts-web-coroutine/build.gradle.kts +++ b/ts-web/ts-web-coroutine/build.gradle.kts @@ -20,6 +20,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString() diff --git a/ts-web/ts-web-netty/build.gradle.kts b/ts-web/ts-web-netty/build.gradle.kts index c10f3a6..7dbb73c 100644 --- a/ts-web/ts-web-netty/build.gradle.kts +++ b/ts-web/ts-web-netty/build.gradle.kts @@ -20,6 +20,8 @@ tasks.register("install") { } publishing { + @Suppress("UNCHECKED_CAST") + (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this) publications { create("maven") { groupId = project.group.toString()