Skip to content

Commit

Permalink
Upgrade to Groovy 4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
olovy committed Aug 2, 2022
1 parent 6b7c89d commit fc82f24
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 39 deletions.
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
org.gradle.daemon=true
groovyVersion=3.0.9
groovyVersion=4.0.4
# TODO: upgrade to 2.2 when released
spockVersion=2.2-M3-groovy-4.0
jettyVersion = 9.4.44.v20210927
prometheusVersion = 0.15.0
log4jVersion = 2.17.0
resilience4jVersion = 1.7.1
httpComponentsCoreVersion = 4.4.14
httpComponentsClientVersion = 4.5.13
systemProp.https.protocols=TLSv1.1,TLSv1.2
spockVersion=2.1-groovy-3.0
guavaVersion=31.1-jre
jacocoVersion=0.8.8
8 changes: 4 additions & 4 deletions importers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dependencies {

// Common tools
providedCompile 'javax.servlet:servlet-api:2.5'
implementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
implementation "org.apache.groovy:groovy-all:${groovyVersion}"
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'

// Integration
Expand All @@ -83,9 +83,9 @@ dependencies {
// profiling and test
testImplementation "org.spockframework:spock-core:${spockVersion}"
testImplementation 'cglib:cglib-nodep:3.1'
implementation "org.codehaus.groovy:groovy-json:${groovyVersion}"
implementation "org.codehaus.groovy:groovy-sql:${groovyVersion}"
implementation "org.codehaus.groovy:groovy:${groovyVersion}"
implementation "org.apache.groovy:groovy-json:${groovyVersion}"
implementation "org.apache.groovy:groovy-sql:${groovyVersion}"
implementation "org.apache.groovy:groovy:${groovyVersion}"
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'org.slf4j:slf4j-simple:1.7.32'
}
Expand Down
3 changes: 2 additions & 1 deletion librisxl-tools/examples/ExerciseOaipmh.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import groovy.xml.XmlSlurper
import groovy.xml.StreamingMarkupBuilder
import groovy.util.slurpersupport.GPathResult
import groovy.xml.slurpersupport.GPathResult

class ExerciseOaipmh {

Expand Down
2 changes: 1 addition & 1 deletion marc_export/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
}
implementation group: 'xml-apis', name: 'xml-apis', version: '1.4.01'
implementation 'org.apache.commons:commons-lang3:3.3.2'
implementation "org.codehaus.groovy:groovy:${groovyVersion}"
implementation "org.apache.groovy:groovy:${groovyVersion}"
}

gretty {
Expand Down
10 changes: 5 additions & 5 deletions rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ dependencies {
implementation(project(':whelk-core'))

// Common tools
implementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
implementation "org.codehaus.groovy:groovy-dateutil:${groovyVersion}"
implementation "org.apache.groovy:groovy-all:${groovyVersion}"
implementation "org.apache.groovy:groovy-dateutil:${groovyVersion}"
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
implementation 'commons-io:commons-io:2.11.0'
implementation "com.google.guava:guava:${guavaVersion}"
Expand Down Expand Up @@ -101,10 +101,10 @@ dependencies {
// Standalone
executableWarDeps "org.eclipse.jetty:jetty-server:${jettyVersion}"
executableWarDeps "org.eclipse.jetty:jetty-webapp:${jettyVersion}"
executableWarDeps "org.codehaus.groovy:groovy-all:${groovyVersion}"
executableWarDeps "org.apache.groovy:groovy-all:${groovyVersion}"
executableWarDeps 'commons-cli:commons-cli:1.2'
implementation "org.codehaus.groovy:groovy-xml:${groovyVersion}"
implementation "org.codehaus.groovy:groovy:${groovyVersion}"
implementation "org.apache.groovy:groovy-xml:${groovyVersion}"
implementation "org.apache.groovy:groovy:${groovyVersion}"
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
implementation 'xml-apis:xml-apis:1.4.01'
}
Expand Down
3 changes: 2 additions & 1 deletion rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package whelk.rest.api

import groovy.util.logging.Log4j2 as Log
import groovy.util.slurpersupport.GPathResult
import groovy.xml.XmlSlurper
import groovy.xml.slurpersupport.GPathResult
import groovy.xml.StreamingMarkupBuilder
import se.kb.libris.util.marc.Field
import se.kb.libris.util.marc.MarcRecord
Expand Down
8 changes: 4 additions & 4 deletions whelk-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ dependencies {
implementation "io.github.resilience4j:resilience4j-circuitbreaker:${resilience4jVersion}"
implementation "io.github.resilience4j:resilience4j-prometheus:${resilience4jVersion}"
implementation "io.github.resilience4j:resilience4j-retry:${resilience4jVersion}"
implementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
implementation "org.apache.groovy:groovy-all:${groovyVersion}"
implementation 'com.damnhandy:handy-uri-templates:2.0.4'
implementation 'com.zaxxer:HikariCP:4.0.3'
implementation 'commons-codec:commons-codec:1.7'
api 'commons-io:commons-io:2.11.0'
implementation "org.apache.httpcomponents:httpclient:${httpComponentsClientVersion}"
implementation "org.apache.httpcomponents:httpcore:${httpComponentsCoreVersion}"
implementation 'org.apache.jena:apache-jena-libs:3.0.1'
api "org.codehaus.groovy:groovy-json:${groovyVersion}"
api "org.codehaus.groovy:groovy-xml:${groovyVersion}"
api "org.codehaus.groovy:groovy:${groovyVersion}"
api "org.apache.groovy:groovy-json:${groovyVersion}"
api "org.apache.groovy:groovy-xml:${groovyVersion}"
api "org.apache.groovy:groovy:${groovyVersion}"
api 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
implementation 'xerces:xercesImpl:2.11.0' //KP

Expand Down
1 change: 0 additions & 1 deletion whelk-core/src/main/groovy/se/kb/libris/Normalizers.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import whelk.component.DocumentNormalizer
import whelk.exception.InvalidQueryException
import whelk.filter.BlankNodeLinker
import whelk.filter.LanguageLinker
import whelk.util.DocumentUtil
import whelk.util.DocumentUtil.Remove

import static whelk.JsonLd.GRAPH_KEY
Expand Down
26 changes: 13 additions & 13 deletions whelk-core/src/main/groovy/whelk/JsonLd.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class JsonLd {
}

static List<List<String>> findPaths(Map obj, String key, Set<String> values) {
List paths = []
List<List<String>> paths = []
new DFS().search(obj, { List path, v ->
if (v in values && key == path[-1]) {
paths << new ArrayList(path)
Expand Down Expand Up @@ -670,7 +670,7 @@ class JsonLd {
return jsonLd
}

List graphItems = jsonLd.get(GRAPH_KEY)
List graphItems = (List) jsonLd.get(GRAPH_KEY)

additionalObjects.each { object ->
if (object instanceof Map) {
Expand Down Expand Up @@ -791,8 +791,8 @@ class JsonLd {
* [<language>, <property value>] pairs.
*/
private List applyLensAsListByLang(Map thing, Set<String> languagesToKeep, List<String> removableBaseUris, String lensToUse) {
Map lensGroups = displayData.get('lensGroups')
Map lensGroup = lensGroups.get(lensToUse)
Map lensGroups = (Map) displayData.get('lensGroups')
Map lensGroup = (Map) lensGroups.get(lensToUse)
Map lens = getLensFor((Map)thing, lensGroup)
List parts = []

Expand Down Expand Up @@ -867,12 +867,12 @@ class JsonLd {
be displayed on the frontend. Mainly for use as search keys.
*/
Map applyLensAsMapByLang(Map thing, Set<String> languagesToKeep, List<String> removableBaseUris, List<String> lensesToTry) {
Map lensGroups = displayData.get('lensGroups')
Map lensGroups = (Map) displayData.get('lensGroups')
Map lens = null
String initialLens
String initialLens = null

for (String lensToTry : lensesToTry) {
Map lensGroup = lensGroups.get(lensToTry)
Map lensGroup = (Map) lensGroups.get(lensToTry)
lens = getLensFor((Map)thing, lensGroup)
if (lens) {
initialLens = lensToTry
Expand Down Expand Up @@ -931,8 +931,8 @@ class JsonLd {
}

List makeSearchKeyParts(Map object) {
Map lensGroups = displayData.get('lensGroups')
Map lensGroup = lensGroups.get('chips')
Map lensGroups = (Map) displayData.get('lensGroups')
Map lensGroup = (Map) lensGroups.get('chips')
Map lens = getLensFor(object, lensGroup)
List parts = []
def type = object.get(TYPE_KEY)
Expand Down Expand Up @@ -972,8 +972,8 @@ class JsonLd {
return new LinkedHashSet(((List) data[GRAPH_KEY]).collect{ getInverseProperties((Map) it, lensType) }.flatten())
}

Map lensGroups = displayData.get('lensGroups')
Map lensGroup = lensGroups.get(lensType)
Map lensGroups = (Map) displayData.get('lensGroups')
Map lensGroup = (Map) lensGroups.get(lensType)
Map lens = getLensFor(data, lensGroup)
return new LinkedHashSet((List) lens?.get('inverseProperties') ?: [])
}
Expand All @@ -996,7 +996,7 @@ class JsonLd {
}

private Map getLens(Map thing, List<String> lensTypes) {
Map lensGroups = displayData.get('lensGroups')
Map lensGroups = (Map) displayData.get('lensGroups')
lensTypes.findResult { lensType ->
lensGroups.get(lensType)?.with { getLensFor(thing, (Map) it) }
}
Expand Down Expand Up @@ -1052,7 +1052,7 @@ class JsonLd {

private Map findLensForType(String typeKey, Map lensGroup) {
def lenses = lensGroup['lenses']
Map lens = ((Map)lenses).get(typeKey)
Map lens = (Map) ((Map)lenses).get(typeKey)
if (lens)
return lens
def typedfn = vocabIndex.get(typeKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ class MarcFixedFieldHandler {
static boolean isColKey(key) { ((String) key)?.startsWith('[') }

static List<Tuple2<Integer, Integer>> parseColumnNumbers(key) {
List colNums = []
List<Tuple2<Integer, Integer>> colNums = []
(key =~ /\[(\d+)(?::(\d+))?\]\s*/).each { List<String> m ->
Integer start = m[1].toInteger()
Integer end = m[2]?.toInteger() ?: start + 1
Expand Down
5 changes: 2 additions & 3 deletions whelk-core/src/main/groovy/whelk/search/ESQuery.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -808,17 +808,16 @@ class ESQuery {
} else {
currentField = "${parentName}.${fieldName}"
}
Map fields = fieldSettings.get('fields')
Map fields = (Map) fieldSettings.get('fields')
if (fields && fields.get('keyword')) {
result.add(currentField)
}
Map properties = fieldSettings.get('properties')
Map properties = (Map) fieldSettings.get('properties')
if (properties) {
result += getKeywordFieldsFromProperties(properties, currentField)
}
return result
}

/**
* Hide any `.keyword` field in ES response.
*
Expand Down
1 change: 1 addition & 0 deletions whelk-core/src/main/groovy/whelk/util/MarcExport.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import whelk.Document
import whelk.JsonLd
import whelk.Whelk
import whelk.converter.marc.JsonLD2MarcXMLConverter
import groovy.xml.XmlSlurper

@Log4j2
class MarcExport {
Expand Down
6 changes: 3 additions & 3 deletions whelktool/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ dependencies {
testImplementation "org.spockframework:spock-core:${spockVersion}"
testImplementation 'junit:junit:4.13.2'
implementation "com.google.guava:guava:${guavaVersion}"
implementation "org.codehaus.groovy:groovy-cli-commons:${groovyVersion}"
implementation "org.codehaus.groovy:groovy-jsr223:${groovyVersion}"
implementation "org.codehaus.groovy:groovy:${groovyVersion}"
implementation "org.apache.groovy:groovy-cli-commons:${groovyVersion}"
implementation "org.apache.groovy:groovy-jsr223:${groovyVersion}"
implementation "org.apache.groovy:groovy:${groovyVersion}"
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
implementation group: 'xml-apis', name: 'xml-apis', version: '1.4.01'
}
Expand Down
1 change: 1 addition & 0 deletions whelktool/src/main/groovy/datatool/WhelkTool.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package whelk.datatool

import com.google.common.util.concurrent.MoreExecutors
import groovy.cli.commons.CliBuilder
import org.codehaus.groovy.jsr223.GroovyScriptEngineImpl
import whelk.Document
import whelk.IdGenerator
Expand Down

0 comments on commit fc82f24

Please sign in to comment.