Skip to content

Commit

Permalink
Enforce license headers
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Jun 14, 2024
1 parent dea7e72 commit e5bf65b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 deletions.
8 changes: 8 additions & 0 deletions LICENSE_HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

32 changes: 32 additions & 0 deletions LICENSE_HEADER_FORKED.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

27 changes: 18 additions & 9 deletions java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,28 @@ tasks.withType<Jar> {
}

spotless {
java {
java {
target("**/*.java")

target("**/*.java")
licenseHeaderFile("../LICENSE_HEADER.txt")
.named("PrimaryLicenseHeader")
.onlyIfContentMatches("^((?!Licensed to Elasticsearch)[\\s\\S])*$")
.delimiter("(package |//-----)")

// Use the default importOrder configuration
importOrder()
removeUnusedImports()
licenseHeaderFile("../LICENSE_HEADER_FORKED.txt")
.named("ForkedLicenseHeader")
.onlyIfContentMatches("Licensed to Elasticsearch")
.delimiter("(package |//-----)")

eclipse().configFile("../buildSrc/formatterConfig.xml")
// Use the default importOrder configuration
importOrder()
removeUnusedImports()

trimTrailingWhitespace()
endWithNewline()
}
eclipse().configFile("../buildSrc/formatterConfig.xml")

trimTrailingWhitespace()
endWithNewline()
}
}

publishing {
Expand Down
2 changes: 2 additions & 0 deletions java-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ spotless {
java {
target("**/*.java")

licenseHeaderFile("../LICENSE_HEADER.txt")

// Use the default importOrder configuration
importOrder()
removeUnusedImports()
Expand Down

0 comments on commit e5bf65b

Please sign in to comment.