Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build
bin
*.idea
*.iml
lib/
vendor/
.bundle/
build/
Expand All @@ -13,7 +14,7 @@ out/
*.ipr
*.iws
*.gem
Gemfile.lock
*.gemspec
Gemfile*
settings.gradle
gradle.properties
lib/logstash-input-java_input_example_jars.rb
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## 1.0.0
- Updated for GA release of native support for Java plugins. Includes:
- Improved Gradle task wrappers
- Removal of auto-generated Ruby source files

## 0.2.0
- Updated for beta version of native support for Java plugins. Includes:
- Gradle task wrappers
- Updated plugin API
- Full feature parity with Ruby plugins

## 0.0.1
- Initial version for experimental v0 of native support for Java plugins.
12 changes: 0 additions & 12 deletions Gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1
1.0.0
72 changes: 58 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: "distribution"
apply from: LOGSTASH_CORE_PATH + "/../rubyUtils.gradle"

group 'org.logstash.javaapi'
version "${file("VERSION").text.trim()}"

description = "Example Java input implementation"
// ===========================================================================
// plugin info
// ===========================================================================
group 'org.logstashplugins' // must match the package of the main plugin class
version "${file("VERSION").text.trim()}" // read from required VERSION file
description = "Example Java input implementation"
pluginInfo.licenses = ['Apache-2.0'] // list of SPDX license IDs
pluginInfo.longDescription = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using \$LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
pluginInfo.authors = ['Elasticsearch']
pluginInfo.email = ['[email protected]']
pluginInfo.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
pluginInfo.pluginType = "input"
pluginInfo.pluginClass = "JavaInputExample"
pluginInfo.pluginName = "java_input_example" // must match the @LogstashPlugin annotation in the main plugin class
// ===========================================================================

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -50,14 +58,50 @@ dependencies {
testCompile 'org.jruby:jruby-complete:9.1.13.0'
}

clean {
delete "${projectDir}/Gemfile"
delete "${projectDir}/" + pluginInfo.pluginFullName() + ".gemspec"
delete "${projectDir}/lib/"
delete "${projectDir}/vendor/"
new FileNameFinder().getFileNames(projectDir.toString(), pluginInfo.pluginFullName() + "-?.?.?.gem").each { filename ->
delete filename
}
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

task vendor(dependsOn: shadowJar) << {
String vendorPathPrefix = "vendor/jar-dependencies"
String projectGroupPath = project.group.replaceAll('\\.', '/')
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${project.name}/${project.version}/${project.name}-${project.version}.jar")
projectJarFile.mkdirs()
Files.copy(file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
task vendor(dependsOn: shadowJar) {
doLast {
String vendorPathPrefix = "vendor/jar-dependencies"
String projectGroupPath = project.group.replaceAll('\\.', '/')
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${pluginInfo.pluginFullName()}/${project.version}/${pluginInfo.pluginFullName()}-${project.version}.jar")
projectJarFile.mkdirs()
Files.copy(file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
validatePluginJar(projectJarFile, project.group)
}
}

task generateRubySupportFiles() {
doLast {
generateRubySupportFilesForPlugin(project.description, project.group, version)
}
}

task removeObsoleteJars() {
doLast {
new FileNameFinder().getFileNames(
projectDir.toString(),
"vendor/**/" + pluginInfo.pluginFullName() + "*.jar",
"vendor/**/" + pluginInfo.pluginFullName() + "-" + version + ".jar").each { f ->
delete f
}
}
}

task gem(dependsOn: [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]) {
doLast {
buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec")
}
}
12 changes: 0 additions & 12 deletions lib/logstash/inputs/java_input_example.rb

This file was deleted.

25 changes: 0 additions & 25 deletions logstash-input-java_input_example.gemspec

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.logstash.javaapi;
package org.logstashplugins;

import co.elastic.logstash.api.Configuration;
import co.elastic.logstash.api.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.logstash.javaapi;
package org.logstashplugins;

import co.elastic.logstash.api.Configuration;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Test;
import org.logstash.plugins.ConfigurationImpl;
import org.logstashplugins.JavaInputExample;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down