perf: 优化代码

This commit is contained in:
2023-06-06 11:11:42 +08:00
parent fce720e795
commit 31510cf599
4 changed files with 86 additions and 33 deletions

View File

@@ -58,27 +58,4 @@ subprojects {
'https://bukkit.windit.net/javadoc'
]
}
publishing {
publications {
mavenJava(MavenPublication) {
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from project.components.java
}
}
repositories {
maven {
def releasesRepoUrl = 'https://maven.airgame.net/maven-releases/'
def snapshotsRepoUrl = 'https://maven.airgame.net/maven-snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = rootProject.properties.getOrDefault("maven_username", "")
password = rootProject.properties.getOrDefault("maven_password", "")
}
}
}
}
}

View File

@@ -1,3 +1,4 @@
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
@@ -10,9 +11,6 @@ configurations {
}
dependencies {
api project(":hamster-core-common") transitive false
shade project(":hamster-core-common") transitive false
implementation "de.tr7zw:item-nbt-api:2.11.2"
//noinspection VulnerableLibrariesLocal
@@ -21,10 +19,9 @@ dependencies {
compileOnly 'net.milkbowl.vault:VaultAPI:1.7' transitive false
compileOnly 'org.black_ixx:playerpoints:2.1.3' transitive false
api project(":hamster-core-common") transitive false
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bukkit
api "net.kyori:adventure-platform-bukkit:${adventure_version}"
//noinspection VulnerableLibrariesLocal
oldJar "net.kyori:adventure-platform-bukkit:${adventure_version}"
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
api "net.kyori:adventure-text-minimessage:${adventure_serializer_version}"
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
@@ -32,14 +29,13 @@ dependencies {
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
api "net.kyori:adventure-text-serializer-legacy:${adventure_serializer_version}"
// // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
// api 'com.squareup.okhttp3:okhttp:4.10.0'
// oldJar 'com.squareup.okhttp3:okhttp:4.10.0'
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
compileOnly "com.zaxxer:HikariCP:${HikariCP_version}"
//noinspection GradlePackageUpdate
oldJar 'com.zaxxer:HikariCP:4.0.3'
//noinspection VulnerableLibrariesLocal
oldJar "net.kyori:adventure-platform-bukkit:${adventure_version}"
}
processResources {
@@ -52,6 +48,12 @@ processResources {
}
}
jar {
//noinspection GrDeprecatedAPIUsage
classifier = "jar"
}
tasks.compileJava.dependsOn(":hamster-core-common:build")
shadowJar {
//noinspection GrDeprecatedAPIUsage
@@ -84,4 +86,29 @@ tasks.register("oldJar", Jar) {
])
destinationDir(getRootProject().buildDir)
}
tasks.build.dependsOn(oldJar)
tasks.build.dependsOn(oldJar)
publishing {
publications {
shadow(MavenPublication) { publication ->
{
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from components.java
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://maven.airgame.net/maven-releases/'
def snapshotsRepoUrl = 'https://maven.airgame.net/maven-snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = rootProject.properties.getOrDefault("maven_username", "")
password = rootProject.properties.getOrDefault("maven_password", "")
}
}
}
}

View File

@@ -1,3 +1,4 @@
//file:noinspection GroovyAssignabilityCheck
setArchivesBaseName("HamsterCore-BungeeCord")
evaluationDependsOn(':hamster-core-common')
@@ -68,3 +69,27 @@ tasks.register("oldJar", Jar) {
destinationDir(getRootProject().buildDir)
}
tasks.build.dependsOn(oldJar)
publishing {
publications {
mavenJava(MavenPublication) {
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from project.components.java
}
}
repositories {
maven {
def releasesRepoUrl = 'https://maven.airgame.net/maven-releases/'
def snapshotsRepoUrl = 'https://maven.airgame.net/maven-snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = rootProject.properties.getOrDefault("maven_username", "")
password = rootProject.properties.getOrDefault("maven_password", "")
}
}
}
}

View File

@@ -1,3 +1,4 @@
//file:noinspection GroovyAssignabilityCheck
setArchivesBaseName("HamsterCore-Common")
dependencies {
@@ -28,3 +29,26 @@ dependencies {
test {
useJUnitPlatform()
}
publishing {
publications {
mavenJava(MavenPublication) {
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from project.components.java
}
}
repositories {
maven {
def releasesRepoUrl = 'https://maven.airgame.net/maven-releases/'
def snapshotsRepoUrl = 'https://maven.airgame.net/maven-snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = rootProject.properties.getOrDefault("maven_username", "")
password = rootProject.properties.getOrDefault("maven_password", "")
}
}
}
}