forked from opensearch-project/custom-codecs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
202 lines (179 loc) · 6.3 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
buildscript {
ext {
opensearch_group = "org.opensearch"
opensearch_version = System.getProperty("opensearch.version", "2.11.1-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "${opensearch_group}.gradle:build-tools:${opensearch_version}"
classpath "org.jacoco:org.jacoco.agent:0.8.5"
}
}
plugins {
id 'java'
}
apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.internal-cluster-test'
apply plugin: 'opensearch.pluginzip'
apply plugin: 'opensearch.rest-test'
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
}
allprojects {
group 'org.opensearch'
version = opensearch_version.tokenize('-')[0] + '.0'
if (buildVersionQualifier) {
version += "-${buildVersionQualifier}"
}
if (isSnapshot) {
version += "-SNAPSHOT"
}
plugins.withId('java') {
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
}
}
opensearchplugin {
name 'opensearch-custom-codecs'
description 'OpenSearch plugin that implements custom compression codecs'
classname 'org.opensearch.index.codec.customcodecs.CustomCodecPlugin'
licenseFile rootProject.file('LICENSE')
noticeFile rootProject.file('NOTICE')
}
dependencies {
api "com.github.luben:zstd-jni:1.5.5-5"
}
allprojects {
// Default to the apache license
project.ext.licenseName = 'The Apache Software License, Version 2.0'
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
publishing {
repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
}
publications {
// add license information to generated poms
pluginZip(MavenPublication) { publication ->
pom {
name = "opensearch-custom-codecs"
description = "OpenSearch plugin that implements custom compression codecs"
}
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2021')
Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', project.licenseName)
license.appendNode('url', project.licenseUrl)
Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'OpenSearch')
developer.appendNode('url', 'https://github.com/opensearch-project/custom-codecs')
}
}
}
}
}
publishing {
publications {
pluginZip(MavenPublication) { publication ->
pom {
name = "opensearch-custom-codecs"
description = "OpenSearch plugin that implements custom compression codecs"
groupId = "org.opensearch.plugin"
}
}
}
repositories {
maven {
name = "Snapshots"
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
credentials {
username "$System.env.SONATYPE_USERNAME"
password "$System.env.SONATYPE_PASSWORD"
}
}
}
}
// ignore missing javadocs
tasks.withType(Javadoc).configureEach { Javadoc javadoc ->
// the -quiet here is because of a bug in gradle, in that adding a string option
// by itself is not added to the options. By adding quiet, both this option and
// the "value" -quiet is added, separated by a space. This is ok since the javadoc
// command already adds -quiet, so we are just duplicating it
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
javadoc.options.encoding = 'UTF8'
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
boolean failOnJavadocWarning = project.ext.has('failOnJavadocWarning') ? project.ext.get('failOnJavadocWarning') : true
if (failOnJavadocWarning) {
javadoc.options.addStringOption('Xwerror', '-quiet')
}
javadoc.options.tags = ["opensearch.internal", "opensearch.api", "opensearch.experimental"]
javadoc.options.addStringOption("-release", java.targetCompatibility.majorVersion)
}
loggerUsageCheck.enabled = false
validateNebulaPom.enabled = false
sourceSets {
integTest {
java {
srcDirs file("src/integrationTest/java")
}
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath
}
}
tasks.named("testingConventions").configure {
naming.clear()
naming {
Tests {
baseClass "org.apache.lucene.tests.util.LuceneTestCase"
}
IT {
baseClass "org.opensearch.test.OpenSearchIntegTestCase"
baseClass "org.opensearch.test.OpenSearchSingleNodeTestCase"
}
}
}
integTest {
description = "Run tests against a cluster"
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath
dependsOn "bundlePlugin"
systemProperty 'tests.security.manager', 'true'
systemProperty "https", System.getProperty("https")
systemProperty "user", System.getProperty("user")
systemProperty "password", System.getProperty("password")
}
testClusters.integTest {
testDistribution = "ARCHIVE"
plugin(project.tasks.bundlePlugin.archiveFile)
}
tasks.withType(PublishToMavenRepository) {
def predicate = provider {
publication.name == "pluginZip"
}
onlyIf("Publishing only ZIP distributions") {
predicate.get()
}
}