Skip to content

Commit

Permalink
split server to new module
Browse files Browse the repository at this point in the history
  • Loading branch information
RTAkland committed Jan 4, 2025
1 parent 8079c8a commit 3fc5e68
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
}
```

> [这里](https://maven.rtast.cn/#/releases/cn/rtast/kwsify/api)查看所有版本(记得使用`api`模块而不是`kwsify`模块)
> [这里](https://pkg.rtast.cn/#/releases/cn/rtast/kwsify-api)查看所有版本(记得使用`api`模块而不是`kwsify`模块)
### 开始使用

Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ repositories {

dependencies {
api(libs.java.websocket)
api(rootProject)
api(project(":server"))
}
56 changes: 8 additions & 48 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,69 +1,28 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.shadow)
id("application")
id("maven-publish")
}

val appVersion: String by project
val libVersion: String by project

group = "cn.rtast"
version = appVersion

repositories {
mavenCentral()
}

dependencies {
implementation(libs.gson)
implementation(libs.kotlinx.cli)
implementation(libs.java.websocket)
}

application {
mainClass = "cn.rtast.kwsify.MainKt"
}
allprojects {
group = "cn.rtast"
version = appVersion

tasks.shadowJar {
enabled = false
}
tasks.register<ShadowJar>("buildShadowJar") {
group = "build"
description = "Manually build the shadow JAR file"
archiveClassifier.set("all")
from(sourceSets.main.get().output)
configurations = listOf(project.configurations.runtimeClasspath.get())
manifest {
attributes(mapOf("Main-Class" to application.mainClass))
repositories {
mavenCentral()
}
}

tasks.named("shadowDistZip") {
dependsOn("buildShadowJar")
}

tasks.named("shadowDistTar") {
dependsOn("buildShadowJar")
}

tasks.named("startShadowScripts") {
dependsOn("buildShadowJar")
}

allprojects {
subprojects {
apply {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "maven-publish")
}

repositories {
mavenCentral()
}

val sourceJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
Expand All @@ -78,7 +37,8 @@ allprojects {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(sourceJar)
artifactId = project.name
groupId = "cn.rtast"
artifactId = "kwsify-${project.name}"
version = libVersion
}
}
Expand Down
43 changes: 43 additions & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
alias(libs.plugins.shadow)
id("application")
}

dependencies {
implementation(libs.gson)
implementation(libs.kotlinx.cli)
implementation(libs.java.websocket)
}

application {
mainClass = "cn.rtast.kwsify.MainKt"
}

tasks.shadowJar {
enabled = false
}

tasks.register<ShadowJar>("buildShadowJar") {
group = "build"
description = "Manually build the shadow JAR file"
archiveClassifier.set("all")
from(sourceSets.main.get().output)
configurations = listOf(project.configurations.runtimeClasspath.get())
manifest {
attributes(mapOf("Main-Class" to application.mainClass))
}
}

tasks.named("shadowDistZip") {
dependsOn("buildShadowJar")
}

tasks.named("shadowDistTar") {
dependsOn("buildShadowJar")
}

tasks.named("startShadowScripts") {
dependsOn("buildShadowJar")
}
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rootProject.name = "kwsify"

include(":api")
include(":server")

0 comments on commit 3fc5e68

Please sign in to comment.