diff --git a/plugins/command-manager/buildSrc/formatterConfig.xml b/plugins/command-manager/formatter/formatterConfig.xml similarity index 100% rename from plugins/command-manager/buildSrc/formatterConfig.xml rename to plugins/command-manager/formatter/formatterConfig.xml diff --git a/plugins/command-manager/formatter/license-header.txt b/plugins/command-manager/formatter/license-header.txt new file mode 100644 index 0000000..cf0a068 --- /dev/null +++ b/plugins/command-manager/formatter/license-header.txt @@ -0,0 +1,8 @@ +/* + * Copyright OpenSearch Contributors + * 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. + */ diff --git a/plugins/command-manager/gradle/formatting.gradle b/plugins/command-manager/gradle/formatting.gradle index ca00cfd..fd3f607 100644 --- a/plugins/command-manager/gradle/formatting.gradle +++ b/plugins/command-manager/gradle/formatting.gradle @@ -1,6 +1,10 @@ /* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 + * Copyright OpenSearch Contributors + * 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. */ allprojects { @@ -9,10 +13,13 @@ allprojects { java { target 'src/**/*.java' removeUnusedImports() - eclipse().configFile rootProject.file('buildSrc/formatterConfig.xml') + eclipse().configFile rootProject.file('formatter/formatterConfig.xml') trimTrailingWhitespace() endWithNewline() } + format("license", { + licenseHeaderFile("${rootProject.file("formatter/license-header.txt")}", "package "); + target("src/*/java/**/*.java") + }) } - precommit.dependsOn 'spotlessJavaCheck' } diff --git a/plugins/setup/build.gradle b/plugins/setup/build.gradle index 221ba9c..8311db7 100644 --- a/plugins/setup/build.gradle +++ b/plugins/setup/build.gradle @@ -29,6 +29,7 @@ apply plugin: 'eclipse' apply plugin: 'opensearch.opensearchplugin' apply plugin: 'opensearch.yaml-rest-test' apply plugin: 'opensearch.pluginzip' +apply from: 'gradle/formatting.gradle' def pluginName = 'wazuh-indexer-setup' def pluginDescription = 'Wazuh Indexer setup plugin' diff --git a/plugins/setup/buildSrc/formatterConfig.xml b/plugins/setup/formatter/formatterConfig.xml similarity index 100% rename from plugins/setup/buildSrc/formatterConfig.xml rename to plugins/setup/formatter/formatterConfig.xml diff --git a/plugins/setup/formatter/license-header.txt b/plugins/setup/formatter/license-header.txt new file mode 100644 index 0000000..cf0a068 --- /dev/null +++ b/plugins/setup/formatter/license-header.txt @@ -0,0 +1,8 @@ +/* + * Copyright OpenSearch Contributors + * 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. + */ diff --git a/plugins/setup/gradle/formatting.gradle b/plugins/setup/gradle/formatting.gradle index ca00cfd..fd3f607 100644 --- a/plugins/setup/gradle/formatting.gradle +++ b/plugins/setup/gradle/formatting.gradle @@ -1,6 +1,10 @@ /* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 + * Copyright OpenSearch Contributors + * 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. */ allprojects { @@ -9,10 +13,13 @@ allprojects { java { target 'src/**/*.java' removeUnusedImports() - eclipse().configFile rootProject.file('buildSrc/formatterConfig.xml') + eclipse().configFile rootProject.file('formatter/formatterConfig.xml') trimTrailingWhitespace() endWithNewline() } + format("license", { + licenseHeaderFile("${rootProject.file("formatter/license-header.txt")}", "package "); + target("src/*/java/**/*.java") + }) } - precommit.dependsOn 'spotlessJavaCheck' }