This is an automated email from the ASF dual-hosted git repository.
mjsax pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 301b784 KAFKA-8960: Move Task determineCommitId in gradle.build to
Project Level (#7420)
301b784 is described below
commit 301b784d1b4e8672061e04613bd712ad15dfc734
Author: ravowlga123 <[email protected]>
AuthorDate: Mon Nov 25 02:44:20 2019 +0100
KAFKA-8960: Move Task determineCommitId in gradle.build to Project Level
(#7420)
Reviewers: Matthias J. Sax <[email protected]>, Ismael Juma
<[email protected]>
---
build.gradle | 57 +++++++++++++++++++--------------------------------------
1 file changed, 19 insertions(+), 38 deletions(-)
diff --git a/build.gradle b/build.gradle
index ee96a29..5a4a2a2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -521,6 +521,25 @@ subprojects {
def coverageGen = it.path == ':core' ? 'reportScoverage' : 'jacocoTestReport'
task reportCoverage(dependsOn: [coverageGen])
+ task determineCommitId {
+ def takeFromHash = 16
+ if (commitId) {
+ commitId = commitId.take(takeFromHash)
+ } else if (file("$rootDir/.git/HEAD").exists()) {
+ def headRef = file("$rootDir/.git/HEAD").text
+ if (headRef.contains('ref: ')) {
+ headRef = headRef.replaceAll('ref: ', '').trim()
+ if (file("$rootDir/.git/$headRef").exists()) {
+ commitId =
file("$rootDir/.git/$headRef").text.trim().take(takeFromHash)
+ }
+ } else {
+ commitId = headRef.trim().take(takeFromHash)
+ }
+ } else {
+ commitId = "unknown"
+ }
+ }
+
}
gradle.taskGraph.whenReady { taskGraph ->
@@ -996,25 +1015,6 @@ project(':clients') {
testCompile libs.jacksonJaxrsJsonProvider
}
- task determineCommitId {
- def takeFromHash = 16
- if (commitId) {
- commitId = commitId.take(takeFromHash)
- } else if (file("$rootDir/.git/HEAD").exists()) {
- def headRef = file("$rootDir/.git/HEAD").text
- if (headRef.contains('ref: ')) {
- headRef = headRef.replaceAll('ref: ', '').trim()
- if (file("$rootDir/.git/$headRef").exists()) {
- commitId =
file("$rootDir/.git/$headRef").text.trim().take(takeFromHash)
- }
- } else {
- commitId = headRef.trim().take(takeFromHash)
- }
- } else {
- commitId = "unknown"
- }
- }
-
task createVersionFile(dependsOn: determineCommitId) {
ext.receiptFile = file("$buildDir/kafka/$buildVersionFileName")
outputs.file receiptFile
@@ -1229,25 +1229,6 @@ project(':streams') {
duplicatesStrategy 'exclude'
}
- task determineCommitId {
- def takeFromHash = 16
- if (commitId) {
- commitId = commitId.take(takeFromHash)
- } else if (file("$rootDir/.git/HEAD").exists()) {
- def headRef = file("$rootDir/.git/HEAD").text
- if (headRef.contains('ref: ')) {
- headRef = headRef.replaceAll('ref: ', '').trim()
- if (file("$rootDir/.git/$headRef").exists()) {
- commitId =
file("$rootDir/.git/$headRef").text.trim().take(takeFromHash)
- }
- } else {
- commitId = headRef.trim().take(takeFromHash)
- }
- } else {
- commitId = "unknown"
- }
- }
-
task createStreamsVersionFile(dependsOn: determineCommitId) {
ext.receiptFile = file("$buildDir/kafka/$buildStreamsVersionFileName")
outputs.file receiptFile