From 219d213d1ab51fc5016ebf674582c6c8f15f0192 Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Mon, 21 Mar 2016 14:53:44 -0400 Subject: [PATCH] Create a virtual gem to handler the plugin dependency on core We have decided to create a gem that the plugins can depend on to make sure they use the correct core, with that in mind this will reduce the mass update required when releasing a major release of logstash if the contract between logstash and the plugin didnt change. The first version of this gem act as a virtual gem, future release will include the actual plugins code of the contract. This gem should follow the same convention as semver, a breaking change in the api will mean a bump in the major version. Plugins author are encouraged to test their plugins with a specific version of the contract and define their dependency as the following: ``` s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0" ``` This PR also introduce rake task to help managing this gem, since every release of logstash will produce a new version of this gem with the minor version bump. A **logstash-core-plugin-api** will declare a strict dependency on a specific **logstash-core** version, like this: ``` s.add_runtime_dependency "logstash-core", "2.3.0" ``` On the other hand each release of logtash will also declare a strict dependency on a specific version of the `logstash-core-plugin-api` gem. ref #4829 Fixes #4881 --- Gemfile | 1 + .../lib/logstash-core-plugin-api/version.rb | 2 ++ .../logstash-core-plugin-api.gemspec | 29 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 logstash-core-plugin-api/lib/logstash-core-plugin-api/version.rb create mode 100644 logstash-core-plugin-api/logstash-core-plugin-api.gemspec diff --git a/Gemfile b/Gemfile index 060844f17..511b6d451 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "logstash-core", "3.0.0.dev", :path => "./logstash-core" # gem "logstash-core-event", "3.0.0.dev", :path => "./logstash-core-event" gem "logstash-core-event-java", "3.0.0.dev", :path => "./logstash-core-event-java" +gem "logstash-core-plugin-api", "1.0.0", :path => "./logstash-core-plugin-api" gem "file-dependencies", "0.1.6" gem "ci_reporter_rspec", "1.0.0", :group => :development gem "simplecov", :group => :development diff --git a/logstash-core-plugin-api/lib/logstash-core-plugin-api/version.rb b/logstash-core-plugin-api/lib/logstash-core-plugin-api/version.rb new file mode 100644 index 000000000..e83d1586c --- /dev/null +++ b/logstash-core-plugin-api/lib/logstash-core-plugin-api/version.rb @@ -0,0 +1,2 @@ +# encoding: utf-8 +LOGSTASH_CORE_PLUGIN_API = "1.0.0" diff --git a/logstash-core-plugin-api/logstash-core-plugin-api.gemspec b/logstash-core-plugin-api/logstash-core-plugin-api.gemspec new file mode 100644 index 000000000..08efcb63a --- /dev/null +++ b/logstash-core-plugin-api/logstash-core-plugin-api.gemspec @@ -0,0 +1,29 @@ +# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require "logstash-core-plugin-api/version" + +Gem::Specification.new do |gem| + gem.authors = ["Elastic"] + gem.email = ["info@elastic.co"] + gem.description = %q{Logstash plugin API} + gem.summary = %q{Define the plugin API that the plugin need to follow.} + gem.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html" + gem.license = "Apache License (2.0)" + + gem.files = Dir.glob(["logstash-core-event.gemspec", "lib/**/*.rb", "spec/**/*.rb"]) + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.name = "logstash-core-plugin-api" + gem.require_paths = ["lib"] + gem.version = LOGSTASH_CORE_PLUGIN_API + + gem.add_runtime_dependency "logstash-core", ">= 2.0.0", "<= 3.0.0.dev" + + # Make sure we dont build this gem from a non jruby + # environment. + if RUBY_PLATFORM == "java" + gem.platform = "java" + else + raise "The logstash-core-api need to be build on jruby" + end +end