|
| 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) |
0 commit comments