Skip to content

Conversation

@davidmfinol
Copy link
Member

@davidmfinol davidmfinol commented Oct 2, 2025

Update to support game-ci/unity-builder#738

Changes

  • Change customBuildprofile to activeBuildProfile and improve validation

Checklist

  • Read the contribution guide and accept the
    code of conduct
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

Summary by CodeRabbit

  • New Features
    • None.
  • Bug Fixes
    • Stricter validation for build targets: invalid values now fail with a clear message and exit code 121.
    • Unified handling when neither a build target nor an active build profile is provided, with a clear error and exit code 120.
  • Chores
    • Switched profile loading to use the active build profile key.
    • Standardized error messages and control flow during build option validation.

Updated build profile loading and validation logic.
@coderabbitai
Copy link

coderabbitai bot commented Oct 2, 2025

Walkthrough

Updates example/BuildScript.cs to switch profile key usage to activeBuildProfile, revise buildTarget parsing/validation with enum checks, and consolidate error handling and exit codes when either buildTarget or activeBuildProfile is required. No public API signatures changed.

Changes

Cohort / File(s) Summary
Build validation and profile selection
example/BuildScript.cs
- BuildWithProfile now reads activeBuildProfile instead of customBuildProfile from AssetDatabase.
- GetValidatedOptions: uses out var for buildTarget, validates against defined BuildTarget values, exits 121 if invalid.
- When neither buildTarget nor activeBuildProfile is supplied, logs combined error and exits 120.
- Updated error messages and control flow accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant BuildScript
  participant AssetDatabase

  rect rgba(230,245,255,0.6)
  Note over BuildScript: GetValidatedOptions
  User->>BuildScript: Invoke with args
  BuildScript->>BuildScript: Parse -buildTarget (out var)
  alt buildTarget provided
    BuildScript->>BuildScript: Validate enum value
    alt Not defined
      BuildScript-->>User: Log "<value> is not a defined BuildTarget"
      BuildScript-->>User: Exit code 121
    else Defined
      BuildScript-->>User: Proceed
    end
  else buildTarget not provided
    BuildScript->>AssetDatabase: Check activeBuildProfile
    alt Missing activeBuildProfile
      BuildScript-->>User: Log "Missing argument -buildTarget or -activeBuildProfile"
      BuildScript-->>User: Exit code 120
    else Present
      BuildScript-->>User: Proceed with profile
    end
  end
  end

  rect rgba(235,255,235,0.6)
  Note over BuildScript,AssetDatabase: BuildWithProfile
  BuildScript->>AssetDatabase: Load activeBuildProfile
  AssetDatabase-->>BuildScript: Profile data
  BuildScript-->>User: Build using activeBuildProfile
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

In burrows of code I twitch my nose,
activeBuildProfile is the path I chose.
If targets stray from enum trails,
121 taps out when validation fails.
But if none are set, I won’t contrive—
120 thumps, then hop to thrive. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title accurately summarizes the primary change of renaming customBuildprofile to activeBuildProfile and also mentions the improved validation, reflecting the main objectives of the changeset.
Description Check ✅ Passed The pull request description follows the repository template by including a clear Changes section listing the rename and validation improvements and a completed Checklist with all required items ticked.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch davidmfinol-patch-6

📜 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 78682fd and 9f8953a.

📒 Files selected for processing (1)
  • example/BuildScript.cs (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: build_and_preview
🔇 Additional comments (2)
example/BuildScript.cs (2)

102-102: LGTM! Key rename correctly applied.

The change from customBuildProfile to activeBuildProfile correctly implements the configuration key rename mentioned in the PR objectives.


137-149: LGTM! Validation improvements correctly implemented.

The changes properly enhance validation:

  • Added enum validation for buildTarget to fail fast with a clear error message (exit code 121) before the Enum.Parse at line 37 would throw
  • Correctly enforces that either buildTarget or activeBuildProfile must be provided (exit code 120)
  • The ?? string.Empty fallback in the IsDefined check is defensive and handles edge cases safely

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.

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

Cat Gif

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

Visit the preview URL for this PR (updated for commit 9f8953a):

https://game-ci-5559f--pr520-davidmfinol-patch-6-2enuk897.web.app

(expires Thu, 09 Oct 2025 05:05:51 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1f0574f15f83e11bfc148eae8646486a6d0e078b

@ryo0ka
Copy link

ryo0ka commented Oct 2, 2025

@davidmfinol thank you. I didn't follow through to add docs

@davidmfinol davidmfinol merged commit 53b6588 into main Oct 2, 2025
9 checks passed
@davidmfinol davidmfinol deleted the davidmfinol-patch-6 branch October 2, 2025 08:35
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.

4 participants