diff --git a/plugins/command-manager/build.gradle b/plugins/command-manager/build.gradle index 95ff3a5..58d2610 100644 --- a/plugins/command-manager/build.gradle +++ b/plugins/command-manager/build.gradle @@ -26,16 +26,16 @@ buildscript { } plugins { - id 'java-library' - id 'java-test-fixtures' - id 'idea' - id "com.diffplug.spotless" version "6.25.0" apply false + id "com.diffplug.spotless" version "6.25.0" } -apply from: 'gradle/formatting.gradle' +apply plugin: 'java' +apply plugin: 'idea' +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-command-manager' def pluginDescription = 'The Command Manager plugin handles and distributes commands across your Wazuh environment.' diff --git a/plugins/command-manager/gradle/formatting.gradle b/plugins/command-manager/gradle/formatting.gradle index 837622a..ca00cfd 100644 --- a/plugins/command-manager/gradle/formatting.gradle +++ b/plugins/command-manager/gradle/formatting.gradle @@ -11,6 +11,8 @@ allprojects { removeUnusedImports() eclipse().configFile rootProject.file('buildSrc/formatterConfig.xml') trimTrailingWhitespace() + endWithNewline() } } + precommit.dependsOn 'spotlessJavaCheck' } diff --git a/plugins/setup/build.gradle b/plugins/setup/build.gradle index 11feca5..221ba9c 100644 --- a/plugins/setup/build.gradle +++ b/plugins/setup/build.gradle @@ -1,5 +1,28 @@ import org.opensearch.gradle.test.RestIntegTestTask +buildscript { + ext { + opensearch_version = System.getProperty("opensearch.version", "2.16.0") + wazuh_version = System.getProperty("version", "5.0.0") + revision = System.getProperty("revision", "0") + } + + repositories { + mavenLocal() + maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } + } + + dependencies { + classpath "org.opensearch.gradle:build-tools:${opensearch_version}" + } +} + +plugins { + id "com.diffplug.spotless" version "6.25.0" +} + apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' @@ -13,7 +36,6 @@ def projectPath = 'com.wazuh' def pathToPlugin = 'setup' def pluginClassName = 'SetupPlugin' - publishing { publications { pluginZip(MavenPublication) { publication -> @@ -52,31 +74,15 @@ opensearchplugin { noticeFile rootProject.file('NOTICE.txt') } +// Add the spotlessCheck to gradle check +check.dependsOn spotlessCheck + // This requires an additional Jar not published as part of build-tools loggerUsageCheck.enabled = false // No need to validate pom, as we do not upload to maven/sonatype validateNebulaPom.enabled = false -buildscript { - ext { - opensearch_version = System.getProperty("opensearch.version", "2.16.0") - wazuh_version = System.getProperty("version", "5.0.0") - revision = System.getProperty("revision", "0") - } - - repositories { - mavenLocal() - maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - } - - dependencies { - classpath "org.opensearch.gradle:build-tools:${opensearch_version}" - } -} - repositories { mavenLocal() maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } diff --git a/plugins/setup/gradle/formatting.gradle b/plugins/setup/gradle/formatting.gradle index 036ac4a..ca00cfd 100644 --- a/plugins/setup/gradle/formatting.gradle +++ b/plugins/setup/gradle/formatting.gradle @@ -1,14 +1,18 @@ -import org.opensearch.gradle.BuildPlugin +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ allprojects { - plugins.withType(BuildPlugin).whenPluginAdded { - project.apply plugin: "com.diffplug.spotless" - - spotless { + project.apply plugin: "com.diffplug.spotless" + spotless { + java { target 'src/**/*.java' removeUnusedImports() + eclipse().configFile rootProject.file('buildSrc/formatterConfig.xml') trimTrailingWhitespace() + endWithNewline() } - precommit.dependsOn 'spotlessJavaCheck' } + precommit.dependsOn 'spotlessJavaCheck' }