Wire central catalog refresh#1
Conversation
There was a problem hiding this comment.
Code Review
This pull request registers a new Gradle task refreshCatalog to download and update the central NostrGameEngine Gradle version catalog, and significantly expands gradle/libs.versions.toml with a comprehensive list of dependencies, versions, bundles, and plugins. Feedback on the refreshCatalog task suggests removing the output declaration to prevent Gradle from incorrectly skipping the task as UP-TO-DATE, and adding connection and read timeouts to the network request to prevent the build from hanging indefinitely.
| outputs.file(outputFile) | ||
|
|
||
| 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.
Declaring outputs.file(outputFile) without any corresponding inputs or outputs.upToDateWhen { false } will cause Gradle to skip this task as UP-TO-DATE if the gradle/libs.versions.toml file already exists. Since this is a utility task meant to fetch the latest catalog from a remote source, it should always run when invoked. Removing the output declaration will ensure it always executes.
Additionally, using new URI(...).toURL().getText() without connection and read timeouts can cause the Gradle build to hang indefinitely if the network is unstable or the remote server is unresponsive. It is safer to configure 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.inputStream.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.