update dependence

This commit is contained in:
tursom 2021-08-23 15:52:10 +08:00
parent 20a87fdee0
commit b69b6ba083
33 changed files with 544 additions and 686 deletions

2
.gitignore vendored
View File

@ -6,5 +6,5 @@
build build
*/build/ */build/
#gradle.properties #gradle.properties
local.properties local.yml
!.idea/codeStyles !.idea/codeStyles

View File

@ -1,94 +1,9 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*
ext["netty.version"] = "4.1.59.Final"
ext["excludeTest"] = { project: Project, tasks: TaskContainer ->
if (project.gradle.startParameter.taskNames.firstOrNull { taskName ->
":test" in taskName
} == null) {
tasks {
test { enabled = false }
testClasses { enabled = false }
compileTestJava { enabled = false }
compileTestKotlin { enabled = false }
processTestResources { enabled = false }
}
}
}
ext["publishRepositories"] = { project: Project, p: PublishingExtension ->
p.repositories {
try {
val artifactoryUser: String = rootProject.ext["tursom.artifactoryUser"] as String
val artifactoryPassword: String = rootProject.ext["tursom.artifactoryPassword"] as String
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
}
}
} catch (e: Exception) {
println("cannot push to repository tursom")
}
try {
maven {
val githubUser: String by rootProject
val githubToken: String by rootProject
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/$githubUser/TursomServer")
credentials {
username = githubUser
password = githubToken
}
}
} catch (e: Exception) {
println("cannot push to repository github")
}
val repositoriesRegex = "repositories\\.[a-zA-z]*".toRegex()
rootProject.properties.keys.asSequence().filter {
it matches repositoriesRegex
}.forEach {
val repositoryName = rootProject.ext.properties["$it.name"]?.toString() ?: it.substringAfterLast('.')
try {
val artifactoryUser = rootProject.ext.properties["$it.artifactoryUser"].toString()
val artifactoryPassword = rootProject.ext.properties["$it.artifactoryPassword"].toString()
maven {
name = repositoryName
val releasesRepoUrl = rootProject.ext.properties["$it.release"]?.let { uri(it.toString()) }
val snapshotRepoUrl = rootProject.ext.properties["$it.snapshot"]?.let { uri(it.toString()) }
val repoUrl = rootProject.ext.properties["$it.url"]?.let { uri(it.toString()) }
url = if (project.version.toString().endsWith("SNAPSHOT")
&& snapshotRepoUrl != null
) {
snapshotRepoUrl
} else releasesRepoUrl ?: repoUrl!!
credentials {
username = artifactoryUser
password = artifactoryPassword
}
}
} catch (e: Exception) {
println("cannot push to repository $repositoryName")
}
}
}
}
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 { plugins {
kotlin("jvm") version "1.5.21" kotlin("jvm") version "1.5.21"
`maven-publish` `maven-publish`
id("ts-gradle")
} }
allprojects { allprojects {
@ -96,7 +11,6 @@ allprojects {
version = "1.0-SNAPSHOT" version = "1.0-SNAPSHOT"
repositories { repositories {
// mavenLocal()
mavenCentral() mavenCentral()
maven { maven {
url = uri("https://nvm.tursom.cn/repository/maven-public/") url = uri("https://nvm.tursom.cn/repository/maven-public/")
@ -125,37 +39,14 @@ allprojects {
} }
} }
@Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
dependencies { dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21") api(kotlin("stdlib-jdk8"))
api("org.jetbrains.kotlin:kotlin-reflect:1.5.21") api(kotlin("reflect"))
testImplementation(group = "junit", name = "junit", version = "4.13.2") testApi(group = "junit", name = "junit", version = "4.13.2")
} }
artifacts { artifacts {
archives(tasks["kotlinSourcesJar"]) archives(tasks["kotlinSourcesJar"])
} }
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
//publishing {
// @Suppress("UNCHECKED_CAST")
// (rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
// publications {
// create<MavenPublication>("maven") {
// groupId = project.group.toString()
// artifactId = project.name
// version = project.version.toString()
//
// from(components["java"])
// try {
// artifact(tasks["kotlinSourcesJar"])
// } catch (e: Exception) {
// }
// }
// }
//}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -12,27 +13,6 @@ dependencies {
testImplementation(group = "junit", name = "junit", version = "4.13.2") testImplementation(group = "junit", name = "junit", version = "4.13.2")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -19,32 +20,3 @@ dependencies {
testImplementation(project(":ts-core:ts-coroutine")) testImplementation(project(":ts-core:ts-coroutine"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
artifacts {
archives(tasks["kotlinSourcesJar"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -9,31 +10,6 @@ dependencies {
compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final") compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
artifacts { artifacts {
archives(tasks["kotlinSourcesJar"]) archives(tasks["kotlinSourcesJar"])
} }
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,27 +11,6 @@ dependencies {
implementation(project(":ts-core:ts-datastruct")) implementation(project(":ts-core:ts-datastruct"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,27 +9,6 @@ dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,27 +9,6 @@ dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,27 +11,6 @@ dependencies {
implementation(project(":ts-core:ts-hash")) implementation(project(":ts-core:ts-hash"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,27 +9,6 @@ dependencies {
compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final") compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,27 +9,6 @@ dependencies {
api(project(":ts-core:ts-delegation")) api(project(":ts-core:ts-delegation"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,27 +11,6 @@ dependencies {
implementation(project(":ts-core:ts-datastruct")) implementation(project(":ts-core:ts-datastruct"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,27 +9,6 @@ dependencies {
implementation(project(":ts-core:ts-buffer")) implementation(project(":ts-core:ts-buffer"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,27 +11,6 @@ dependencies {
compileOnly(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.12.4") compileOnly(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.12.4")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -13,27 +14,6 @@ dependencies {
compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,27 +9,6 @@ dependencies {
implementation(group = "com.sun.mail", name = "javax.mail", version = "1.6.2") implementation(group = "com.sun.mail", name = "javax.mail", version = "1.6.2")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,27 +11,6 @@ dependencies {
implementation(project(":ts-core:ts-datastruct")) implementation(project(":ts-core:ts-datastruct"))
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -11,31 +12,10 @@ dependencies {
api(group = "io.netty", name = "netty-all", version = "4.1.67.Final") api(group = "io.netty", name = "netty-all", version = "4.1.67.Final")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
artifacts { artifacts {
archives(tasks["kotlinSourcesJar"]) archives(tasks["kotlinSourcesJar"])
} }
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -9,27 +10,6 @@ dependencies {
api(group = "org.dom4j", name = "dom4j", version = "2.1.3") api(group = "org.dom4j", name = "dom4j", version = "2.1.3")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -9,27 +10,6 @@ dependencies {
implementation(group = "org.yaml", name = "snakeyaml", version = "1.29") implementation(group = "org.yaml", name = "snakeyaml", version = "1.29")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -13,27 +14,6 @@ dependencies {
compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -12,27 +13,6 @@ dependencies {
api(group = "org.mongodb", name = "mongodb-driver-reactivestreams", version = "4.3.0") api(group = "org.mongodb", name = "mongodb-driver-reactivestreams", version = "4.3.0")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -9,27 +10,6 @@ dependencies {
compileOnly(group = "org.springframework.data", name = "spring-data-mongodb", version = "3.2.4") compileOnly(group = "org.springframework.data", name = "spring-data-mongodb", version = "3.2.4")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,27 +11,6 @@ dependencies {
api(group = "redis.clients", name = "jedis", version = "3.6.3") api(group = "redis.clients", name = "jedis", version = "3.6.3")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -20,7 +20,7 @@ try {
} catch (e: Exception) { } catch (e: Exception) {
} }
group = "com.ddbes" group = "cn.tursom"
version = SimpleDateFormat("yy.MM.dd-HH.mm").format(Date()) version = SimpleDateFormat("yy.MM.dd-HH.mm").format(Date())
repositories { repositories {
@ -34,11 +34,11 @@ dependencies {
gradlePlugin { gradlePlugin {
plugins { plugins {
create("ddbes-gradle") { create("ts-gradle") {
// 在 app 模块需要通过 id 引用这个插件 // 在 app 模块需要通过 id 引用这个插件
id = "ddbes-gradle" id = "ts-gradle"
// 实现这个插件的类的路径 // 实现这个插件的类的路径
implementationClass = "DdbesGradlePlugin" implementationClass = "cn.tursom.gradle.TursomGradlePlugin"
} }
} }
} }
@ -46,13 +46,14 @@ gradlePlugin {
publishing { publishing {
repositories { repositories {
try { try {
val artifactoryUser: String = rootProject.ext["tursom.artifactoryUser"] as String
val artifactoryPassword: String = rootProject.ext["tursom.artifactoryPassword"] as String
maven { maven {
name = "tursom"
val releasesRepoUrl = uri("https://nvm.tursom.cn/repository/maven-releases/") val releasesRepoUrl = uri("https://nvm.tursom.cn/repository/maven-releases/")
val snapshotRepoUrl = uri("https://nvm.tursom.cn/repository/maven-snapshots/") val snapshotRepoUrl = uri("https://nvm.tursom.cn/repository/maven-snapshots/")
url = if (project.version.toString().endsWith("SNAPSHOT")) snapshotRepoUrl else releasesRepoUrl url = if (project.version.toString().endsWith("SNAPSHOT")) snapshotRepoUrl else releasesRepoUrl
credentials { credentials {
val artifactoryUser: String = rootProject.ext["tursom.artifactoryUser"] as String
val artifactoryPassword: String = rootProject.ext["tursom.artifactoryPassword"] as String
username = artifactoryUser username = artifactoryUser
password = artifactoryPassword password = artifactoryPassword
} }
@ -62,9 +63,9 @@ publishing {
} }
try { try {
maven { maven {
val githubUser: String by rootProject
val githubToken: String by rootProject
name = "GitHubPackages" name = "GitHubPackages"
val githubUser: String = rootProject.ext["github.artifactoryUser"] as String
val githubToken: String = rootProject.ext["github.artifactoryPassword"] as String
url = uri("https://maven.pkg.github.com/$githubUser/TursomServer") url = uri("https://maven.pkg.github.com/$githubUser/TursomServer")
credentials { credentials {
username = githubUser username = githubUser

View File

@ -0,0 +1,7 @@
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.ExtraPropertiesExtension
internal val Project.ext: ExtraPropertiesExtension
get() = (this as ExtensionAware).extensions
.getByName("ext") as ExtraPropertiesExtension

View File

@ -0,0 +1,132 @@
import org.gradle.api.Project
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import java.util.concurrent.TimeUnit
var nettyVersion = "4.1.67.Final"
fun Project.excludeTest() {
if (gradle.startParameter.taskNames.firstOrNull { taskName ->
taskName.contains("test", true)
} == null) {
tasks.run {
named("test") { it.enabled = false }
named("testClasses") { it.enabled = false }
named("compileTestJava") { it.enabled = false }
try {
named("compileTestKotlin") { it.enabled = false }
} catch (e: Exception) {
}
named("processTestResources") { it.enabled = false }
}
}
}
fun Project.publish(publish: PublishingExtension) {
val properties = rootProject.properties
publish.repositories { repositoryHandler ->
try {
repositoryHandler.maven { repository ->
repository.name = "tursom"
repository.url = if (version.toString().endsWith("SNAPSHOT")) {
uri("https://nvm.tursom.cn/repository/maven-snapshots/")
} else {
uri("https://nvm.tursom.cn/repository/maven-releases/")
}
repository.credentials { credentials ->
val artifactoryUser: String = rootProject.ext["tursom.artifactoryUser"]!!.toString()
val artifactoryPassword: String = rootProject.ext["tursom.artifactoryPassword"]!!.toString()
credentials.username = artifactoryUser
credentials.password = artifactoryPassword
}
}
} catch (e: Exception) {
println("cannot publish to repository tursom:\n${e.javaClass}: ${e.message}")
}
val repositoriesRegex = "repositories\\.[a-zA-z][a-zA-z0-9]*".toRegex()
properties.keys.asSequence().filter {
it matches repositoriesRegex
}.forEach { repositoryName ->
try {
val artifactoryUser = rootProject.ext["$repositoryName.artifactoryUser"]?.toString()
?: throw Exception("no artifactory user found")
val artifactoryPassword = rootProject.ext["$repositoryName.artifactoryPassword"]?.toString()
?: throw Exception("no artifactory password found")
repositoryHandler.maven { repository ->
repository.name = properties["$repository.name"]?.toString()
?: repositoryName.substringAfterLast('.')
val releasesRepoUrl = properties["$repositoryName.release"]?.let {
uri(it.toString())
}
val snapshotRepoUrl = properties["$repositoryName.snapshot"]?.let {
uri(it.toString())
}
val repoUrl = properties["$repositoryName.url"]?.let {
uri(it.toString())
}
repository.url = if (version.toString().endsWith("SNAPSHOT") && snapshotRepoUrl != null) {
snapshotRepoUrl
} else {
releasesRepoUrl
} ?: repoUrl ?: throw Exception("no repo found")
repository.credentials {
it.username = artifactoryUser
it.password = artifactoryPassword
}
}
} catch (e: Exception) {
println(
"cannot publish to repository ${repositoryName.substringAfterLast('.')}:\n" +
"${e.javaClass}: ${e.message}"
)
}
}
}
publish.publications {
it.create("maven", MavenPublication::class.java) { mavenPublication ->
mavenPublication.groupId = project.group.toString()
mavenPublication.artifactId = project.name
mavenPublication.version = project.version.toString()
try {
mavenPublication.from(components.getByName("java"))
} catch (e: Exception) {
}
try {
mavenPublication.artifact(tasks.getByName("kotlinSourcesJar"))
} catch (e: Exception) {
}
}
}
}
fun ConfigurationContainer.noExpire() {
all {
it.resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
it.resolutionStrategy.cacheDynamicVersionsFor(0, TimeUnit.SECONDS)
}
}
fun Project.userTursomRepositories(
useAliyunMirror: Boolean = false,
mavenCentral: Boolean = false,
tursom: Boolean = true
) {
repositories.run {
if (useAliyunMirror) {
maven {
it.url = uri("https://maven.aliyun.com/repository/public")
}
}
if (mavenCentral) {
mavenCentral()
}
if (tursom) {
maven {
it.url = uri("https://nvm.tursom.cn/repository/maven-public")
}
}
}
}

View File

@ -0,0 +1,105 @@
package cn.tursom.gradle
import excludeTest
import ext
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.yaml.snakeyaml.Yaml
import publish
import java.io.FileNotFoundException
import java.util.*
class TursomGradlePlugin : Plugin<Project> {
companion object {
val yaml = Yaml()
var project: Project? = null
private set
}
override fun apply(target: Project) {
project = target
listOf(
"local.properties",
"local.yml",
"local.yaml",
"gradle.yml",
"gradle.yaml"
).forEach { propertiesFile ->
when {
propertiesFile.endsWith(".properties") -> loadProperties(target, propertiesFile)
propertiesFile.endsWith(".yml") || propertiesFile.endsWith(".yaml") ->
loadYaml(target, propertiesFile)
}
}
//println(target.ext.properties)
target.excludeTest()
try {
target.extensions.configure<PublishingExtension>("publishing") {
target.publish(it)
}
} catch (e: Exception) {
}
if (try {
target.tasks.findByName("install")
} catch (e: Exception) {
null
} == null
) run install@{
val publishToMavenLocal = target.tasks.findByName("publishToMavenLocal") ?: return@install
target.tasks.register("install", DefaultTask::class.java) {
it.finalizedBy(publishToMavenLocal)
}
}
}
}
fun loadProperties(target: Project, propertiesFile: String) = try {
val properties = Properties()
properties.load(target.file(propertiesFile).inputStream())
properties.forEach { (k, v) ->
setProperty(target, k.toString(), v)
}
} catch (e: Exception) {
}
fun loadYaml(target: Project, propertiesFile: String) {
try {
TursomGradlePlugin.yaml.load<Map<String, Any>>(target.file(propertiesFile).inputStream()).forEach { (k, v) ->
put(target, k, v)
}
} catch (e: Exception) {
if (e !is FileNotFoundException) {
e.printStackTrace()
}
}
}
fun put(target: Project, key: String, value: Any?) {
when (value) {
null -> return
is String, is Byte, is Short, is Int, is Long, is Float, is Double, is Char ->
setProperty(target, key, value)
else -> {
setProperty(target, key, value)
if (value is Map<*, *>) {
value.forEach { (k, v) ->
put(target, "$key.$k", v)
}
}
}
}
}
fun setProperty(target: Project, key: String, value: Any) {
target.ext.set(key, value)
try {
target.setProperty(key, value)
} catch (e: Exception) {
}
}

View File

@ -0,0 +1,258 @@
@file:Suppress("unused", "ObjectPropertyName", "FunctionName")
package cn.tursom.gradle
import org.gradle.api.Action
import org.gradle.api.artifacts.ExternalModuleDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
var commonVersion = "1.1-SNAPSHOT"
private fun DependencyHandler.add(
configurationName: String,
name: String,
group: String = "cn.tursom",
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = create(mapOf(
"group" to group,
"name" to name,
"version" to version,
"configuration" to configuration,
"classifier" to classifier,
"ext" to ext
).filter { it.value != null }).let {
it as ExternalModuleDependency
dependencyConfiguration?.execute(it)
add(configurationName, it)
it
}
fun DependencyHandler.tursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("implementation", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.implementationTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("implementation", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.testImplementationTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("testImplementation", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.apiTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("api", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.testApiTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("testApi", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.compileOnlyTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("compileOnly", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.testCompileOnlyTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("testCompileOnly", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.runtimeOnlyTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("runtimeOnly", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
fun DependencyHandler.testRuntimeOnlyTursomServer(
name: String,
version: String = commonVersion,
configuration: String? = null,
classifier: String? = null,
ext: String? = null,
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = add("testRuntimeOnly", name, "cn.tursom", version, configuration, classifier, ext, dependencyConfiguration)
val DependencyHandler.`ts-core` get() = tursomServer("ts-core")
val DependencyHandler.`ts-async-http` get() = tursomServer("ts-async-http")
val DependencyHandler.`ts-buffer` get() = tursomServer("ts-buffer")
val DependencyHandler.`ts-clone` get() = tursomServer("ts-clone")
val DependencyHandler.`ts-coroutine` get() = tursomServer("ts-coroutine")
val DependencyHandler.`ts-coroutine-lock` get() = tursomServer("ts-coroutine-lock")
val DependencyHandler.`ts-datastruct` get() = tursomServer("ts-datastruct")
val DependencyHandler.`ts-delegation` get() = tursomServer("ts-delegation")
val DependencyHandler.`ts-observer` get() = tursomServer("ts-observer")
val DependencyHandler.`ts-encrypt` get() = tursomServer("ts-encrypt")
val DependencyHandler.`ts-hash` get() = tursomServer("ts-hash")
val DependencyHandler.`ts-json` get() = tursomServer("ts-json")
val DependencyHandler.`ts-log` get() = tursomServer("ts-log")
val DependencyHandler.`ts-mail` get() = tursomServer("ts-mail")
val DependencyHandler.`ts-pool` get() = tursomServer("ts-pool")
val DependencyHandler.`ts-ws-client` get() = tursomServer("ts-ws-client")
val DependencyHandler.`ts-xml` get() = tursomServer("ts-xml")
val DependencyHandler.`ts-yaml` get() = tursomServer("ts-yaml")
val DependencyHandler.`ts-database` get() = tursomServer("ts-database")
val DependencyHandler.`ts-mongodb` get() = tursomServer("ts-mongodb")
val DependencyHandler.`ts-mongodb-spring` get() = tursomServer("ts-mongodb-spring")
val DependencyHandler.`ts-redis` get() = tursomServer("ts-redis")
val DependencyHandler.`ts-gradle` get() = tursomServer("ts-gradle")
val DependencyHandler.`ts-socket` get() = tursomServer("ts-socket")
val DependencyHandler.`ts-web` get() = tursomServer("ts-web")
val DependencyHandler.`ts-web-coroutine` get() = tursomServer("ts-web-coroutine")
val DependencyHandler.`ts-web-netty` get() = tursomServer("ts-web-netty")
fun DependencyHandler.`ts-core`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-core", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-async-http`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-async-http", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-buffer`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-buffer", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-clone`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-clone", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-coroutine`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-coroutine", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-coroutine-lock`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-coroutine-lock", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-datastruct`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-datastruct", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-delegation`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-delegation", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-observer`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-observer", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-encrypt`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-encrypt", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-hash`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-hash", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-json`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-json", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-log`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-log", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-mail`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-mail", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-pool`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-pool", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-ws-client`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-ws-client", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-xml`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-xml", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-yaml`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-yaml", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-database`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-database", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-mongodb`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-mongodb", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-mongodb-spring`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-mongodb-spring", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-redis`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-redis", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-gradle`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-gradle", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-socket`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-socket", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-web`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-web", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-web-coroutine`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-web-coroutine", dependencyConfiguration = dependencyConfiguration)
fun DependencyHandler.`ts-web-netty`(
dependencyConfiguration: Action<ExternalModuleDependency>? = null
) = tursomServer("ts-web-netty", dependencyConfiguration = dependencyConfiguration)

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -12,27 +13,6 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -10,28 +11,3 @@ dependencies {
compileOnly(project(":ts-core:ts-json")) compileOnly(project(":ts-core:ts-json"))
implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -12,27 +13,6 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
`maven-publish` `maven-publish`
id("ts-gradle")
} }
dependencies { dependencies {
@ -8,31 +9,10 @@ dependencies {
api(project(":ts-core:ts-buffer")) api(project(":ts-core:ts-buffer"))
api(project(":ts-core:ts-log")) api(project(":ts-core:ts-log"))
api(project(":ts-web")) api(project(":ts-web"))
api(group = "io.netty", name = "netty-all", version = "4.1.67.Final") api(group = "io.netty", name = "netty-all", version = nettyVersion)
api(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") api(group = "org.slf4j", name = "slf4j-api", version = "1.7.32")
} }
@kotlin.Suppress("UNCHECKED_CAST")
(rootProject.ext["excludeTest"] as (Project, TaskContainer) -> Unit)(project, tasks)
tasks.register("install") {
finalizedBy(tasks["publishToMavenLocal"])
}
publishing {
@Suppress("UNCHECKED_CAST")
(rootProject.ext["publishRepositories"] as (Project, PublishingExtension) -> Unit)(project, this)
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
try {
artifact(tasks["kotlinSourcesJar"])
} catch (e: Exception) {
}
}
}
}