Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 31, 2025

Adds support for updating CMake dependencies that use FetchContent_Declare syntax to the dependency updater system with enhanced robustness and performance optimizations.

The updater can now automatically parse and update CMake files containing:

FetchContent_Declare(
    sentry-native
    GIT_REPOSITORY https://github.com/getsentry/sentry-native
    GIT_TAG a64d5bd8ee130f2cda196b6fa7d9b65bfa6d32e2 # 0.9.1
    GIT_SHALLOW FALSE
    GIT_SUBMODULES "external/breakpad"
)

Features

  • Automatic detection: Recognizes .cmake files, CMakeLists.txt, or any file containing FetchContent_Declare
  • Repository extraction: Parses GIT_REPOSITORY to determine the dependency source
  • Version handling: Extracts versions from GIT_TAG (supports both semantic versions and commit hashes)
  • Format preservation: Maintains indentation, whitespace, and comments when updating
  • Quoted value support: Handles both quoted ("v1.0.0") and unquoted (v1.0.0) GIT_TAG values while preserving original format
  • Performance optimization: Efficient file detection that avoids unnecessary file reads for script files
  • Error handling: Provides clear error messages for malformed or incomplete declarations

Usage

Add to your workflow:

cmake-dep:
  uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
  with:
    path: cmake/dependencies.cmake
    name: CMake Dependency
  secrets:
    api-token: ${{ secrets.CI_DEPLOY_KEY }}

The implementation is fully backward compatible with existing dependency types (submodules, properties files, scripts) and includes comprehensive test coverage including edge cases for quoted values.

Fixes #91.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link

github-actions bot commented Jul 31, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- support cmake FetchContent with enhanced robustness ([#92](https://github.com/getsentry/github-workflows/pull/92))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 2a46b78

@Copilot Copilot AI changed the title [WIP] updater: support cmake FetchContent updater: support cmake FetchContent Jul 31, 2025
@Copilot Copilot AI requested a review from vaind July 31, 2025 14:46
Copilot finished work on behalf of vaind July 31, 2025 14:46
@vaind
Copy link
Collaborator

vaind commented Jul 31, 2025

@sentry review

@vaind
Copy link
Collaborator

vaind commented Jul 31, 2025

@copilot address review comments from @seer-by-sentry

@Copilot Copilot AI changed the title updater: support cmake FetchContent updater: support cmake FetchContent with enhanced robustness Jul 31, 2025
Copilot finished work on behalf of vaind July 31, 2025 16:27
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.

updater: support cmake FetchContent
2 participants