forked from brown-uk/nlp_uk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
159 lines (130 loc) · 4.33 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
plugins {
id 'java'
id 'groovy'
id 'eclipse'
id 'maven-publish'
}
compileJava.options.encoding = 'UTF-8'
group = 'ua.net.nlp'
version="2.0-SNAPSHOT"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation group: 'org.codehaus.groovy', name: 'groovy', version: '3.0.9'
implementation group: 'org.codehaus.groovy', name: 'groovy-json', version: '3.0.9'
// implementation group: 'org.codehaus.groovy', name: 'groovy-cli-picocli', version: '3.0.9'
implementation group: 'info.picocli', name: 'picocli', version: '4.6.1'
implementation group:'ch.qos.logback', name:'logback-classic', version:'1.2.3'
implementation("org.languagetool:language-uk:$ltUkVersion") {
exclude module: 'hunspell'
exclude module: 'language-detector'
exclude module: 'lucene-core'
exclude group: 'org.apache.lucene'
exclude group: 'io.grpc'
}
implementation ("org.languagetool:language-ru:$ltVersion") {
exclude module: 'hunspell'
exclude module: 'language-detector'
exclude module: 'lucene-core'
exclude group: 'org.apache.lucene'
exclude group: 'io.grpc'
}
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.+'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.+'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
sourceSets {
main {
resources {
srcDir "src/main/groovy"
// include "**/*.groovy"
// includes = ["**/tools/*.md", "*.groovy", "**/*.txt"]
}
}
}
processResources {
doLast() {
copy {
from("src/main/groovy/") {
include "org/nlp_uk/tools/TagText.groovy"
}
// into "${project.buildDir}/resources/main"
into "${project.buildDir}/classes/java/main"
includeEmptyDirs = false
}
}
}
compileGroovy {
exclude '**/demo/**/*.groovy'
// exclude '**/other/**/*.groovy'
groovyOptions.forkOptions.jvmArgs = [ '-Dgroovy.grape.enable=false' ]
}
eclipse {
classpath {
defaultOutputDir = file('build')
file {
whenMerged { classpath ->
classpath.entries.findAll { entry -> entry.kind == 'lib' && entry.path =~ /languagetool-core|language-(uk|ru)/ }*.exported = true
}
}
}
}
test {
useJUnitPlatform()
jvmArgs '-Dgroovy.grape.enable=false'
}
task run(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = "ua.net.nlp_uk.ubertext.MongoDriver"
jvmArgs '-Dgroovy.grape.enable=false'
// args "--properties", propFile
}
// fatJar does not work due to LT having same file in different language modules
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'nlp_uk classes',
'Implementation-Version': archiveVersion
}
archiveBaseName = project.name + '-all'
// from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
publishing {
repositories {
mavenLocal()
}
publications {
mavenJava(MavenPublication) {
from components.java
//artifact dictJar
//artifact ltJar
}
}
}
// windows have non-unicode encoding set by default
String osName = System.getProperty("os.name").toLowerCase();
if ( osName.contains("windows")) {
if( ! "UTF-8".equals(System.getProperty("file.encoding")) ) {
println "On Windows to get unicode handled correctly you need to set environment variable before running expand:"
println "\tbash:"
println "\t\texport JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8"
println "\tcmd:"
println "\t\t(change Font to 'Lucida Console' in cmd window properties)"
println "\t\tchcp 65001"
println "\t\tset JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8"
println "\n\tNOTE: bash shell (e.g. git bash) is recommended: only in bash the output will handle all cyrillics and expandInteractive only supported in bash"
// poor man's safety net (may work but still will not show all cyrillic characters)
tasks.each { task ->
if( task instanceof JavaExec ) {
task.jvmArgs '-Dfile.encoding=UTF-8'
}
}
}
}