build: 优化构建脚本
优化构建脚本
This commit is contained in:
15
build.gradle
15
build.gradle
@@ -18,6 +18,11 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
api.extendsFrom apiShade
|
||||
implementation.extendsFrom implementationShade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly group: 'org.jetbrains', name: 'annotations', version: '21.0.1'
|
||||
}
|
||||
@@ -38,14 +43,10 @@ subprojects {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
destinationDir(rootProject.buildDir)
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from getProject().getComponents().java
|
||||
from project.components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
@@ -56,8 +57,8 @@ subprojects {
|
||||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
|
||||
credentials {
|
||||
username rootProject.getProperties().getOrDefault("maven_username", "")
|
||||
password rootProject.getProperties().getOrDefault("maven_password", "")
|
||||
username rootProject.properties.getOrDefault("maven_username", "")
|
||||
password rootProject.properties.getOrDefault("maven_password", "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,13 +2,10 @@ setArchivesBaseName("HamsterCore-Bukkit")
|
||||
|
||||
evaluationDependsOn(':hamster-core-common')
|
||||
|
||||
configurations {
|
||||
api.extendsFrom apiShade
|
||||
implementation.extendsFrom implementationShade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":hamster-core-common")
|
||||
apiShade(project(":hamster-core-common")) {
|
||||
exclude group: "*"
|
||||
}
|
||||
compileOnly 'org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT'
|
||||
|
||||
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
|
||||
@@ -34,24 +31,13 @@ processResources {
|
||||
}
|
||||
}
|
||||
|
||||
task addSource {
|
||||
doLast {
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs += [
|
||||
project(':hamster-core-common').sourceSets.main.java
|
||||
]
|
||||
resources.srcDirs += [
|
||||
project(':hamster-core-common').sourceSets.main.resources
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
classes.dependsOn(addSource)
|
||||
|
||||
jar {
|
||||
tasks.compileJava.dependsOn(":hamster-core-common:build")
|
||||
tasks.create("shadowJar", Jar) {
|
||||
dependsOn("jar")
|
||||
from([
|
||||
tasks.jar.outputs.files.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
},
|
||||
configurations.implementationShade.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
},
|
||||
@@ -59,4 +45,6 @@ jar {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
])
|
||||
destinationDir(getRootProject().buildDir)
|
||||
}
|
||||
tasks.build.dependsOn(shadowJar)
|
||||
|
@@ -2,13 +2,10 @@ setArchivesBaseName("HamsterCore-Proxy")
|
||||
|
||||
evaluationDependsOn(':hamster-core-common')
|
||||
|
||||
configurations {
|
||||
api.extendsFrom apiShade
|
||||
implementation.extendsFrom implementationShade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":hamster-core-common")
|
||||
apiShade(project(":hamster-core-common")) {
|
||||
exclude group: "*"
|
||||
}
|
||||
//noinspection GradlePackageUpdate
|
||||
compileOnly('net.md-5:bungeecord-api:1.17-R0.1-SNAPSHOT')
|
||||
|
||||
@@ -35,24 +32,13 @@ processResources {
|
||||
}
|
||||
}
|
||||
|
||||
task addSource {
|
||||
doLast {
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs += [
|
||||
project(':hamster-core-common').sourceSets.main.java
|
||||
]
|
||||
resources.srcDirs += [
|
||||
project(':hamster-core-common').sourceSets.main.resources
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
classes.dependsOn(addSource)
|
||||
|
||||
jar {
|
||||
tasks.compileJava.dependsOn(":hamster-core-common:build")
|
||||
tasks.create("shadowJar", Jar) {
|
||||
dependsOn("jar")
|
||||
from([
|
||||
tasks.jar.outputs.files.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
},
|
||||
configurations.implementationShade.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
},
|
||||
@@ -60,4 +46,6 @@ jar {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
])
|
||||
destinationDir(getRootProject().buildDir)
|
||||
}
|
||||
tasks.build.dependsOn(shadowJar)
|
||||
|
Reference in New Issue
Block a user