Skip to content

Commit 5c22c8c

Browse files
authored
Updates for the GA release (#3)
Updates include removing gemfile and unnecessary plugins, moving plugin to org.logstashplugins package
1 parent e32dd29 commit 5c22c8c

File tree

9 files changed

+78
-68
lines changed

9 files changed

+78
-68
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ build
22
bin
33
*.idea
44
*.iml
5+
lib/
56
vendor/
67
.bundle/
78
build/
@@ -13,7 +14,7 @@ out/
1314
*.ipr
1415
*.iws
1516
*.gem
16-
Gemfile.lock
17+
*.gemspec
18+
Gemfile*
1719
settings.gradle
1820
gradle.properties
19-
lib/logstash-input-java_input_example_jars.rb

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## 1.0.0
2+
- Updated for GA release of native support for Java plugins. Includes:
3+
- Improved Gradle task wrappers
4+
- Removal of auto-generated Ruby source files
5+
6+
## 0.2.0
7+
- Updated for beta version of native support for Java plugins. Includes:
8+
- Gradle task wrappers
9+
- Updated plugin API
10+
- Full feature parity with Ruby plugins
11+
12+
## 0.0.1
13+
- Initial version for experimental v0 of native support for Java plugins.

Gemfile

Lines changed: 0 additions & 12 deletions
This file was deleted.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.1
1+
1.0.0

build.gradle

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@ import java.nio.file.Files
22
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
33

44
apply plugin: 'java'
5-
apply plugin: 'idea'
6-
apply plugin: 'maven-publish'
7-
apply plugin: 'maven'
8-
apply plugin: "distribution"
5+
apply from: LOGSTASH_CORE_PATH + "/../rubyUtils.gradle"
96

10-
group 'org.logstash.javaapi'
11-
version "${file("VERSION").text.trim()}"
12-
13-
description = "Example Java input implementation"
7+
// ===========================================================================
8+
// plugin info
9+
// ===========================================================================
10+
group 'org.logstashplugins' // must match the package of the main plugin class
11+
version "${file("VERSION").text.trim()}" // read from required VERSION file
12+
description = "Example Java input implementation"
13+
pluginInfo.licenses = ['Apache-2.0'] // list of SPDX license IDs
14+
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"
15+
pluginInfo.authors = ['Elasticsearch']
16+
pluginInfo.email = ['info@elastic.co']
17+
pluginInfo.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
18+
pluginInfo.pluginType = "input"
19+
pluginInfo.pluginClass = "JavaInputExample"
20+
pluginInfo.pluginName = "java_input_example" // must match the @LogstashPlugin annotation in the main plugin class
21+
// ===========================================================================
1422

1523
sourceCompatibility = 1.8
1624
targetCompatibility = 1.8
@@ -50,14 +58,50 @@ dependencies {
5058
testCompile 'org.jruby:jruby-complete:9.1.13.0'
5159
}
5260

61+
clean {
62+
delete "${projectDir}/Gemfile"
63+
delete "${projectDir}/" + pluginInfo.pluginFullName() + ".gemspec"
64+
delete "${projectDir}/lib/"
65+
delete "${projectDir}/vendor/"
66+
new FileNameFinder().getFileNames(projectDir.toString(), pluginInfo.pluginFullName() + "-?.?.?.gem").each { filename ->
67+
delete filename
68+
}
69+
}
70+
5371
tasks.withType(JavaCompile) {
5472
options.encoding = 'UTF-8'
5573
}
5674

57-
task vendor(dependsOn: shadowJar) << {
58-
String vendorPathPrefix = "vendor/jar-dependencies"
59-
String projectGroupPath = project.group.replaceAll('\\.', '/')
60-
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${project.name}/${project.version}/${project.name}-${project.version}.jar")
61-
projectJarFile.mkdirs()
62-
Files.copy(file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
75+
task vendor(dependsOn: shadowJar) {
76+
doLast {
77+
String vendorPathPrefix = "vendor/jar-dependencies"
78+
String projectGroupPath = project.group.replaceAll('\\.', '/')
79+
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${pluginInfo.pluginFullName()}/${project.version}/${pluginInfo.pluginFullName()}-${project.version}.jar")
80+
projectJarFile.mkdirs()
81+
Files.copy(file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
82+
validatePluginJar(projectJarFile, project.group)
83+
}
84+
}
85+
86+
task generateRubySupportFiles() {
87+
doLast {
88+
generateRubySupportFilesForPlugin(project.description, project.group, version)
89+
}
90+
}
91+
92+
task removeObsoleteJars() {
93+
doLast {
94+
new FileNameFinder().getFileNames(
95+
projectDir.toString(),
96+
"vendor/**/" + pluginInfo.pluginFullName() + "*.jar",
97+
"vendor/**/" + pluginInfo.pluginFullName() + "-" + version + ".jar").each { f ->
98+
delete f
99+
}
100+
}
101+
}
102+
103+
task gem(dependsOn: [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]) {
104+
doLast {
105+
buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec")
106+
}
63107
}

lib/logstash/inputs/java_input_example.rb

Lines changed: 0 additions & 12 deletions
This file was deleted.

logstash-input-java_input_example.gemspec

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/main/java/org/logstash/javaapi/JavaInputExample.java renamed to src/main/java/org/logstashplugins/JavaInputExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.logstash.javaapi;
1+
package org.logstashplugins;
22

33
import co.elastic.logstash.api.Configuration;
44
import co.elastic.logstash.api.Context;

src/test/java/org/logstash/javaapi/JavaInputExampleTest.java renamed to src/test/java/org/logstashplugins/JavaInputExampleTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package org.logstash.javaapi;
1+
package org.logstashplugins;
22

33
import co.elastic.logstash.api.Configuration;
44
import org.apache.commons.lang3.StringUtils;
55
import org.junit.Assert;
66
import org.junit.Test;
77
import org.logstash.plugins.ConfigurationImpl;
8+
import org.logstashplugins.JavaInputExample;
89

910
import java.util.ArrayList;
1011
import java.util.HashMap;

0 commit comments

Comments
 (0)