Skip to content

Commit 1778b1a

Browse files
committed
Add manifest information to the jar file's META-INF
1 parent a1d0f96 commit 1778b1a

File tree

5 files changed

+57
-5
lines changed

5 files changed

+57
-5
lines changed

LICENSE LICENSE.txt

File renamed without changes.

NOTICE.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Elasticsearch Java Client
2+
Copyright 2021 Elasticsearch B.V.

build.gradle.kts

+13-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,16 @@ subprojects {
2525
apply(plugin = "checkstyle")
2626
}
2727

28-
/*
29-
TODO:
30-
- checkstyle + reformat
31-
- license check
32-
*/
28+
val grgit = org.ajoberstar.grgit.Grgit.open(mapOf("currentDir" to project.rootDir))
29+
try {
30+
allprojects {
31+
project.extra["gitHashFull"] = grgit.head().id
32+
project.extra["gitCommitTime"] = grgit.head().dateTime.withZoneSameLocal(java.time.ZoneOffset.UTC)
33+
}
34+
} finally {
35+
grgit.close()
36+
}
37+
38+
allprojects {
39+
project.extra["buildTime"] = java.time.Instant.now().atZone(java.time.ZoneOffset.UTC)
40+
}

buildSrc/build.gradle.kts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
dependencies {
21+
implementation("org.ajoberstar.grgit:grgit-gradle:4.0.1")
22+
}
23+
24+
repositories {
25+
maven("https://plugins.gradle.org/m2/")
26+
}

java-client/build.gradle.kts

+16
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ java {
3131
sourceCompatibility = JavaVersion.VERSION_1_8
3232
}
3333

34+
tasks.withType<Jar> {
35+
manifest {
36+
attributes["Implementation-Title"] = "Elasticsearch Java client"
37+
attributes["Implementation-Vendor"] = "Elastic"
38+
attributes["Implementation-URL"] = "https://github.com/elastic/elasticsearch-java/"
39+
attributes["Build-Date"] = project.extra["buildTime"]
40+
attributes["X-Git-Revision"] = project.extra["gitHashFull"]
41+
attributes["X-Git-Commit-Time"] = project.extra["gitCommitTime"]
42+
}
43+
44+
metaInf {
45+
into(".").from("../LICENSE.txt")
46+
into(".").from("../NOTICE.txt")
47+
}
48+
}
49+
3450
publishing {
3551
repositories {
3652
maven {

0 commit comments

Comments
 (0)