Wire central catalog refresh#21
Conversation
There was a problem hiding this comment.
Code Review
This pull request registers a new Gradle task refreshCatalog in build.gradle to download and update the central NostrGameEngine version catalog, and significantly expands gradle/libs.versions.toml with numerous new versions, libraries, bundles, and plugins. A review comment suggests adding explicit connection and read timeouts to the network request in the refreshCatalog task to prevent the build or CI/CD pipelines from hanging indefinitely on unstable connections.
| doLast { | ||
| def target = outputFile.asFile | ||
| target.parentFile.mkdirs() | ||
| target.text = new URI(catalogUrl.get()).toURL().getText('UTF-8') | ||
| println "Refreshed ${target}" | ||
| } |
There was a problem hiding this comment.
The refreshCatalog task downloads the central catalog using URL.getText(), which does not have any connection or read timeouts configured by default. If the network connection is unstable or the remote server is unresponsive, this can cause the Gradle build (and CI/CD pipelines) to hang indefinitely.
It is highly recommended to configure explicit connect and read timeouts on the connection.
doLast {
def target = outputFile.asFile
target.parentFile.mkdirs()
def connection = new URI(catalogUrl.get()).toURL().openConnection()
connection.connectTimeout = 10000
connection.readTimeout = 10000
target.text = connection.getInputStream().getText('UTF-8')
println "Refreshed ${target}"
}
Summary
refreshCatalogGradle task that downloadsNostrGameEngine/libs.catalog.refresh-catalog.ymlworkflow that opens a PR only when the refreshed catalog changes.Verification
tomllib.YAML.load_file../gradlew --no-daemon -q refreshCatalogsuccessfully inbech32as the representative Groovy Gradle task.Note: local Kotlin-task execution in
cap-cache-generatorwas blocked before task execution because the machine ran out of disk space while the Gradle wrapper tried to install Gradle 8.4.