Skip to content

Commit

Permalink
Fix publishing after gradle update
Browse files Browse the repository at this point in the history
  • Loading branch information
alula committed Jun 6, 2024
1 parent ff6f900 commit be090b9
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
def getGitVersion() {
def versionStr = new ByteArrayOutputStream()
def result = exec {
standardOutput versionStr
errorOutput versionStr
ignoreExitValue true
commandLine "git", "describe", "--exact-match", "--tags"
}
if (result.exitValue == 0) {
return [versionStr.toString().trim(), false]
}


versionStr = new ByteArrayOutputStream()
exec {
standardOutput versionStr
errorOutput versionStr
commandLine "git", "rev-parse", "--short", "HEAD"
}

return [versionStr.toString().trim(), true]
}

subprojects {
apply plugin: 'maven-publish'
apply plugin: 'java-library'

group = 'moe.kyokobot'
//version = '2.0.0-SNAPSHOT'

if (project.hasProperty('version')) {
// Used by JitPack
version = project.version
} else {
// Get version from git
def gitVersion = getGitVersion()
version = gitVersion[0]
}

sourceCompatibility = 11
targetCompatibility = 11
Expand All @@ -15,4 +46,12 @@ subprojects {
jcenter()
maven { url "https://jitpack.io/" }
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
}

0 comments on commit be090b9

Please sign in to comment.