-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
187 lines (162 loc) · 6.45 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
import de.undercouch.gradle.tasks.download.Download
import com.github.mgk.gradle.*
buildscript {
ext {
elasticsearchVersion = System.getProperty("es.version", "7.4.0")
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "org.elasticsearch.gradle:build-tools:${elasticsearchVersion}"
}
}
plugins {
id "de.undercouch.download" version "3.2.0"
id "com.jfrog.bintray" version "1.8.4"
id "com.github.mgk.gradle.s3" version "1.4.0"
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'elasticsearch.esplugin'
ext {
licenseFile = rootProject.file('LICENSE')
noticeFile = rootProject.file('NOTICE')
}
group = 'com.code972.hebmorph'
description = """elasticsearch-analysis-hebrew"""
licenseHeaders {
additionalLicense 'AGPL3', 'GNU Affero General Public License', 'HebMorph\'s elasticsearch-analysis-hebrew'
approvedLicenses += ['GNU Affero General Public License']
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
compile group: 'com.code972.hebmorph', name: 'hebmorph-lucene', version: lucene
compileOnly group: 'org.apache.lucene', name: 'lucene-core', version: lucene
compileOnly group: 'org.apache.lucene', name: 'lucene-analyzers-common', version: lucene
compileOnly group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4j
compileOnly group: 'org.elasticsearch', name: 'elasticsearch', version: elasticsearch
testCompile group: 'org.elasticsearch.test', name: 'framework', version: elasticsearch
testCompile group: 'org.apache.lucene', name: 'lucene-test-framework', version: lucene
testCompile group: 'junit', name: 'junit', version: junit
}
task getHspellDictionary(type: Download) {
src([
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/hebrew.wgz',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/hebrew.wgz.desc',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/hebrew.wgz.prefixes',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/hebrew.wgz.sizes',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/hebrew.wgz.stems',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/prefixes.c',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/dmask.c',
'https://github.com/synhershko/HebMorph/raw/master/hspell-data-files/prefix_h.gz'
])
overwrite false
dest 'hspell-data-files/'
}
task cleanPackaging(type:Delete) {
delete 'src/main/packaging', 'src/main/plugin-metadata'
}
// To execute packaging of the commercial version, run gradlew build -Pcommercial
if (project.hasProperty('commercial')) {
version = elasticsearch + '-commercial'
esplugin {
name 'analysis-hebrew'
version rootProject.version
description 'Hebrew analyzer powered by HebMorph (Commercial version)'
classname 'com.code972.elasticsearch.HebrewAnalysisPlugin'
}
dependencyLicenses.enabled = false
thirdPartyAudit.enabled = false
repositories {
mavenLocal()
maven {
url "s3://releases.dictionary-loader.hebmorph.code972.com.s3.eu-central-1.amazonaws.com"
credentials(AwsCredentials) {
accessKey "${System.getenv('AWS_ACCESS_KEY_ID')}"
secretKey "${System.getenv('AWS_SECRET_ACCESS_KEY')}"
}
}
}
dependencies {
compile group: 'com.code972.hebmorph', name: 'dictionary-loader', version: lucene
}
task copyPackaging(type: Copy, dependsOn: cleanPackaging) {
from 'plugin-security-commercial.policy'
into 'src/main/plugin-metadata/'
rename ('plugin-security-commercial.policy', 'plugin-security.policy')
}
// Requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
task getCommercialDictionaryPointer(type: S3Download, dependsOn: cleanPackaging) {
bucket = 'releases.dictionary.hebmorph.code972.com'
key = 'latest'
file = 'src/main/packaging/dictionary.spec'
}
task getCommercialDictionary(type: S3Download, dependsOn: getCommercialDictionaryPointer) {
doFirst {
def fn = new File('src/main/packaging/dictionary.spec').readLines().get(0)
key = fn
}
bucket = 'releases.dictionary.hebmorph.code972.com'
file = 'src/main/packaging/dictionary.dict'
}
bundlePlugin.dependsOn getCommercialDictionary, copyPackaging
task release(type: S3Upload) {
bucket = 'releases.elasticsearch-analysis-hebrew.hebmorph.code972.com'
file = 'build/distributions/analysis-hebrew-'+ project.version +'.zip'
key = 'analysis-hebrew-'+ project.version +'.zip'
overwrite = true
// TODO: make public
}
} else {
version = elasticsearch
esplugin {
name 'analysis-hebrew'
version rootProject.version
description 'Hebrew analyzer powered by HebMorph'
classname 'com.code972.elasticsearch.HebrewAnalysisPlugin'
}
thirdPartyAudit.enabled = false
task copyPackaging(type: Copy, dependsOn: [getHspellDictionary, cleanPackaging]) {
into 'src/main/packaging'
from 'plugin-security.policy'
into('hspell-data-files') {
from 'hspell-data-files'
}
}
bundlePlugin.dependsOn copyPackaging
bintray {
user = 'synhershko'
key = System.getenv('BINTRAY_KEY')
filesSpec {
from 'build/distributions/analysis-hebrew-'+ project.version +'.zip'
rename ('analysis-hebrew-'+ project.version +'.zip', 'elasticsearch-analysis-hebrew-'+ project.version +'.zip')
into '.'
}
publish = true
pkg {
repo = 'elasticsearch-analysis-hebrew'
name = 'elasticsearch-analysis-hebrew-plugin'
licenses = ['AGPL-V3']
publicDownloadNumbers = true
vcsUrl = 'https://github.com/synhershko/elasticsearch-analysis-hebrew.git'
githubRepo = 'synhershko/elasticsearch-analysis-hebrew'
githubReleaseNotesFile = 'README.md'
websiteUrl = 'http://code972.com/hebmorph'
version {
name = project.version
vcsTag = elasticsearch
}
}
}
task release(dependsOn: bintrayUpload) {
// Placeholder task just to run the bintrayUpload task
}
}