-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathbuild.gradle
154 lines (139 loc) · 5.18 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
//TODO: cleanup gradle config file, some overlap
plugins {
id 'java'
id 'com.github.johnrengelman.shadow'
id 'jacoco'
id "io.freefair.lombok"
id 'com.diffplug.spotless' version '6.25.0'
id 'maven-publish'
id 'signing'
}
dependencies {
compileOnly group: 'org.opensearch', name: 'opensearch', version: "${opensearch_version}"
compileOnly group: 'org.reflections', name: 'reflections', version: '0.9.12'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
compileOnly "org.opensearch.client:opensearch-rest-client:${opensearch_version}"
compileOnly "org.opensearch:common-utils:${common_utils_version}"
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0'
testImplementation "org.opensearch.test:framework:${opensearch_version}"
compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
compileOnly group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
compileOnly group: 'org.json', name: 'json', version: '20231013'
testImplementation group: 'org.json', name: 'json', version: '20231013'
implementation('com.google.guava:guava:32.1.3-jre') {
exclude group: 'com.google.guava', module: 'failureaccess'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'org.checkerframework', module: 'checker-qual'
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'com.google.j2objc', module: 'j2objc-annotations'
exclude group: 'com.google.guava', module: 'listenablefuture'
}
compileOnly 'com.jayway.jsonpath:json-path:2.9.0'
compileOnly("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
compileOnly("com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}")
compileOnly group: 'com.networknt' , name: 'json-schema-validator', version: '1.4.0'
}
lombok {
version = "1.18.30"
}
jacocoTestReport {
reports {
xml.getRequired().set(true)
csv.getRequired().set(false)
html.getRequired().set(true)
}
dependsOn test
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = 'LINE'
minimum = 0.8 //TODO: add more test to meet the coverage bar 0.9
}
limit {
counter = 'BRANCH'
minimum = 0.7 //TODO: add more test to meet the coverage bar 0.9
}
}
}
dependsOn jacocoTestReport
}
check.dependsOn jacocoTestCoverageVerification
spotless {
java {
removeUnusedImports()
importOrder 'java', 'javax', 'org', 'com'
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
}
}
shadowJar {
destinationDirectory = file("${project.buildDir}/distributions")
archiveClassifier.set(null)
exclude 'META-INF/maven/com.google.guava/**'
exclude 'com/google/thirdparty/**'
relocate 'com.google.common', 'org.opensearch.ml.repackage.com.google.common' // dependency of cron-utils
}
jar {
enabled false
}
task sourcesJar(type: Jar) {
archiveClassifier.set 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
archiveClassifier.set 'javadoc'
from javadoc.destinationDir
dependsOn javadoc
}
publishing {
repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
maven {
name = "Snapshots" // optional target repository name
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
credentials {
username "$System.env.SONATYPE_USERNAME"
password "$System.env.SONATYPE_PASSWORD"
}
}
}
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
artifact sourcesJar
artifact javadocJar
pom {
name = "OpenSearch ML Commons Comm"
packaging = "jar"
url = "https://github.com/opensearch-project/ml-commons"
description = "OpenSearch ML Common"
scm {
connection = "scm:git@github.com:opensearch-project/ml-commons.git"
developerConnection = "scm:git@github.com:opensearch-project/ml-commons.git"
url = "git@github.com:opensearch-project/ml-commons.git"
}
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name = "OpenSearch"
url = "https://github.com/opensearch-project/ml-commons"
}
}
}
}
}
}
publishShadowPublicationToMavenLocal.mustRunAfter shadowJar