-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.gradle
128 lines (112 loc) · 4.75 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
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
plugins {
id 'com.netflix.nebula.ospackage' version "11.6.0"
id 'checkstyle'
id "io.freefair.lombok" version "8.4"
id 'jacoco'
id 'java'
id 'java-library'
id "com.diffplug.spotless" version "6.23.3"
id 'idea'
id 'eclipse'
}
repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
allprojects {
version = '3.0.0-SNAPSHOT'
// Force using a newer version, due to guava vulnerability CVE-2023-2976. Remove after Gradle upgrades its default version.
checkstyle {
toolVersion = "10.12.3"
}
java {
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'com.diffplug.spotless'
ext {
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
sdk_version = "3.24.0"
jackson_version = "2.18.2"
}
repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
// Fix dependency collision with opensearch
configurations.all {
if (it.state != Configuration.State.UNRESOLVED) return
resolutionStrategy {
force "com.fasterxml.jackson.module:jackson-module-jaxb-annotations:${jackson_version}"
force "com.fasterxml.jackson.core:jackson-annotations:${jackson_version}"
force "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
force "com.fasterxml.jackson.core:jackson-core:${jackson_version}"
force "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jackson_version}"
force "commons-codec:commons-codec:1.15"
force "org.apache.httpcomponents:httpcore:4.4.15"
force "jakarta.annotation:jakarta.annotation-api:2.1.1"
force "org.javassist:javassist:3.25.0-GA"
force "org.apache.httpcomponents:httpclient:4.5.14"
// Force spotless depending on newer version of guava due to CVE-2023-2976. Remove after spotless upgrades.
force "com.google.guava:guava:32.1.2-jre"
// Force opensearch transport-netty4-client depending on newer version of netty-handler due to CVE-2023-34462.
// Remove after upgrading the compiled opensearch version.
force "io.netty:netty-handler:4.1.94.Final"
force "org.bouncycastle:bcpkix-jdk15to18:1.78.1"
force "org.bouncycastle:bcprov-jdk15to18:1.78.1"
force "org.bouncycastle:bcutil-jdk15to18:1.78.1"
}
}
dependencies {
// Test dependencies
testImplementation 'org.assertj:assertj-core:3.18.1'
// Bridging logs from other frameworks into Log4j2 to see logs from 3rd party libs (e.g. OCI SDK, Apache,...)
// Not including as implementation as could cause jar hell errors in the final distributive.
testImplementation "org.apache.logging.log4j:log4j-slf4j-impl:2.21.0"
testImplementation "org.apache.logging.log4j:log4j-1.2-api:2.21.0"
testImplementation "org.apache.logging.log4j:log4j-jcl:2.21.0"
testImplementation "org.apache.logging.log4j:log4j-jul:2.21.0"
}
compileJava {
options.compilerArgs.addAll(["-processor", 'lombok.launch.AnnotationProcessorHider$AnnotationProcessor'])
doFirst {
// TODO: do not fail build on warnings, need to fix all compiler warnings
options.compilerArgs.remove('-Werror')
// TODO: need to fix all java doc format
options.compilerArgs.remove('-Xdoclint:all')
}
}
spotless {
// optional: limit format enforcement to just the files changed by this feature branch
//ratchetFrom 'origin/main'
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
//indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// only scan main source files
target 'src/main/**/*.java'
// Use the default importOrder configuration
importOrder()
removeUnusedImports()
// apply a specific flavor of google-java-format
googleJavaFormat().aosp().reflowLongStrings()
// fix formatting of type annotations
formatAnnotations()
}
}
}