Skip to content

Commit

Permalink
Set java/spark version from git tag (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
gspowley authored May 1, 2024
1 parent 3940593 commit 7cc19c1
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ stages:
unset SYSTEM
set +e
ci/collect-nativelibs.sh
displayName: 'Collect Native Libraries'
- task: ArchiveFiles@2
inputs:
Expand Down
25 changes: 24 additions & 1 deletion apis/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,28 @@ plugins {
id 'com.github.johnrengelman.shadow' version '4.0.3'
}

ext.getVersionName = { ->
def stdout = new ByteArrayOutputStream()
try {
// Try to get the version from git
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception e1) {
try {
// Try to get the version from a file
return file("../../version.txt").text.trim()
} catch (Exception e2) {
// Version is unknown
return "unknown"
}
}
}

group 'io.tiledb'
version '0.31.0'
version getVersionName()

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -40,6 +60,9 @@ test {
testLogging {
showStandardStreams = true
}
doLast {
println "\nTileDB-VCF version: ${project.version}"
}
}

// Helper task containing some path information
Expand Down
25 changes: 24 additions & 1 deletion apis/spark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,28 @@ plugins {
id 'com.github.johnrengelman.shadow' version '4.0.3'
}

ext.getVersionName = { ->
def stdout = new ByteArrayOutputStream()
try {
// Try to get the version from git
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception e1) {
try {
// Try to get the version from a file
return file("../../version.txt").text.trim()
} catch (Exception e2) {
// Version is unknown
return "unknown"
}
}
}

group 'io.tiledb'
version '0.31.0'
version getVersionName()

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -50,6 +70,9 @@ test {
testLogging {
showStandardStreams = true
}
doLast {
println "\nTileDB-VCF version: ${project.version}"
}
}

shadowJar {
Expand Down
25 changes: 24 additions & 1 deletion apis/spark3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,28 @@ plugins {
id 'com.github.johnrengelman.shadow' version '4.0.3'
}

ext.getVersionName = { ->
def stdout = new ByteArrayOutputStream()
try {
// Try to get the version from git
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception e1) {
try {
// Try to get the version from a file
return file("../../version.txt").text.trim()
} catch (Exception e2) {
// Version is unknown
return "unknown"
}
}
}

group 'io.tiledb'
version '0.31.0'
version getVersionName()

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -50,6 +70,9 @@ test {
testLogging {
showStandardStreams = true
}
doLast {
println "\nTileDB-VCF version: ${project.version}"
}
}

shadowJar {
Expand Down
4 changes: 4 additions & 0 deletions ci/native_libs-linux_osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ steps:
env: { sourceVersion: $(Build.SourceVersion) }
displayName: Git Hash 7-digit
- bash: |
git describe --tags > $BUILD_REPOSITORY_LOCALPATH/version.txt
displayName: 'Capture version'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)'
Expand Down

0 comments on commit 7cc19c1

Please sign in to comment.