Skip to content

Commit

Permalink
Add manifest information to the jar file's META-INF
Browse files Browse the repository at this point in the history
  • Loading branch information
swallez committed Jun 2, 2021
1 parent a1d0f96 commit 1778b1a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 5 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Elasticsearch Java Client
Copyright 2021 Elasticsearch B.V.
18 changes: 13 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ subprojects {
apply(plugin = "checkstyle")
}

/*
TODO:
- checkstyle + reformat
- license check
*/
val grgit = org.ajoberstar.grgit.Grgit.open(mapOf("currentDir" to project.rootDir))
try {
allprojects {
project.extra["gitHashFull"] = grgit.head().id
project.extra["gitCommitTime"] = grgit.head().dateTime.withZoneSameLocal(java.time.ZoneOffset.UTC)
}
} finally {
grgit.close()
}

allprojects {
project.extra["buildTime"] = java.time.Instant.now().atZone(java.time.ZoneOffset.UTC)
}
26 changes: 26 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

dependencies {
implementation("org.ajoberstar.grgit:grgit-gradle:4.0.1")
}

repositories {
maven("https://plugins.gradle.org/m2/")
}
16 changes: 16 additions & 0 deletions java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ java {
sourceCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<Jar> {
manifest {
attributes["Implementation-Title"] = "Elasticsearch Java client"
attributes["Implementation-Vendor"] = "Elastic"
attributes["Implementation-URL"] = "https://github.com/elastic/elasticsearch-java/"
attributes["Build-Date"] = project.extra["buildTime"]
attributes["X-Git-Revision"] = project.extra["gitHashFull"]
attributes["X-Git-Commit-Time"] = project.extra["gitCommitTime"]
}

metaInf {
into(".").from("../LICENSE.txt")
into(".").from("../NOTICE.txt")
}
}

publishing {
repositories {
maven {
Expand Down

0 comments on commit 1778b1a

Please sign in to comment.