mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 03:04:54 +08:00
更新了打包配置
- 设置了全局 archivesBaseName - 对一些属性的声明方式进行了调整 - 为 maven publish 添加了动态配置,以在没有配置 publish url 的机器上也能够正常运行基础功能 - gradle plugin: shadow: 7.1.0 -> 7.1.2 - gradle wrapper: 7.3 -> 7.5.1 - 稍微修改了 git 状态的 log 输出方式
This commit is contained in:
parent
3c7de7037d
commit
f362d08f34
60
build.gradle
60
build.gradle
@ -6,9 +6,9 @@ import java.nio.charset.StandardCharsets
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'maven-publish'
|
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'com.github.johnrengelman.shadow' version '7.1.0'
|
id 'maven-publish'
|
||||||
|
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||||
id 'com.github.gmazzo.buildconfig' version '3.1.0'
|
id 'com.github.gmazzo.buildconfig' version '3.1.0'
|
||||||
id 'org.ajoberstar.grgit' version '5.0.0'
|
id 'org.ajoberstar.grgit' version '5.0.0'
|
||||||
}
|
}
|
||||||
@ -22,13 +22,13 @@ else if (isCleanBuild()) {
|
|||||||
print "git: clean build at ${grgit.head().id}"
|
print "git: clean build at ${grgit.head().id}"
|
||||||
} else {
|
} else {
|
||||||
final Status status = grgit.status()
|
final Status status = grgit.status()
|
||||||
println "git: non-clean-build"
|
print "git: non-clean-build"
|
||||||
if (!status.unstaged.allChanges.empty) {
|
if (!status.unstaged.allChanges.empty) {
|
||||||
println "git: unstaged changes"
|
print "\ngit: unstaged changes"
|
||||||
listChanges(status.unstaged)
|
listChanges(status.unstaged)
|
||||||
}
|
}
|
||||||
if (!status.staged.allChanges.empty) {
|
if (!status.staged.allChanges.empty) {
|
||||||
println "[MornyBuild] git: staged changes"
|
print "\ngit: staged changes"
|
||||||
listChanges(status.staged)
|
listChanges(status.staged)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,6 +36,7 @@ else if (isCleanBuild()) {
|
|||||||
final String proj_group = 'cc.sukazyo'
|
final String proj_group = 'cc.sukazyo'
|
||||||
final String proj_package = "${proj_group}.cono.morny"
|
final String proj_package = "${proj_group}.cono.morny"
|
||||||
final String proj_archive_name = MORNY_ARCHIVE_NAME
|
final String proj_archive_name = MORNY_ARCHIVE_NAME
|
||||||
|
final String proj_application_main = "${proj_package}.ServerMain"
|
||||||
|
|
||||||
final String proj_version_base = VERSION
|
final String proj_version_base = VERSION
|
||||||
final String proj_version_delta = VERSION_DELTA
|
final String proj_version_delta = VERSION_DELTA
|
||||||
@ -49,11 +50,20 @@ final long proj_code_time = proj_clean ? grgit.head().dateTime.toInstant().toEpo
|
|||||||
final JavaVersion proj_java = JavaVersion.VERSION_17
|
final JavaVersion proj_java = JavaVersion.VERSION_17
|
||||||
final Charset proj_file_encoding = StandardCharsets.UTF_8
|
final Charset proj_file_encoding = StandardCharsets.UTF_8
|
||||||
|
|
||||||
|
String publish_local_url = null
|
||||||
|
String publish_remote_url = null
|
||||||
|
String publish_remote_username = null
|
||||||
|
String publish_remote_password = null
|
||||||
|
if (project.hasProperty("publishLocalArchiveRepoUrl")) publish_local_url = publishLocalArchiveRepoUrl
|
||||||
|
if (project.hasProperty("publishMvnRepoUrl")) {
|
||||||
|
publish_remote_url = publishMvnRepoUrl
|
||||||
|
publish_remote_username = publishMvnRepoUsername
|
||||||
|
publish_remote_password = publishMvnRepoPassword
|
||||||
|
}
|
||||||
|
|
||||||
group proj_group
|
group proj_group
|
||||||
version proj_version
|
version proj_version
|
||||||
project.ext.archiveBaseName = proj_archive_name
|
setArchivesBaseName proj_archive_name
|
||||||
project.ext.artifactId = proj_archive_name
|
|
||||||
mainClassName = "${proj_package}.ServerMain"
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -74,6 +84,10 @@ dependencies {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
application {
|
||||||
|
mainClass = proj_application_main
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
@ -115,9 +129,7 @@ buildConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveBaseName.set("${project.ext.archiveBaseName}")
|
archiveClassifier.set "fat"
|
||||||
archiveVersion.set("${project.version}")
|
|
||||||
archiveClassifier.set("fat")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@ -134,34 +146,34 @@ boolean isCleanBuild () {
|
|||||||
|
|
||||||
void listChanges (Status.Changes listing) {
|
void listChanges (Status.Changes listing) {
|
||||||
for (String file in listing.added)
|
for (String file in listing.added)
|
||||||
println " add: ${file}"
|
print "\n add: ${file}"
|
||||||
for (String file in listing.modified)
|
for (String file in listing.modified)
|
||||||
println " mod: ${file}"
|
print "\n mod: ${file}"
|
||||||
for (String file in listing.removed)
|
for (String file in listing.removed)
|
||||||
println " del: ${file}"
|
print "\n del: ${file}"
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
repositories{
|
repositories{
|
||||||
maven {
|
if (publish_local_url != null) maven {
|
||||||
name 'builds'
|
name 'archives'
|
||||||
url publishLocalArchiveRepoUrl
|
url publish_local_url
|
||||||
}
|
}
|
||||||
maven {
|
if (publish_remote_url != null) maven {
|
||||||
name '-ws-'
|
name '-ws-'
|
||||||
url publishMvnRepoUrl
|
url publish_remote_url
|
||||||
credentials {
|
credentials {
|
||||||
username publishMvnRepoUsername
|
username publish_remote_username
|
||||||
password publishMvnRepoPassword
|
password publish_remote_password
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
publications {
|
publications {
|
||||||
main (MavenPublication) {
|
main (MavenPublication) {
|
||||||
from components.java
|
from components.java
|
||||||
groupId = project.group
|
groupId = proj_group
|
||||||
artifactId = project.ext.artifactId
|
artifactId = proj_archive_name
|
||||||
version = project.version
|
version = proj_version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ MORNY_ARCHIVE_NAME = morny-coeur
|
|||||||
|
|
||||||
VERSION = 1.0.0-alpha3
|
VERSION = 1.0.0-alpha3
|
||||||
|
|
||||||
USE_DELTA = true
|
USE_DELTA = false
|
||||||
VERSION_DELTA = 11061142
|
VERSION_DELTA =
|
||||||
|
|
||||||
CODENAME = beiping
|
CODENAME = beiping
|
||||||
|
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
Loading…
Reference in New Issue
Block a user