mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
makes checkLibVersions gradle 5 compatible
This commit is contained in:
parent
e809792467
commit
65390ef1d8
1 changed files with 27 additions and 25 deletions
52
build.gradle
52
build.gradle
|
@ -47,33 +47,35 @@ run {
|
|||
// Find any 3rd party libraries which have released new versions
|
||||
// to the central Maven repo since we last upgraded.
|
||||
// http://daniel.gredler.net/2011/08/08/gradle-keeping-libraries-up-to-date/
|
||||
task checkLibVersions << {
|
||||
def checked = [:]
|
||||
allprojects {
|
||||
configurations.each { configuration ->
|
||||
configuration.allDependencies.each { dependency ->
|
||||
def version = dependency.version
|
||||
if (!version.contains('SNAPSHOT') && !checked[dependency]) {
|
||||
def group = dependency.group
|
||||
def path = group.replace('.', '/')
|
||||
def name = dependency.name
|
||||
def url = "http://repo1.maven.org/maven2/$path/$name/maven-metadata.xml"
|
||||
try {
|
||||
def metadata = new XmlSlurper().parseText(url.toURL().text)
|
||||
def versions = metadata.versioning.versions.version.collect { it.text() }
|
||||
versions.removeAll { it.toLowerCase().contains('alpha') }
|
||||
versions.removeAll { it.toLowerCase().contains('beta') }
|
||||
versions.removeAll { it.toLowerCase().contains('rc') }
|
||||
def newest = versions.max()
|
||||
if (version != newest) {
|
||||
println "$group:$name $version -> $newest"
|
||||
task checkLibVersions {
|
||||
doLast {
|
||||
def checked = [:]
|
||||
allprojects {
|
||||
configurations.each { configuration ->
|
||||
configuration.allDependencies.each { dependency ->
|
||||
def version = dependency.version
|
||||
if (!version.contains('SNAPSHOT') && !checked[dependency]) {
|
||||
def group = dependency.group
|
||||
def path = group.replace('.', '/')
|
||||
def name = dependency.name
|
||||
def url = "http://repo1.maven.org/maven2/$path/$name/maven-metadata.xml"
|
||||
try {
|
||||
def metadata = new XmlSlurper().parseText(url.toURL().text)
|
||||
def versions = metadata.versioning.versions.version.collect { it.text() }
|
||||
versions.removeAll { it.toLowerCase().contains('alpha') }
|
||||
versions.removeAll { it.toLowerCase().contains('beta') }
|
||||
versions.removeAll { it.toLowerCase().contains('rc') }
|
||||
def newest = versions.max()
|
||||
if (version != newest) {
|
||||
println "$group:$name $version -> $newest"
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.debug "Unable to download $url: $e.message"
|
||||
} catch (org.xml.sax.SAXParseException e) {
|
||||
logger.debug "Unable to parse $url: $e.message"
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.debug "Unable to download $url: $e.message"
|
||||
} catch (org.xml.sax.SAXParseException e) {
|
||||
logger.debug "Unable to parse $url: $e.message"
|
||||
checked[dependency] = true
|
||||
}
|
||||
checked[dependency] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue