forked from aparo/opensearch-learning-to-rank
-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
159 lines (128 loc) · 4.87 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
import java.nio.file.Files
buildscript {
repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.opensearch.gradle:build-tools:${opensearchVersion}"
}
}
plugins {
id "co.riiid.gradle" version "0.4.2"
}
group = 'com.o19s'
version = "${ltrVersion}-os${opensearchVersion}"
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.java-rest-test'
apply plugin: 'opensearch.rest-resources'
//apply plugin: 'opensearch.yaml-rest-test'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
// license of this project
licenseFile = rootProject.file('LICENSE.txt')
// copyright notices
noticeFile = rootProject.file('NOTICE.txt')
// disable uploadArchives task for now, no upload happening currently
//GSI TODO: disabled for now
//uploadArchives.enabled = false
opensearchplugin {
name 'ltr'
description 'Learning to Rank Query w/ RankLib Models'
classname 'com.o19s.es.ltr.LtrQueryParserPlugin'
// license of the plugin, may be different than the above license
licenseFile = rootProject.file('LICENSE.txt')
// copyright notices, may be different than the above notice
noticeFile = rootProject.file('NOTICE.txt')
}
// In this section you declare the dependencies for your production and test code
// OpenSearch dependency is included due to the build-tools, test-framework as well
repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
implementation "org.apache.lucene:lucene-expressions:${luceneVersion}"
implementation "org.antlr:antlr4-runtime:${antlrVersion}"
implementation "org.ow2.asm:asm:${ow2Version}"
implementation "org.ow2.asm:asm-commons:${ow2Version}"
implementation "org.ow2.asm:asm-tree:${ow2Version}"
implementation 'com.o19s:RankyMcRankFace:0.1.1'
implementation "com.github.spullara.mustache.java:compiler:0.9.3"
//testImplementation 'org.apache.lucene:lucene-test-framework:${luceneVersion}'
runtimeOnly 'org.locationtech.spatial4j:spatial4j:0.7'
runtimeOnly 'org.locationtech.jts:jts-core:1.15.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.21.0'
}
// see https://github.com/opensearch-project/OpenSearch/blob/0ba0e7cc26060f964fcbf6ee45bae53b3a9941d0/buildSrc/src/main/java/org/opensearch/gradle/precommit/DependencyLicensesTask.java
dependencyLicenses {
mapping from: /lucene-.*/, to: 'lucene'
mapping from: /asm-.*/, to: 'asm'
mapping from: /RankyMcRankFace.*/, to: 'lucene'
//mapping from: /Ranky.*/, to: 'lucene'
mapping from: /compiler.*/, to: 'lucene'
}
sourceSets {
javaRestTest {
compileClasspath += sourceSets["main"].output + sourceSets["test"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath
}
}
java {
withJavadocJar()
withSourcesJar()
}
// Set to false to not use opensearch checkstyle rules
// checkstyleMain.enabled = true
// checkstyleTest.enabled = true
// FIXME dependency license check needs to be enabled
// dependencyLicenses.enabled = false
// FIXME thirdparty audit needs to be enabled
// thirdPartyAudit.enabled = false
// Uncomment this to skip license header checks
// licenseHeaders.enabled = false
// No need to validate POM, as we do not upload to sonatype
validateNebulaPom.enabled = false
// Elastic tried to remove the logging requirement for plugins, but didn't get it quite right so this is a short term fix until 7.11
// https://github.com/elastic/opensearch/issues/65247
loggerUsageCheck.enabled = false
githubRelease.doFirst {
if (!System.getProperty('GITHUB_TOKEN', '')) {
throw new Exception('Missing property GITHUB_TOKEN')
}
// check if zip file is there
assert file("build/distributions/ltr-${version}.zip").exists()
// rename zip file
def currentVersion = version.replace('-SNAPSHOT', '')
def filename = "build/distributions/ltr-${currentVersion}.zip"
Files.copy(file("build/distributions/ltr-${version}.zip").toPath(), file(filename).toPath())
// configuration
github {
owner = 'gsingers'
repo = 'opensearch-learning-to-rank-base'
token = System.getProperty('GITHUB_TOKEN')
tagName = currentVersion
assets = [ filename ]
targetCommitish = 'main'
}
}
tasks.withType(Test).configureEach { task ->
if (JavaVersion.current().compareTo(JavaVersion.VERSION_17) > 0 && JavaVersion.current().compareTo(JavaVersion.VERSION_21) < 0) {
def policyFile = file("${projectDir}/src/main/plugin-metadata/plugin-security.policy").absolutePath
task.jvmArgs += [
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"-Djava.security.manager",
"-Djava.security.policy=" + policyFile
]
}
}