fix(ci): Don't try to use the branch name if it is null. #1162

Merged
Rover656 merged 1 commit from chore/fix-ci into dev/1.21.1 2025-10-07 11:15:47 +00:00
Rover656 commented 2025-10-06 20:43:15 +00:00 (Migrated from github.com)

Description

Trying to fix failing PR builds as a result of the new gradle setup.

Summary by CodeRabbit

  • New Features
    • Improved build version labelling: branch builds now include branch name and commit info; non-branch builds use a -dev suffix with commit info for clearer identification.
  • Chores
    • Exposed version details to the build system to support enhanced version strings.
    • Added a note to address future support for environments without Git.
# Description Trying to fix failing PR builds as a result of the new gradle setup. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Improved build version labelling: branch builds now include branch name and commit info; non-branch builds use a -dev suffix with commit info for clearer identification. - Chores - Exposed version details to the build system to support enhanced version strings. - Added a note to address future support for environments without Git. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2025-10-06 20:43:27 +00:00 (Migrated from github.com)

Walkthrough

Updates Gradle build conventions to compute project version strings using Git metadata. Adds branch-aware version formatting, exposes version details via Gradle extra properties, initialises from versionDetails(), and notes a TODO for non-git environments.

Changes

Cohort / File(s) Summary
Build versioning logic
buildSrc/src/main/kotlin/mod-common-conventions.gradle.kts
Implement branch-aware Git version string (tagVersion, commitDistance, sanitised branchName, gitHash). Fallback to -dev with gitHash when no branch. Expose versionDetails via Gradle extra and initialise details = versionDetails(). Add TODO for non-Git context.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant Gradle as Gradle Build
  participant Git as Git Metadata
  participant VD as VersionDetails
  participant Project as Gradle Project.extra

  Dev->>Gradle: Run build
  Gradle->>Git: Query tagVersion, commitDistance, branchName, gitHash
  Git-->>Gradle: Metadata
  Gradle->>VD: versionDetails()
  VD-->>Gradle: details
  Gradle->>Gradle: Compute version\nbranch? tagVersion-commitDistance-branchName+gitHash : tagVersion-dev+gitHash
  Gradle->>Project: Expose versionDetails via extra
  Gradle-->>Dev: Build uses computed version
  note over Gradle: TODO: Support non-Git environments

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I thump my paws in versioned glee,
Tags and hashes brew for me—
Branch names trimmed, distances told,
A carrot-orange build of gold.
If Git goes missing (oh what dread!),
I’ll note a TODO, hop ahead.
Release burrow: neatly fed.

Pre-merge checks and finishing touches

Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only provides a brief statement under the Description heading and omits several required sections from the repository template, including TODO, Breaking Changes, and Checklist, so it does not fully adhere to the prescribed structure. Please update the PR description to include all sections from the template: either complete or remove the TODO section, add a Breaking Changes section if applicable, and fill out the Checklist to confirm code style, documentation updates, and readiness for review.
Passed checks (2 passed)
Check name Status Explanation
Title Check Passed The title clearly summarises the primary change of the pull request by stating that the CI fix prevents using a null branch name, which directly reflects the modifications made to the Gradle version handling logic.
Docstring Coverage Passed No functions found in the changes. Docstring coverage check skipped.
Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/fix-ci

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60b256e116 and 150ec6000f.

📒 Files selected for processing (1)
  • buildSrc/src/main/kotlin/mod-common-conventions.gradle.kts (2 hunks)
Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (java-kotlin)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough Updates Gradle build conventions to compute project version strings using Git metadata. Adds branch-aware version formatting, exposes version details via Gradle extra properties, initialises from `versionDetails()`, and notes a TODO for non-git environments. ## Changes | Cohort / File(s) | Summary | | --- | --- | | **Build versioning logic**<br>`buildSrc/src/main/kotlin/mod-common-conventions.gradle.kts` | Implement branch-aware Git version string (tagVersion, commitDistance, sanitised branchName, gitHash). Fallback to -dev with gitHash when no branch. Expose `versionDetails` via Gradle extra and initialise `details = versionDetails()`. Add TODO for non-Git context. | ## Sequence Diagram(s) ```mermaid sequenceDiagram autonumber actor Dev as Developer participant Gradle as Gradle Build participant Git as Git Metadata participant VD as VersionDetails participant Project as Gradle Project.extra Dev->>Gradle: Run build Gradle->>Git: Query tagVersion, commitDistance, branchName, gitHash Git-->>Gradle: Metadata Gradle->>VD: versionDetails() VD-->>Gradle: details Gradle->>Gradle: Compute version\nbranch? tagVersion-commitDistance-branchName+gitHash : tagVersion-dev+gitHash Gradle->>Project: Expose versionDetails via extra Gradle-->>Dev: Build uses computed version note over Gradle: TODO: Support non-Git environments ``` ## Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~20 minutes ## Poem > I thump my paws in versioned glee, > Tags and hashes brew for me— > Branch names trimmed, distances told, > A carrot-orange build of gold. > If Git goes missing (oh what dread!), > I’ll note a TODO, hop ahead. > Release burrow: neatly fed. <!-- walkthrough_end --> <!-- pre_merge_checks_walkthrough_start --> ## Pre-merge checks and finishing touches <details> <summary>❌ Failed checks (1 warning)</summary> | Check name | Status | Explanation | Resolution | | :---------------: | :--------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description Check | ⚠️ Warning | The pull request description only provides a brief statement under the Description heading and omits several required sections from the repository template, including TODO, Breaking Changes, and Checklist, so it does not fully adhere to the prescribed structure. | Please update the PR description to include all sections from the template: either complete or remove the TODO section, add a Breaking Changes section if applicable, and fill out the Checklist to confirm code style, documentation updates, and readiness for review. | </details> <details> <summary>✅ Passed checks (2 passed)</summary> | Check name | Status | Explanation | | :----------------: | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title Check | ✅ Passed | The title clearly summarises the primary change of the pull request by stating that the CI fix prevents using a null branch name, which directly reflects the modifications made to the Gradle version handling logic. | | Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. | </details> <!-- pre_merge_checks_walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate docstrings <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "07f1e7d6-8a8e-4e23-9900-8731c2c87f58", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Post copyable unit tests in a comment - [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit unit tests in branch `chore/fix-ci` </details> </details> <!-- finishing_touch_checkbox_end --> --- <details> <summary>📜 Recent review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 60b256e11600f8dc6e054add4cbb21647d028661 and 150ec6000f534fa1cc88e29329fbc73b9ee3ee8a. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `buildSrc/src/main/kotlin/mod-common-conventions.gradle.kts` (2 hunks) </details> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)</summary> * GitHub Check: Analyze (java-kotlin) </details> </details> <!-- tips_start --> --- Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrI5Ho6gDYkuAM3gAHgAUDPAAlFwAIvgYAOS4kLguifiQ2IgkibCZAlQYDLCQGGhsKL4oCagY2J6eGpCQBgByjgKUXACMHQBsAEwNBgCqNgAyXLC4uNyIHAD0s0TqsNgCGkzMs9AkJWAAohhKFACSAPKz+4ens9w1nrNdfQODGRRcNvhSFN0ArN0DAMr4bAUBg5PIFLgFfAUEizfwBMChSCAJMIYM5SAlcpgIZAlBJ7hpeh0NB0AbhqOku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TsSoxLgJAlhVvWIlHMmy+AwmQlIBsS7BqIesty7q2lV3bHXd6TdGzkAUakqpdA3BEqQsOkFEG/hdljQufY3k+6EjOidv4CgiMm6nW8BZWgCjHDsChWkbgCqaCIB3fQdkC7pBw0prgpMH69XkVVZkzVFBtVEF1Rag1GAjUmtEVG4zVqbWlXtaZTJEHa2krdR6z95FvW+qkdEBgtkzQbo+MoUg1mOnhp6TEgJ5qOmDMwFCslqRfDmL7TEPT5j6Ap1xpS6Q9QQthfskwdtpBGBCfsJNDjdAjMWtM+q8zlmYv4pc56NzQmgvkXk6F6xRAeluskQAXWybk3Atga2ZpGeq2g/8Oi9G6L4WUmogEMBAX/NA6oSD/wQQIdUHQSAgN+G/KUcDgHwIED8EBYCpRoFAbQdU3R/5QN6LQZUvRNQgPVCA2gDBrM5IylNmwzS1VSKlADjon2wFoBAfthq0CQECF8JqJbaPaDfG+NAjoID4co+6JqXw/9egCFoL0Eg3x/7I/VNA3o/8AcMAENKZHJBXvqloNAl1rqx63JIKQygFDvW0MIQeIAA== --> <!-- internal state end -->
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Team-EnderIO/EnderIO#1162
No description provided.