Skip to content

build: centralize CMake flags, untrack device-staging artifacts - #16

Merged
jwinarske merged 1 commit into
mainfrom
jw/centralize-cmake
Aug 14, 2026
Merged

build: centralize CMake flags, untrack device-staging artifacts#16
jwinarske merged 1 commit into
mainfrom
jw/centralize-cmake

Conversation

@jwinarske

Copy link
Copy Markdown
Contributor

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_TESTS in 0.2.2, but copies of the old -DBUILD_TESTING survived in three places. CMake ignores an unrecognized -D and merely warns, so the flag silently did nothing:

Call site Was Effect
scripts/test.sh -DBUILD_TESTING=ON C++ suite never configured; ctest ran stale binaries — fixed in 0.4.0
ci.yml clang-tidy -DBUILD_TESTING=OFF no-op (harmless, but noise)
ci.yml cxx-tests -DBUILD_TESTING=ON + correct flag no-op alongside the real one
hook/build.dart -DBUILD_TESTING=OFF 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 both CI jobs:

scripts/configure.sh --tests OFF --compile-commands          # clang-tidy job
scripts/configure.sh --build-type Debug --tests ON --sanitizer asan

It 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:

$ scripts/configure.sh --sanitizer bogus
error: --sanitizer must be none|asan|msan|ubsan, got 'bogus'   # exit 2

hook/build.dart still 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 last BUILD_TESTING and with it the per-build CMake warning.

2. Untrack .desktop-homescreen/

Flutter custom-device staging, recreated by the device's install step, was tracked in git:

  • lib/libflutter_engine.so42 MB
  • data/icudtl.dat — ~9 MB
  • data/flutter_assets — a symlink into the gitignored build/ directory, so it was dangling for anyone who cloned

51 MB of generated binaries. Now gitignored and untracked; the files stay on disk, so the device keeps working locally.

Verification

  • shellcheck clean on all three scripts
  • configure.sh rejects bad --tests, --coverage, --sanitizer, and unknown options with exit 2; --help exits 0
  • Both CI paths produce what they should: compile_commands.json with zero test targets, and a test build with the sanitizer applied
  • The hook's CMake warning is gone (0 occurrences in a full test.sh run, was 1 per hook build)
  • 149/149 C++ and 45/45 Dart through the new path
  • clang-tidy clean across four runs, clang-format last, dart analyze --fatal-infos clean, dry-run 0 warnings

No version bump — this is build tooling only and changes nothing in the published archive.

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.
@jwinarske
jwinarske merged commit 9f26327 into main Aug 14, 2026
12 checks passed
@jwinarske
jwinarske deleted the jw/centralize-cmake branch August 14, 2026 18:47
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.

1 participant