Ensure versions.props contains sorted entries (like check-lib-versions did for ant).

This commit is contained in:
Dawid Weiss 2020-01-03 16:04:12 +01:00
parent 37fb4a5f49
commit c9c0bab2eb
3 changed files with 22 additions and 2 deletions

View File

@ -42,6 +42,7 @@ apply from: file('gradle/validation/precommit.gradle')
apply from: file('gradle/validation/forbidden-apis.gradle')
apply from: file('gradle/validation/jar-checks.gradle')
apply from: file('gradle/validation/git-status.gradle')
apply from: file('gradle/validation/versions-props-sorted.gradle')
// Additional development aids.
apply from: file('gradle/maven/maven-local.gradle')

View File

@ -0,0 +1,19 @@
// This ensures 'versions.props' file is sorted lexicographically.
configure(rootProject) {
task versionsPropsAreSorted() {
doFirst {
def versionsProps = file('versions.props')
def lines = versionsProps.readLines("UTF-8")
def sorted = lines.toSorted()
if (!Objects.equals(lines, sorted)) {
def sortedFile = file("${buildDir}/versions.props")
sortedFile.write(sorted.join("\n"), "UTF-8")
throw new GradleException("${versionsProps} file is not sorted lexicographically. I wrote a sorted file to ${sortedFile} - please review and commit.")
}
}
}
precommit.dependsOn versionsPropsAreSorted
}

View File

@ -35,6 +35,7 @@ commons-logging:commons-logging=1.1.3
de.l3s.boilerpipe:boilerpipe=1.1.0
info.ganglia.gmetric4j:gmetric4j=1.0.7
io.dropwizard.metrics:*=4.1.2
io.jaegertracing:*=0.35.5
io.netty:*=4.1.29.Final
io.opentracing:*=0.33.0
io.prometheus:*=0.2.0
@ -107,5 +108,4 @@ org.slf4j:*=1.7.24
org.tallison:jmatio=1.5
org.tukaani:xz=1.8
ua.net.nlp:morfologik-ukrainian-search=3.9.0
xerces:xercesImpl=2.12.0
io.jaegertracing:*=0.35.5
xerces:xercesImpl=2.12.0