Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 15 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,32 @@ idea {
// -----------------------------------------------------
// Publishing

def latestCommitHash() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
Provider<String> latestCommitHash() {
return providers.exec {
commandLine = ["git", "rev-parse", "--short", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
}

def latestCommitMessage() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%B'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
Provider<String> latestCommitMessage() {
return providers.exec {
commandLine = ["git", "log", "-1", "--pretty=%B"]
}.standardOutput.getAsText().map(String::trim)
}

def branchName() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
Provider<String> branchName() {
return providers.exec {
commandLine = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
}

def branch = branchName()
def branch = branchName().get()
def baseVersion = project.maven_version
def isRelease = !baseVersion.contains('-')
def isMainBranch = branch == "master"
if (!isRelease || isMainBranch) { // Only publish releases from the main branch
def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
def commitHash = latestCommitHash()
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/ViaRewind/commit/${commitHash}) ${latestCommitMessage()}"
def commitHash = latestCommitHash().get()
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/ViaRewind/commit/${commitHash}) ${latestCommitMessage().get()}"
modrinth {
def mcVersions = project.mcVersions
.split(',')
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sourceSets {
main {
classTokenReplacer {
property("\${version}", rootProject.maven_version)
property("\${impl_version}", "git-ViaRewind-${rootProject.maven_version}:${rootProject.latestCommitHash()}")
property("\${impl_version}", "git-ViaRewind-${rootProject.maven_version}:${rootProject.latestCommitHash().get()}")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionSha256Sum=57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down