build: centralize CMake flags, untrack device-staging artifacts - #16
Merged
Conversation
Two cleanups of the same kind: state duplicated across files, drifting. Centralize the CMake configure. The test-suite gate was renamed to APPSTREAM_BUILD_TESTS in 0.2.2, but copies of the old -DBUILD_TESTING survived in scripts/test.sh and in two CI jobs. CMake ignores an unrecognized -D and only warns, so the flag silently did nothing: 0.4.0 fixed the test script, but hook/build.dart still passed it and printed "Manually-specified variables were not used by the project" on every Flutter build. scripts/configure.sh is now the single definition, called by scripts/test.sh and by both CI jobs. It validates its inputs rather than forwarding them, because an unrecognized sanitizer name would otherwise reach CMake as a literal and configure a build that quietly does not do what was asked. hook/build.dart still spells its own flags out — build hooks run in a hermetic environment with no shell contract — but now uses the correct name, and points at the canonical list. Untrack example/flathub_catalog/.desktop-homescreen/. It is Flutter custom-device staging, recreated by the device's install step, and held 51 MB of tracked binaries: a 42 MB libflutter_engine.so and icudtl.dat. Its data/flutter_assets entry was a symlink into the gitignored build/ directory, so it was dangling for anyone cloning the repository. The files stay on disk; only the tracking is removed. Verified: shellcheck clean; configure.sh rejects bad --tests, --coverage, --sanitizer, and unknown options with exit 2; both CI configure paths produce what they should (compile_commands.json with no test targets, and a test build with the sanitizer applied); the hook's CMake warning is gone; 149/149 C++ and 45/45 Dart tests pass through the new path; clang-tidy clean over four runs; clang-format last; dart analyze --fatal-infos clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two cleanups of the same kind: state duplicated across files, drifting apart.
1. One definition of the CMake configure
The test-suite gate was renamed to
APPSTREAM_BUILD_TESTSin 0.2.2, but copies of the old-DBUILD_TESTINGsurvived in three places. CMake ignores an unrecognized-Dand merely warns, so the flag silently did nothing:scripts/test.sh-DBUILD_TESTING=ONctestran stale binaries — fixed in 0.4.0ci.ymlclang-tidy-DBUILD_TESTING=OFFci.ymlcxx-tests-DBUILD_TESTING=ON+ correct flaghook/build.dart-DBUILD_TESTING=OFFManually-specified variables were not used by the projecton every Flutter buildscripts/configure.shis now the single definition, called byscripts/test.shand both CI jobs:scripts/configure.sh --tests OFF --compile-commands # clang-tidy job scripts/configure.sh --build-type Debug --tests ON --sanitizer asanIt validates rather than forwards. An unrecognized sanitizer name would otherwise reach CMake as a literal and configure a build that quietly isn't what was asked for — the same failure mode as the bug this fixes:
hook/build.dartstill spells its flags out, since build hooks run in a hermetic environment with no shell contract, but it uses the correct name now and points at the canonical list. That removes the lastBUILD_TESTINGand with it the per-build CMake warning.2. Untrack
.desktop-homescreen/Flutter custom-device staging, recreated by the device's
installstep, was tracked in git:lib/libflutter_engine.so— 42 MBdata/icudtl.dat— ~9 MBdata/flutter_assets— a symlink into the gitignoredbuild/directory, so it was dangling for anyone who cloned51 MB of generated binaries. Now gitignored and untracked; the files stay on disk, so the device keeps working locally.
Verification
configure.shrejects bad--tests,--coverage,--sanitizer, and unknown options with exit 2;--helpexits 0compile_commands.jsonwith zero test targets, and a test build with the sanitizer appliedtest.shrun, was 1 per hook build)dart analyze --fatal-infosclean, dry-run 0 warningsNo version bump — this is build tooling only and changes nothing in the published archive.