Repository navigation
Hooks: Allow per-OS defines - #413
Merged
Merged
Conversation
Like source and name, the defines user-define can now be a map from operating system names (or default) to the defines to use for that target.
The iOS expectation wasn't formatted, which fails the format check in CI. Also test that a defines map without OS keys keeps its existing meaning.
simolus3
approved these changes
Sep 29, 2026
Instead of a separate example for per-OS defines, state that the map syntax already described for source is available for defines as well.
Contributor
Author
|
Thanks! Done in a25e5ba: I removed the separate example and paragraph, and the existing paragraph now says the map syntax is available for |
simolus3
approved these changes
Sep 29, 2026
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.
#406 made
sourceandnameaccept a map with per-OS entries and adefault. This PR extendsthe same syntax to
defines, so onesource: sourcebuild can use different compile-time optionsper target. For example,
SQLITE_WIN32_MALLOConly on Windows, or a smaller set of options onmobile:
Behavior:
definestoday: a list, or a map withdefault_optionsand
defines.OS.name, as forsource) ordefault. The existing keys (default_options,defines) are neither, so existingconfigurations keep their meaning (there's a test for that).
ArgumentErrorinstead of being silentlymisread.
default, the default options are used, the sameas when
definesis missing.I only did this for
defines.path,additional_flagsand the othersource: sourceoptions(including
additional_sourcesfrom #395) could get the same treatment, but I wanted to check withyou before widening the change.
Tests
test/hook/description_test.dartcover the entry for the target OS, thedefaultfallback, a missing entry, a plain options map, and mixed keys.
source: sourcewith SQLite 3.53.4 anddefines: {windows: {defines: [SQLITE_ENABLE_RBU]}, default: [...]}builds a library whereusedCompileOption('ENABLE_RBU')andusedCompileOption('ENABLE_FTS5')are both true, so theWindows entry is applied on top of the default options.
dart analyze --fatal-infosanddart format --set-exit-if-changedinsqlite3: clean.dart testinsqlite3(VM, Windows): 196 passed, 5 skipped.🤖 Generated with Claude Code