@@ -147,14 +147,8 @@ class BaseBuildPlugin implements Plugin<Project> {
147
147
if (! project. rootProject. ext. has(' settingsConfigured' )) {
148
148
// Force any Elasticsearch test clusters to use packaged java versions if they have them available
149
149
project. rootProject. ext. isRuntimeJavaHomeSet = false
150
-
151
- File gitHead = gitBranch(project)
152
- project. rootProject. ext. gitHead = gitHead
153
- project. rootProject. ext. revHash = gitHash(gitHead)
154
150
project. rootProject. ext. settingsConfigured = true
155
151
}
156
- project. ext. gitHead = project. rootProject. ext. gitHead
157
- project. ext. revHash = project. rootProject. ext. revHash
158
152
project. ext. javaVersions = BuildParams . javaVersions
159
153
project. ext. isRuntimeJavaHomeSet = project. rootProject. ext. isRuntimeJavaHomeSet
160
154
}
@@ -197,44 +191,4 @@ class BaseBuildPlugin implements Plugin<Project> {
197
191
}
198
192
}
199
193
}
200
-
201
- /**
202
- * @param project that belongs to a git repo
203
- * @return the file containing the hash for the current branch
204
- */
205
- private static File gitBranch (Project project ) {
206
- // parse the git files to find out the revision
207
- File gitHead = project. file(" ${ project.rootDir} /.git/HEAD" )
208
- if (gitHead != null && ! gitHead. exists()) {
209
- // Try as a sub module
210
- File subModuleGit = project. file(" ${ project.rootDir} /.git" )
211
- if (subModuleGit != null && subModuleGit. exists()) {
212
- String content = subModuleGit. text. trim()
213
- if (content. startsWith(" gitdir:" )) {
214
- gitHead = project. file(" ${ project.rootDir} /" + content. replace(' gitdir: ' ,' ' ) + " /HEAD" )
215
- }
216
- }
217
- }
218
-
219
- if (gitHead != null && gitHead. exists()) {
220
- String content = gitHead. text. trim()
221
- if (content. startsWith(" ref:" )) {
222
- return project. file(" ${ project.rootDir} /.git/" + content. replace(' ref: ' ,' ' ))
223
- }
224
- return gitHead
225
- }
226
- return null
227
- }
228
-
229
- /**
230
- * @param gitHead file containing the the currently checked out ref
231
- * @return the current commit version hash
232
- */
233
- private static String gitHash (File gitHead ) {
234
- String rev = " unknown"
235
- if (gitHead != null && gitHead. exists()) {
236
- rev = gitHead. text. trim()
237
- }
238
- return rev
239
- }
240
194
}
0 commit comments