-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
94 lines (79 loc) · 2.52 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
group 'co.elastic.logstash.input'
apply plugin: 'java'
apply plugin: 'idea'
repositories {
mavenCentral()
}
project.sourceCompatibility = 1.8
project.targetCompatibility = 1.8
task sourcesJar(type: org.gradle.api.tasks.bundling.Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier 'sources'
extension 'jar'
}
task javadocJar(type: org.gradle.api.tasks.bundling.Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier 'javadoc'
extension 'jar'
}
// copy jar file into the gem lib dir but without the version number in filename
task copyGemjar(type: org.gradle.api.tasks.Copy, dependsOn: sourcesJar) {
from project.jar
into project.file('lib/')
rename(/(.+)-${project.version}.jar/, '$1.jar')
}
task cleanGemjar {
delete fileTree(project.file('lib/')) {
include '*.jar'
}
}
clean.dependsOn(cleanGemjar)
jar.finalizedBy(copyGemjar)
task gemspec_jars << {
File gemspec_jars = file("./gemspec_jars.rb")
gemspec_jars.newWriter().withWriter { w ->
w << "# This file is generated by Gradle as part of the build process. It extracts the build.gradle\n"
w << "# runtime dependencies to generate this gemspec dependencies file to be eval'ed by the gemspec\n"
w << "# for the jar-dependencies requirements.\n\n"
configurations.runtime.allDependencies.each { dependency ->
w << "gem.requirements << \"jar ${dependency.group}:${dependency.name}, ${dependency.version}\"\n"
}
}
}
build.finalizedBy(gemspec_jars)
configurations.create('sources')
configurations.create('javadoc')
configurations.archives {
extendsFrom configurations.sources
extendsFrom configurations.javadoc
}
artifacts {
sources(sourcesJar) {
// Weird Gradle quirk where type will be used for the extension, but only for sources
type 'jar'
}
javadoc(javadocJar) {
type 'javadoc'
}
}
configurations {
provided
}
project.sourceSets {
main.compileClasspath += project.configurations.provided
main.runtimeClasspath += project.configurations.provided
test.compileClasspath += project.configurations.provided
test.runtimeClasspath += project.configurations.provided
}
project.javadoc.classpath += project.configurations.provided
idea {
module {
scopes.PROVIDED.plus += [project.configurations.provided]
}
}
dependencies {
provided project(':logstash-core')
provided 'org.jruby:jruby-core:1.7.25'
testCompile 'junit:junit:4.12'
testCompile 'joda-time:joda-time:2.9.9'
}