-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathbuild.gradle
162 lines (143 loc) · 5.04 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
155
156
157
158
159
160
161
162
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin
import org.opensearch.gradle.test.RestIntegTestTask
plugins {
id 'com.github.johnrengelman.shadow'
id 'jacoco'
id 'maven-publish'
id 'signing'
id "org.gradle.test-retry" version "1.5.8"
}
apply plugin: 'opensearch.java'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.java-rest-test'
repositories {
mavenLocal()
mavenCentral()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
}
ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE')
}
jacoco {
toolVersion = '0.8.7'
reportsDirectory = file("$buildDir/JacocoReport")
}
jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.destination file("${buildDir}/jacoco/")
}
}
check.dependsOn jacocoTestReport
def slf4j_version_of_cronutils = "2.0.7"
dependencies {
compileOnly "org.opensearch:opensearch:${opensearch_version}"
// slf4j is the runtime dependency of cron-utils
// if cron-utils version gets bumped, pls check the slf4j version cron-utils depending on
// and bump if needed
implementation "com.cronutils:cron-utils:9.2.1"
runtimeOnly "org.slf4j:slf4j-api:${slf4j_version_of_cronutils}"
testImplementation "org.opensearch.test:framework:${opensearch_version}"
testImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
}
configurations.all {
if (it.state != Configuration.State.UNRESOLVED) return
resolutionStrategy {
force "org.slf4j:slf4j-api:${slf4j_version_of_cronutils}"
}
}
shadowJar {
relocate 'com.cronutils', 'org.opensearch.jobscheduler.repackage.com.cronutils'
relocate 'org.slf4j', 'org.opensearch.jobscheduler.repackage.org.slf4j' // dependency of cron-utils
archiveClassifier = null
}
test {
retry {
failOnPassedAfterRetry = false
maxRetries = 5
}
doFirst {
// reverse operation of https://github.com/elastic/elasticsearch/blob/7.6/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy#L736-L743
// to fix the classpath for unit tests
test.classpath -= project.files(project.tasks.named('shadowJar'))
test.classpath -= project.configurations.getByName(ShadowBasePlugin.CONFIGURATION_NAME)
test.classpath += project.extensions.getByType(SourceSetContainer).getByName(SourceSet.MAIN_SOURCE_SET_NAME).runtimeClasspath
}
// add "-Dtests.security.manager=false" to VM options if you want to run integ tests in IntelliJ
systemProperty 'tests.security.manager', 'false'
}
task integTest(type: RestIntegTestTask) {
description 'Run integ test with opensearch test framework'
group 'verification'
systemProperty 'tests.security.manager', 'false'
dependsOn test
}
check.dependsOn integTest
testClusters.javaRestTest {
testDistribution = 'INTEG_TEST'
}
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 Job Scheduler SPI"
packaging = "jar"
url = "https://github.com/opensearch-project/job-scheduler"
description = "OpenSearch Job Scheduler"
scm {
connection = "scm:git@github.com:opensearch-project/job-scheduler.git"
developerConnection = "scm:git@github.com:opensearch-project/job-scheduler.git"
url = "git@github.com:opensearch-project/job-scheduler.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/job-scheduler"
}
}
}
}
}
// TODO - enabled debug logging for the time being, remove this eventually
gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS)
gradle.startParameter.setLogLevel(LogLevel.DEBUG)
}