-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathbuild.gradle
More file actions
147 lines (132 loc) · 5.84 KB
/
Copy pathbuild.gradle
File metadata and controls
147 lines (132 loc) · 5.84 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import org.opensearch.gradle.info.BuildParams
apply plugin: 'opensearch.hadoop.build.integration'
description = "OpenSearch Hadoop Map/Reduce"
configurations {
embedded {
transitive = false
canBeResolved = true
}
implementation {
extendsFrom project.configurations.embedded
}
itestEmbedded {
transitive = false
canBeResolved = true
}
itestImplementation {
extendsFrom project.configurations.itestEmbedded
}
// Gradle's java library plugin adds a variant to each project that offers the classes dir as an artifact that can be
// used in other projects instead of requiring a jar operation to happen. We have artifacts that are being shaded into
// a third-party jar that this depends on, which inherently means there is no classes output to share for compilation.
// This will force the MR project to require jars from upstream project dependencies, which shouldn't be a problem since
// there should only be one upstream project.
compileClasspath {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, LibraryElements.JAR))
}
}
testCompileClasspath {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, LibraryElements.JAR))
}
}
itestCompileClasspath {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, LibraryElements.JAR))
}
}
}
dependencies {
api(project.ext.hadoopClient)
api("org.apache.hadoop:hadoop-common:${project.ext.hadoopVersion}") {
// Hadoop has updated its jackson module to be further ahead in version than
// Spark can support. The two libraries are unlikely to co-exist in a deployed
// environment, but depending on one or the other creates problems for library
// tests. Instead, we exclude it from our dependencies and shade it with the
// thirdparty submodule. Downstream users of the library can pull it in as needed
// for tests.
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'org.slf4j', module: 'slf4j-reload4j'
}
api("org.apache.hadoop:hadoop-mapreduce-client-core:${project.ext.hadoopVersion}") {
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'org.slf4j', module: 'slf4j-reload4j'
}
embedded(project(path: ":thirdparty", configuration: "shadow"))
implementation("commons-logging:commons-logging:1.3.5")
implementation("commons-codec:commons-codec:1.18.0")
implementation("javax.xml.bind:jaxb-api:2.3.1")
testImplementation(project(":test:shared"))
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.19.2")
testImplementation("io.netty:netty-all:4.2.2.Final")
testImplementation("org.elasticsearch:securemock:1.2")
itestEmbedded(project(":test:shared"))
itestImplementation("com.fasterxml.jackson.core:jackson-databind:2.19.2")
itestImplementation("org.apache.hadoop:hadoop-minikdc:${project.ext.minikdcVersion}") {
// For some reason, the dependencies that are pulled in with MiniKDC have multiple resource files
// that cause issues when they are loaded. We exclude the ldap schema data jar to get around this.
exclude group: "org.apache.directory.api", module: "api-ldap-schema-data"
exclude group: 'com.fasterxml.jackson.core'
}
implementation "software.amazon.awssdk:auth:2.31.78"
implementation "software.amazon.awssdk:regions:2.31.78"
implementation "software.amazon.awssdk:http-client-spi:2.31.78"
implementation "software.amazon.awssdk:identity-spi:2.31.78"
implementation "software.amazon.awssdk:utils:2.31.78"
implementation "software.amazon.awssdk:sdk-core:2.31.78"
}
String generatedResources = "$buildDir/generated-resources/main"
sourceSets {
main {
output.dir(generatedResources, builtBy: "generateGitHash")
}
}
task generateGitHash {
inputs.property "revision", BuildParams.gitRevision
outputs.dir generatedResources
doLast {
Properties props = new Properties()
props.put("version", version)
props.put("hash", BuildParams.gitRevision)
File output = new File(generatedResources, "opensearch-hadoop-build.properties")
new File(generatedResources).mkdirs()
output.createNewFile()
props.store(output.newWriter(), null)
}
}
jar {
dependsOn(project.configurations.embedded)
from(project.configurations.embedded.collect { it.isDirectory() ? it : zipTree(it)}) {
include "org/opensearch/hadoop/**"
include "opensearch-hadoop-build.properties"
include "META-INF/services/*"
}
}
itestJar {
dependsOn(project.configurations.embedded)
dependsOn(project.configurations.itestEmbedded)
from(project.configurations.embedded.collect { it.isDirectory() ? it : zipTree(it)}) {
include "org/opensearch/hadoop/**"
include "opensearch-hadoop-build.properties"
include "META-INF/services/*"
}
from(project.configurations.itestEmbedded.collect { it.isDirectory() ? it : zipTree(it)}) {
include "org/opensearch/hadoop/**"
include "opensearch-hadoop-build.properties"
include "META-INF/services/*"
}
}
tasks.named("test").configure {
jvmArgs "--add-opens=java.base/java.io=ALL-UNNAMED" // Needed for IOUtils's BYTE_ARRAY_BUFFER reflection
jvmArgs "--add-opens=java.base/java.lang=ALL-UNNAMED" // Needed for secure mock
}
eclipse.classpath.file {
whenMerged { cp ->
// export all jars (to be used upstream by dependent projects) <-- for some reason Gradle removes all jars
cp.entries.each { entry ->
if (entry.hasProperty("exported"))
entry.exported = true
}
}
}