diff --git a/build.gradle b/build.gradle index c951ab2..35b05c0 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,9 @@ import java.nio.charset.StandardCharsets plugins { id 'java' id 'java-library' - id 'maven-publish' 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 'org.ajoberstar.grgit' version '5.0.0' } @@ -22,13 +22,13 @@ else if (isCleanBuild()) { print "git: clean build at ${grgit.head().id}" } else { final Status status = grgit.status() - println "git: non-clean-build" + print "git: non-clean-build" if (!status.unstaged.allChanges.empty) { - println "git: unstaged changes" + print "\ngit: unstaged changes" listChanges(status.unstaged) } if (!status.staged.allChanges.empty) { - println "[MornyBuild] git: staged changes" + print "\ngit: staged changes" listChanges(status.staged) } } @@ -36,6 +36,7 @@ else if (isCleanBuild()) { final String proj_group = 'cc.sukazyo' final String proj_package = "${proj_group}.cono.morny" 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_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 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 version proj_version -project.ext.archiveBaseName = proj_archive_name -project.ext.artifactId = proj_archive_name -mainClassName = "${proj_package}.ServerMain" +setArchivesBaseName proj_archive_name repositories { mavenCentral() @@ -74,6 +84,10 @@ dependencies { } +application { + mainClass = proj_application_main +} + test { useJUnitPlatform() } @@ -115,9 +129,7 @@ buildConfig { } shadowJar { - archiveBaseName.set("${project.ext.archiveBaseName}") - archiveVersion.set("${project.version}") - archiveClassifier.set("fat") + archiveClassifier.set "fat" } @SuppressWarnings("all") @@ -134,34 +146,34 @@ boolean isCleanBuild () { void listChanges (Status.Changes listing) { for (String file in listing.added) - println " add: ${file}" + print "\n add: ${file}" for (String file in listing.modified) - println " mod: ${file}" + print "\n mod: ${file}" for (String file in listing.removed) - println " del: ${file}" + print "\n del: ${file}" } publishing { repositories{ - maven { - name 'builds' - url publishLocalArchiveRepoUrl + if (publish_local_url != null) maven { + name 'archives' + url publish_local_url } - maven { + if (publish_remote_url != null) maven { name '-ws-' - url publishMvnRepoUrl + url publish_remote_url credentials { - username publishMvnRepoUsername - password publishMvnRepoPassword + username publish_remote_username + password publish_remote_password } } } publications { main (MavenPublication) { from components.java - groupId = project.group - artifactId = project.ext.artifactId - version = project.version + groupId = proj_group + artifactId = proj_archive_name + version = proj_version } } } diff --git a/gradle.properties b/gradle.properties index 01d5e1a..3db275d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,8 @@ MORNY_ARCHIVE_NAME = morny-coeur VERSION = 1.0.0-alpha3 -USE_DELTA = true -VERSION_DELTA = 11061142 +USE_DELTA = false +VERSION_DELTA = CODENAME = beiping diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME 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 zipStorePath=wrapper/dists