Do stuff
This commit is contained in:
parent
13b80cf02f
commit
3dc6a5d8ae
38
build.gradle
38
build.gradle
|
@ -77,3 +77,41 @@ tasks.register("generateVersion", Copy) {
|
|||
}
|
||||
|
||||
sourceSets.main.java.srcDir generateVersion.outputs.files
|
||||
|
||||
tasks.register("depsize") {
|
||||
description = 'Prints dependencies for "default" configuration'
|
||||
doLast() {
|
||||
listConfigurationDependencies(configurations.default)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("depsize-all-configurations") {
|
||||
description = 'Prints dependencies for all available configurations'
|
||||
doLast() {
|
||||
configurations
|
||||
.findAll { it.isCanBeResolved() }
|
||||
.each { listConfigurationDependencies(it) }
|
||||
}
|
||||
}
|
||||
|
||||
def listConfigurationDependencies(Configuration configuration) {
|
||||
def formatStr = "%,10.2f"
|
||||
|
||||
def size = configuration.collect { it.length() / (1024 * 1024) }.sum()
|
||||
|
||||
def out = new StringBuffer()
|
||||
out << "\nConfiguration name: \"${configuration.name}\"\n"
|
||||
if (size) {
|
||||
out << 'Total dependencies size:'.padRight(65)
|
||||
out << "${String.format(formatStr, size)} Mb\n\n"
|
||||
|
||||
configuration.sort { -it.length() }
|
||||
.each {
|
||||
out << "${it.name}".padRight(65)
|
||||
out << "${String.format(formatStr, (it.length() / 1024))} kb\n"
|
||||
}
|
||||
} else {
|
||||
out << 'No dependencies found';
|
||||
}
|
||||
println(out)
|
||||
}
|
||||
|
|
|
@ -116,7 +116,11 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
|||
clientSettings.maxCacheSizeInMebibytes * 1024 * 1024 /* MiB to bytes */
|
||||
)
|
||||
cache.get("statistics")?.use {
|
||||
statistics.set(JACKSON.readValue<Statistics>(it.getInputStream(0)))
|
||||
try {
|
||||
statistics.set(JACKSON.readValue<Statistics>(it.getInputStream(0)))
|
||||
} catch (_: JsonProcessingException) {
|
||||
cache.remove("statistics")
|
||||
}
|
||||
}
|
||||
} catch (e: HeaderMismatchException) {
|
||||
LOGGER.warn { "Cache version may be outdated - remove if necessary" }
|
||||
|
@ -479,7 +483,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
|||
}
|
||||
|
||||
private fun isSecretValid(clientSecret: String): Boolean {
|
||||
return Pattern.matches("^[a-zA-Z0-9]{$CLIENT_KEY_LENGTH}$", clientSecret)
|
||||
return Pattern.matches("^[a-zA-Z0-9]*$CLIENT_KEY_LENGTH}$", clientSecret)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
Loading…
Reference in a new issue