diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e4416f8..065b79f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,18 +15,28 @@ jobs: os: - ubuntu-latest - macOS-latest + - windows-latest java: - - 14 + - 17 + - 21 name: Build and Test Plugin Template runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} + - uses: actions/checkout@v3 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: temurin - - name: Build and Run Tests - run: | + - name: Build and Run Tests + run: | ./gradlew build + # Generated by 'opensearch.pluginzip' custom gradle plugin + ./gradlew publishPluginZipPublicationToZipStagingRepository + - name: Update version to the next development iteration + if: matrix.os != 'windows-latest' + run: | + # Task to auto update version to the next development iteration + ./gradlew updateVersion -DnewVersion=2.1.0-SNAPSHOT \ No newline at end of file diff --git a/build.gradle b/build.gradle index 40a7eeb..253ba8c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,21 @@ import org.opensearch.gradle.test.RestIntegTestTask - -apply plugin: "java" -apply plugin: "idea" -apply plugin: "opensearch.opensearchplugin" -apply plugin: "opensearch.yaml-rest-test" -apply plugin: "opensearch.pluginzip" -apply plugin: "checkstyle" -apply plugin: "com.diffplug.spotless" - -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 - -checkstyle { - toolVersion "10.3.3" - configDirectory.set(rootProject.file("checkstyle/")) -} +apply plugin: 'java' +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'opensearch.opensearchplugin' +apply plugin: 'opensearch.yaml-rest-test' +apply plugin: 'opensearch.pluginzip' +apply plugin: com.diffplug.gradle.spotless.SpotlessPlugin + +def pluginName = 'rename' +def pluginDescription = 'Custom plugin' +def projectPath = 'org.opensearch' +def pathToPlugin = 'path.to.plugin' +def pluginClassName = 'RenamePlugin' +group = "RenameGroup" + +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 spotless { java { @@ -32,6 +33,29 @@ tasks.register("preparePluginPathDirs") { } } +publishing { + publications { + pluginZip(MavenPublication) { publication -> + pom { + name = pluginName + description = pluginDescription + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + name = "OpenSearch" + url = "https://github.com/opensearch-project/opensearch-plugin-template-java" + } + } + } + } + } +} + opensearchplugin { name "encrypted-repository" description "Provides client-side encryption for snapshotting repositories" @@ -61,7 +85,7 @@ buildscript { dependencies { classpath "org.opensearch.gradle:build-tools:${opensearch_version}" - classpath "com.diffplug.spotless:spotless-plugin-gradle:6.21.0" + classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0" } } @@ -103,13 +127,12 @@ integTest { // The --debug-jvm command-line option makes the cluster debuggable; this makes the tests debuggable if (System.getProperty("test.debug") != null) { - jvmArgs "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005" + jvmArgs += ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"] } + jvmArgs += ["-Djava.security.manager=allow"] } testClusters.integTest { - testDistribution = "INTEG_TEST" - // This installs our plugin into the testClusters plugin(project.tasks.bundlePlugin.archiveFile) } @@ -126,4 +149,4 @@ task updateVersion { // String tokenization to support -SNAPSHOT ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) } -} +} \ No newline at end of file