Skip to content

cmake: support checksum-pinned MDK SDK dependencies - #381

Merged
wang-bin merged 2 commits into
wang-bin:masterfrom
natsu0529:fix/checksum-pinned-mdk-deps
Jul 13, 2026
Merged

wang-bin merged 2 commits into
wang-bin:masterfrom
natsu0529:fix/checksum-pinned-mdk-deps

Conversation

@natsu0529

@natsu0529 natsu0529 commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

FVP_DEPS_URL lets users select an immutable MDK SDK release or mirror, but the downloaded archive cannot currently be verified. The extracted mdk-sdk directory is also reused based only on the presence of FindMDK.cmake, so changing the selected artifact can leave stale native binaries in place.

This prevents reproducible MDK SDK pinning and lets the same fvp source resolve to different native binaries based on download time and cache state. Related to #368 and #378.

Changes

  • add optional FVP_DEPS_SHA256 CMake and environment settings
  • resolve non-empty CMake settings before environment values and existing defaults
  • download through a temporary file, check transfer status and SHA-256, then replace the cached archive
  • record the archive SHA-256 with the extracted SDK and invalidate it when the pin changes
  • serialize concurrent ABI configuration and preserve the last valid SDK if extraction or installation fails
  • keep FVP_DEPS_LATEST as the existing opt-in rolling update path; an explicit SHA-256 pin takes precedence
  • document checksum-pinned builds and add network-free CMake tests on Ubuntu and Windows
  • select the Release configuration when running CTest so Windows multi-config generators execute the tests
  • raise the example Android app's Gradle heap ceiling from 1.5 GB to 4 GB; current Flutter engine artifacts otherwise exhaust the old ceiling during Jetify, including on upstream master

Compatibility

The default MDK SDK URL and version selection are unchanged. When FVP_DEPS_SHA256 is unset, existing FVP_DEPS_URL and normal cache behavior remain available. The changes apply only to CMake-backed platforms; CocoaPods and SwiftPM dependency resolution are unchanged. The Gradle memory setting affects only the example Android app.

Verification

  • CMake 4.3.4: 3/3 CTest cases pass
  • CMake 3.15.7: 3/3 CTest cases pass
  • correct and incorrect pins through fvp_setup_deps()
  • pin changes, offline reuse, rolling latest updates, stale/missing stamps, and interrupted cache swap recovery
  • GitHub Actions: CMake tests pass on Ubuntu and Windows
  • GitHub Actions: Android APK builds pass on Flutter 3.22.x and current stable
  • git diff --check

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

Copy link
Copy Markdown
Contributor

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 support for verifying the MDK SDK download using a SHA-256 checksum, allowing the use of immutable SDK releases or mirrors. It refactors the dependency setup logic in cmake/deps.cmake into robust helper functions that handle downloading, verification, caching, locking, and backup recovery. Additionally, a comprehensive suite of CMake integration tests has been added to validate these behaviors under various scenarios. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@natsu0529
natsu0529 marked this pull request as ready for review July 12, 2026 07:43
@natsu0529
natsu0529 force-pushed the fix/checksum-pinned-mdk-deps branch from b2cd9a5 to e8b5fcc Compare July 12, 2026 07:52

Copilot AI 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.

Pull request overview

Adds checksum-pinned MDK SDK dependency support to the CMake-based dependency setup so builds can be reproducible and cached SDKs are invalidated when the selected archive changes.

Changes:

  • Introduces FVP_DEPS_SHA256 (CMake cache + env var) and resolves options with CMake values taking precedence over environment.
  • Downloads MDK SDK via a temporary .part file, verifies SHA-256 (when pinned), and stamps extracted SDKs to prevent stale reuse.
  • Adds CMake integration tests (including offline and bad-SHA cases) and runs them in GitHub Actions on Ubuntu + Windows; increases Gradle heap for the example Android app.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents checksum-pinned FVP_DEPS_URL + FVP_DEPS_SHA256 usage and cache behavior.
example/android/gradle.properties Raises Gradle JVM heap limit to reduce build OOM risk with current artifacts.
cmake/deps.cmake Implements SHA-256 pinning, safer download/extract flow, cache stamping, and lock-based serialization.
cmake/tests/CMakeLists.txt Adds a CMake/CTest suite that builds fixture archives and defines test cases.
cmake/tests/deps_test.cmake Validates option resolution precedence and cache behaviors (pinned vs unpinned, recovery, offline reuse).
cmake/tests/invoke_fetch.cmake Helper to invoke internal fetch/extract function from tests.
cmake/tests/macro_test.cmake Integration test exercising fvp_setup_deps() in script mode.
cmake/tests/macro_bad_sha_test.cmake Ensures an incorrect SHA-256 fails and (intended to) verifies cleanup of partial downloads.
.gitignore Ignores .part temporary downloads and .fvp-mdk-* staging directories.
.github/workflows/build.yml Adds a CI job to run the new CMake tests on Ubuntu and Windows (Release config for multi-config).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmake/tests/macro_bad_sha_test.cmake Resolved
@wang-bin
wang-bin merged commit 0f2faba into wang-bin:master Jul 13, 2026
16 checks passed
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