From 7ec9d3894f3bf7e9eba03fcb5b22262653a05f1b Mon Sep 17 00:00:00 2001 From: dblock Date: Mon, 22 Jan 2024 11:08:07 -0500 Subject: [PATCH] Added support for building -SNAPSHOTs. Signed-off-by: dblock --- README.md | 26 ++++++++++++++++++++------ build.gradle | 14 +++++++++++--- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3da91ba..d30354e 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,16 @@ Build a distribution. ./gradlew assemble ``` -This produces `build/distributions/opensearch-api.zip`. +This produces `./build/distributions/opensearch-api-3.0.0.0-SNAPSHOT.zip`. ### Install Check out OpenSearch code, run it once with `./gradlew run`. -Install the plugin, you may need to adjust `darwin-arm64-tar` below to your platform, and use the location of your plugin zip. +Install the plugin, you may need to adjust `darwin-arm64-tar` below to your platform, and use the location of your plugin zip (mine is `~/source/opensearch-project/opensearch-api/dblock-opensearch-api`). ```sh -$ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSHOT/bin/opensearch-plugin install file:///Users/dblock/source/opensearch-project/opensearch-api/dblock-opensearch-api/build/distributions/opensearch-api.zip +$ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSHOT/bin/opensearch-plugin install file:///Users/dblock/source/opensearch-project/opensearch-api/dblock-opensearch-api/build/distributions/opensearch-api-3.0.0.0-SNAPSHOT.zip -> Installed opensearch-api with folder name opensearch-api ``` @@ -29,13 +29,27 @@ $ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSH When you run OpenSearch with `./gradlew run` you should see the plugin loaded in the logs. ``` -[2023-09-27T08:35:48,627][INFO ][o.o.p.PluginsService] [runTask-0] loaded plugin [opensearch-api] +[2024-01-22T10:58:58,338][INFO ][o.o.p.PluginsService] [runTask-0] loaded plugin [opensearch-api] ``` ### Test ```sh -$ curl http://localhost:9200/_plugins/api +$ curl http://localhost:9200/_plugins/api | jq +``` + +Returns an OpenAPI spec. + +```json +{ + "openapi": "3.0.1", + "info": { + "title": "opensearch", + "description": "The OpenSearch Project: https://opensearch.org/", + "version": "3.0.0-SNAPSHOT" + }, + ... +} ``` ### Uninstall @@ -52,4 +66,4 @@ This code is licensed under the Apache 2.0 License. See [LICENSE.txt](LICENSE.tx ## Copyright -Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details. +Copyright Daniel Doubrovkine (dB.), and OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details. diff --git a/build.gradle b/build.gradle index 4284537..f7b6d9c 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,8 @@ def pluginDescription = 'OpenSearch API plugin.' def projectPath = 'org.opensearch' def pathToPlugin = 'plugin.api' def pluginClassName = 'APIPlugin' -group = "APIPluginGroup" + +group = "org.dblock" tasks.register("preparePluginPathDirs") { mustRunAfter clean @@ -37,8 +38,9 @@ publishing { } developers { developer { - name = "OpenSearch" - url = "https://github.com/dblock/opensearch-api" + id = 'dblock' + name = "Daniel Doubrovkine (dB.)" + url = "https://code.dblock.org" } } } @@ -66,6 +68,7 @@ javadoc.enabled = false buildscript { ext { opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT") + isSnapshot = "true" == System.getProperty("build.snapshot", "true") } repositories { @@ -80,6 +83,11 @@ buildscript { } } +version = opensearch_version - "-SNAPSHOT" + ".0" +if (isSnapshot) { + version += "-SNAPSHOT" +} + repositories { mavenLocal() maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }