Skip to content

Commit 53275d9

Browse files
committed
Update build to gradle
Update to use gradle to avoid jar-dependencies based weirdness with old version of jruby, and for consistency with other plugins using java dependencies.
1 parent 63d9ed1 commit 53275d9

File tree

9 files changed

+396
-22
lines changed

9 files changed

+396
-22
lines changed

Rakefile

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
require "bundler/gem_tasks"
2-
require 'jars/version'
31

4-
begin
5-
require 'rspec/core/rake_task'
6-
RSpec::Core::RakeTask.new(:spec)
7-
rescue LoadError
8-
end
9-
10-
task default: "spec"
2+
# encoding: utf-8
3+
require "jars/installer"
4+
require "fileutils"
115

12-
require 'jars/installer'
13-
desc 'Install the JAR dependencies to vendor/'
14-
task :install_jars do
15-
# We actually want jar-dependencies will download the jars and place it in
16-
# vendor/jar-dependencies/runtime-jars
17-
Jars::Installer.new.vendor_jars!(false, 'vendor/jar-dependencies/runtime-jars')
6+
task :default do
7+
system('rake -vT')
188
end
199

20-
task build: :install_jars
21-
require "logstash/devutils/rake"
22-
task vendor: :install_jars
10+
task :vendor do
11+
exit(1) unless system './gradlew vendor'
12+
end
2313

14+
task :clean do
15+
["vendor/jar-dependencies", "Gemfile.lock"].each do |p|
16+
FileUtils.rm_rf(p)
17+
end
18+
end

build.gradle

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import java.nio.file.Files
2+
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
3+
/*
4+
* Licensed to Elasticsearch under one or more contributor
5+
* license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright
7+
* ownership. Elasticsearch licenses this file to you under
8+
* the Apache License, Version 2.0 (the "License"); you may
9+
* not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
apply plugin: "java"
22+
apply plugin: 'maven'
23+
apply plugin: "distribution"
24+
apply plugin: "idea"
25+
26+
group "org.logstash.inputs"
27+
28+
sourceCompatibility = JavaVersion.VERSION_1_8
29+
30+
buildscript {
31+
repositories {
32+
mavenCentral()
33+
jcenter()
34+
}
35+
36+
}
37+
38+
repositories {
39+
mavenCentral()
40+
}
41+
42+
task wrapper(type: Wrapper) {
43+
gradleVersion = '4.0'
44+
}
45+
46+
dependencies {
47+
compile 'com.amazonaws:amazon-kinesis-client:1.7.0'
48+
compile 'com.amazonaws:aws-java-sdk-core:1.11.16'
49+
compile 'com.amazonaws:aws-java-sdk-dynamodb:1.11.14'
50+
compile 'com.amazonaws:aws-java-sdk-s3:1.11.14'
51+
compile 'com.amazonaws:aws-java-sdk-kms:1.11.14'
52+
compile 'com.amazonaws:aws-java-sdk-core:1.11.16'
53+
compile 'commons-logging:commons-logging:1.2'
54+
compile 'org.apache.httpcomponents:httpclient:4.5.2'
55+
compile 'org.apache.httpcomponents:httpcore:4.4.4'
56+
compile 'commons-logging:commons-logging:1.2'
57+
compile 'commons-codec:commons-codec:1.9'
58+
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.6'
59+
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.0'
60+
compile 'com.fasterxml.jackson.core:jackson-core:2.6.6'
61+
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.6.6'
62+
compile 'com.fasterxml.jackson.core:jackson-core:2.6.6'
63+
compile 'joda-time:joda-time:2.8.1'
64+
compile 'com.amazonaws:aws-java-sdk-kinesis:1.11.14'
65+
compile 'com.amazonaws:aws-java-sdk-cloudwatch:1.11.14'
66+
compile 'com.google.guava:guava:18.0'
67+
compile 'com.google.protobuf:protobuf-java:2.6.1'
68+
compile 'commons-lang:commons-lang:2.6'
69+
}
70+
71+
task generateGemJarRequiresFile {
72+
doLast {
73+
File jars_file = file('lib/logstash-input-kinesis_jars.rb')
74+
jars_file.newWriter().withWriter { w ->
75+
w << "# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n"
76+
w << "require \'jar_dependencies\'\n"
77+
configurations.runtime.allDependencies.each {
78+
w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n"
79+
}
80+
}
81+
}
82+
}
83+
84+
task vendor {
85+
doLast {
86+
String vendorPathPrefix = "vendor/jar-dependencies"
87+
configurations.runtime.allDependencies.each { dep ->
88+
File f = configurations.runtime.filter { it.absolutePath.contains("${dep.group}/${dep.name}/${dep.version}") }.singleFile
89+
String groupPath = dep.group.replaceAll('\\.', '/')
90+
File newJarFile = file("${vendorPathPrefix}/${groupPath}/${dep.name}/${dep.version}/${dep.name}-${dep.version}.jar")
91+
newJarFile.mkdirs()
92+
Files.copy(f.toPath(), newJarFile.toPath(), REPLACE_EXISTING)
93+
}
94+
}
95+
}
96+
97+
vendor.dependsOn(generateGemJarRequiresFile)

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.daemon=false

gradle/wrapper/gradle-wrapper.jar

53.4 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Jun 21 11:39:16 CEST 2017
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip

gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)