• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dart-lang / native / 14077166409

26 Mar 2025 06:46AM UTC coverage: 86.016% (-0.08%) from 86.091%
14077166409

push

github

web-flow
[native_assets_cli] Validate conditionally required fields (#2126)

Closes: https://github.com/dart-lang/native/issues/1826

This PR adds the final step to the generated syntax validation: conditionally required fields:

1. If target OS is `x`, then require `x` config in code config.
2. If target OS is `windows`, then require `windows` in the c compiler config (more info https://github.com/dart-lang/native/pull/1913).
3. If link mode is dynamic library bundled or static library, then require a file in a code asset.

We could consider trying to nest the fields under the condition, but that has other downsides:

RE 1: Then the OS is no longer an enum usable in the code-asset as OS field. (We could consider this if we remove the OS/arch from code asset outputs. We should be able to do this due to the code config always having a single OS and architecture anyway. https://github.com/dart-lang/native/issues/2127)
RE 2: That would mean the compiler config would be split over two places. `input.config.code.cCompiler` and `inputconfig.code.windows.cCompiler`. Maybe that's better? Maybe not?
RE 3: Treating a group of files in assets would then become `input.assets.code.switch( ... )` instead of simply `input.assets.code.map((a) => a.file)`. Maybe that's okay because we don't often use files in such way anyway?

WDYT @mosuem @HosseinYousefi?

(I'd probably do any of those refactorings in follow up PRs.)

27 of 37 new or added lines in 3 files covered. (72.97%)

7 existing lines in 1 file now uncovered.

13705 of 15933 relevant lines covered (86.02%)

35.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.44
/pkgs/native_assets_cli/lib/src/code_assets/validation.dart


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc