Skip to content

Wire central catalog refresh - #1

Closed
riccardobl wants to merge 1 commit into
masterfrom
codex/catalog-refresh-202605291929
Closed

riccardobl wants to merge 1 commit into
masterfrom
codex/catalog-refresh-202605291929

Conversation

@riccardobl

Copy link
Copy Markdown
Member

Summary

  • Replace the local Gradle version catalog with the centralized NostrGameEngine catalog.
  • Add a refreshCatalog Gradle task that downloads NostrGameEngine/libs.catalog.
  • Add a manual refresh-catalog.yml workflow that opens a PR only when the refreshed catalog changes.
  • Add or update the existing snapshot publishing workflow schedule where this repository publishes snapshots.

Verification

  • Parsed all updated TOML catalogs with tomllib.
  • Parsed updated workflow YAML with Ruby YAML.load_file.
  • Ran ./gradlew --no-daemon -q refreshCatalog successfully in bech32 as the representative Groovy Gradle task.

Note: local Kotlin-task execution in cap-cache-generator was blocked before task execution because the machine ran out of disk space while the Gradle wrapper tried to install Gradle 8.4.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new refreshCatalog Gradle task to download and update the central NostrGameEngine version catalog, and adds the initial gradle/libs.versions.toml file. Feedback on the new task suggests ensuring it always runs when explicitly executed by disabling up-to-date checks, and improving network resilience and encoding consistency by adding connection/read timeouts and explicitly writing the output file in UTF-8.

Comment thread build.gradle
.orElse('https://raw.githubusercontent.com/NostrGameEngine/libs.catalog/main/libs.versions.toml')
def outputFile = layout.projectDirectory.file('gradle/libs.versions.toml')

outputs.file(outputFile)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Because gradle/libs.versions.toml is committed to the repository, it will always exist. Since this task defines an output file but no inputs, Gradle's up-to-date check will consider the task UP-TO-DATE and skip execution on subsequent runs, preventing the catalog from actually being refreshed.

To ensure the catalog is always refreshed when this task is explicitly executed, configure the task to never be considered up-to-date by adding outputs.upToDateWhen { false }.

    outputs.file(outputFile)
    outputs.upToDateWhen { false }

Comment thread build.gradle
doLast {
def target = outputFile.asFile
target.parentFile.mkdirs()
target.text = new URI(catalogUrl.get()).toURL().getText('UTF-8')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are two potential issues with the current file download and write implementation:

  1. Missing Timeouts: URL.getText(String) does not have a default timeout, which can cause the Gradle build to hang indefinitely if the network connection is flaky or the remote server is unresponsive.
  2. Platform-Default Encoding: Assigning a string directly to target.text uses the platform's default encoding to write the file. This can lead to encoding discrepancies or corruption of non-ASCII characters when run on different operating systems (e.g., Windows vs. Linux).

Using URL.getText(Map, String) with explicit connectTimeout and readTimeout parameters, and writing the file using target.setText(text, charset) ensures both network resilience and platform-independent UTF-8 encoding.

        target.setText(new URI(catalogUrl.get()).toURL().getText(connectTimeout: 10000, readTimeout: 10000, 'UTF-8'), 'UTF-8')

@riccardobl riccardobl closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant