import org.opensearch.gradle.test.RestIntegTestTask apply plugin: 'java' apply plugin: 'idea' apply plugin: 'opensearch.opensearchplugin' apply plugin: 'opensearch.pluginzip' apply plugin: "io.freefair.lombok" apply plugin: 'jacoco' def pluginName = 'repository-oci' def pluginDescription = 'OCI Object storage repository' def projectPath = 'org.opensearch' def pathToPlugin = 'repositories.oci' def pluginClassName = 'OciObjectStoragePlugin' tasks.register("preparePluginPathDirs") { mustRunAfter clean doLast { def newPath = pathToPlugin.replace(".", "/") mkdir "src/main/java/org/opensearch/$newPath" mkdir "src/test/java/org/opensearch/$newPath" mkdir "src/yamlRestTest/java/org/opensearch/$newPath" } } 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 pluginName description pluginDescription classname "${projectPath}.${pathToPlugin}.${pluginClassName}" licenseFile rootProject.file('LICENSE.txt') noticeFile rootProject.file('NOTICE.txt') } // 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 forbiddenApis.ignoreFailures = true forbiddenApisTest.ignoreFailures = true dependencyLicenses.enabled = false testingConventions.enabled = false thirdPartyAudit.enabled = false buildscript { 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}" } } dependencies { testImplementation(project(":oci-objectstorage-fixture")) { exclude group: 'org.slf4j', module: 'slf4j-api' exclude group: 'org.glassfish.hk2.external', module: 'jakarta.inject' } testImplementation("org.opensearch.client:opensearch-rest-high-level-client:${opensearch_version}") testImplementation("org.opensearch.test:framework:${opensearch_version}") testImplementation "org.opensearch.plugin:transport-netty4-client:${opensearch_version}" } test { systemProperty 'tests.security.manager', 'false' systemProperty 'opensearch.set.netty.runtime.available.processors', 'false' include '**/*Tests.class' testLogging.showStandardStreams = true systemProperty 'log4j2.configurationFile', "${projectDir}/src/test/resources/log4j2-test.xml" } task integTest(type: RestIntegTestTask) { description = "Run tests against a cluster" testClassesDirs = sourceSets.test.output.classesDirs classpath = sourceSets.test.runtimeClasspath } tasks.named("check").configure { dependsOn(integTest) } integTest { systemProperty "java.security.policy", "file://${projectDir}/src/main/resources/plugin-security.policy" testLogging.showStandardStreams = true include '**/*IT.class' // 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' } } testClusters.integTest { testDistribution = "INTEG_TEST" systemProperty "java.security.policy", "file://${projectDir}/src/main/resources/plugin-security.policy" // This installs our plugin into the testClusters plugin(project.tasks.bundlePlugin.archiveFile) } run { useCluster testClusters.integTest } // updateVersion: Task to auto update version to the next development iteration task updateVersion { onlyIf { System.getProperty('newVersion') } doLast { ext.newVersion = System.getProperty('newVersion') println "Setting version to ${newVersion}." // 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) } }