mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-25 00:48:45 +00:00
fix(publish): Attempting to fix publish for auth-api (#6695)
This commit is contained in:
parent
1165884c6b
commit
962998feff
@ -10,15 +10,12 @@ apply plugin: 'io.codearte.nexus-staging'
|
||||
apply from: '../../metadata-integration/java/versioning.gradle'
|
||||
|
||||
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
test {
|
||||
useJUnit()
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
zip64 true
|
||||
determineAndSetVersion()
|
||||
classifier = null
|
||||
archiveName = "$project.name-${version}.jar"
|
||||
exclude "META-INF/*.RSA", "META-INF/*.SF","META-INF/*.DSA"
|
||||
@ -37,51 +34,6 @@ dependencies() {
|
||||
testCompile externalDependency.testng
|
||||
}
|
||||
|
||||
def determineAndSetVersion() {
|
||||
def detailedVersionString = "0.0.0-unknown-SNAPSHOT"
|
||||
def snapshotVersion = false
|
||||
if (project.hasProperty("releaseVersion")) {
|
||||
version = releaseVersion
|
||||
detailedVersionString = releaseVersion
|
||||
} else {
|
||||
try {
|
||||
// apply this plugin in a try-catch block so that we can handle cases without .git directory
|
||||
apply plugin: "com.palantir.git-version"
|
||||
def details = versionDetails()
|
||||
detailedVersionString = gitVersion()
|
||||
version = details.lastTag
|
||||
version = version.startsWith("v")? version.substring(1): version
|
||||
def suffix = details.isCleanTag? "": "-SNAPSHOT"
|
||||
snapshotVersion = ! details.isCleanTag
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
// last fall back
|
||||
version = detailedVersionString
|
||||
}
|
||||
}
|
||||
// trim version if it is of size 4 to size 3
|
||||
def versionParts = version.tokenize(".")
|
||||
if (versionParts.size() > 3) {
|
||||
// at-least 4 part version
|
||||
// we check if the 4th part is a .0 in which case we want to create a release
|
||||
if (versionParts[3] != '0') {
|
||||
snapshotVersion = true
|
||||
}
|
||||
versionParts = versionParts[0..2]
|
||||
version = versionParts[0..2].join('.')
|
||||
}
|
||||
|
||||
if (snapshotVersion) {
|
||||
if (versionParts[versionParts.size()-1].isInteger()) {
|
||||
version = versionParts[0..versionParts.size()-2].join('.') + '.' + (versionParts[versionParts.size()-1].toInteger()+1).toString() + "-SNAPSHOT"
|
||||
} else {
|
||||
// we are unable to part the last token as an integer, so we just append SNAPSHOT to this version
|
||||
version = versionParts[0..versionParts.size()-1].join('.') + '-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allJava
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user