Skip to content

Conversation

@kota-yata
Copy link
Contributor

@kota-yata kota-yata commented Dec 11, 2025

At the very first build, neither PLUGIN_BUILD_NUMBER nor _BUILD_NUMBER_CACHE exist, resulting following error on build:

CMake Error at cmake/macos/helpers.cmake:22 (set_target_properties):
  set_target_properties called with incorrect number of arguments.
Call Stack (most recent call first):
  CMakeLists.txt:64 (set_target_properties_plugin)

This PR sets 1 to the build number in that situation.

Environment: MacOS 15.6.1

@gemini-code-assist
Copy link

Summary of Changes

Hello @kota-yata, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical local build failure encountered when a project is built for the very first time and no build number cache exists. Previously, this scenario would lead to a CMake error due to an undefined build number. The change ensures that in the absence of an existing build number cache, the PLUGIN_BUILD_NUMBER is initialized to 1, thereby preventing the build error and allowing the compilation process to proceed smoothly from the start.

Highlights

  • Local Build Fix: Resolves a build error that occurs during the initial local build when the _BUILD_NUMBER_CACHE file is not present, by explicitly setting the PLUGIN_BUILD_NUMBER to 1.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 correctly fixes a build error that occurs on the first local build when the build number cache file doesn't exist. The change ensures a default build number of '1' is set in this scenario, preventing the set_target_properties error. I've included one suggestion to refactor the logic slightly to improve maintainability by removing some code duplication that was introduced.

Comment on lines +27 to +29
else()
# Local builds without an existing cache default to 1
set(PLUGIN_BUILD_NUMBER "1")

Choose a reason for hiding this comment

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

medium

While this change correctly fixes the bug for local builds, it introduces some code duplication. The line set(PLUGIN_BUILD_NUMBER "1") now appears in two places (here and on line 25).

To improve maintainability and reduce redundancy, you could refactor the logic to set the default value first and then override it if specific CI environment variables are present.

Consider refactoring the if("$ENV{CI}") block (lines 19-30) to something like this:

    # Default to 1 for local builds or CI without a specific run ID
    set(PLUGIN_BUILD_NUMBER "1")
    if("$ENV{CI}")
      if("$ENV{GITHUB_RUN_ID}")
        set(PLUGIN_BUILD_NUMBER "$ENV{GITHUB_RUN_ID}")
      elseif("$ENV{GITLAB_RUN_ID}")
        set(PLUGIN_BUILD_NUMBER "$ENV{GITLAB_RUN_ID}")
      endif()
    endif()

This makes the logic clearer by establishing a default and then handling the exceptional cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change wouldn't make the code more readable nor clearer, so I'm going to keep the current one

@kixelated
Copy link
Collaborator

I'm not sure why this is needed, but yolo seems harmless.

@kixelated kixelated merged commit 6352ab7 into moq-dev:master Dec 13, 2025
1 of 6 checks passed
@kota-yata kota-yata deleted the set-build-number branch December 13, 2025 04:29
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.

2 participants