native icon indicating copy to clipboard operation
native copied to clipboard

Using a linker that doesn't exist should be an error not silently accepted

Open mkustermann opened this issue 1 year ago • 2 comments
trafficstars

If a build/hook.dart uses *Asset(, linkInPackage: "package:foo") the assets will not be there at runtime. => The package:foo should be foo instead => The error is silently ignored => The build should fail if a linker is used and it doesn't exist.

Currently running the program just results in no assets found. Running the build with --verbose prints an innocent

Skipping link hooks from ... due to no assets provided to link for these link hooks.

mkustermann avatar Aug 09 '24 11:08 mkustermann

This requires validation in the native assets builder. The BuildConfig doesn't have the info about which linkers are available, so checking inside build( ... ) doesn't work. (Unless we add the list of available linkers to the build config.)

(The validations listed in https://github.com/dart-lang/native/issues/1409 can be run in the hook implementation and throw there already. Though we should also validate these in the builder.)

Thanks for the reports @mkustermann! 🙏

dcharkes avatar Aug 09 '24 15:08 dcharkes

(The validations listed in https://github.com/dart-lang/native/issues/1409 can be run in the hook implementation and throw there already. Though we should also validate these in the builder.)

The protocol is json in & out. Users can write their own implementation of the hook/build.dart & hook/link.dart, so validation of correct output has to happen on the result of invoking hook/build.dart / hook/link.dart. (Extra checks in the convenience packages we provide to write hooks is nice to have)

mkustermann avatar Aug 09 '24 20:08 mkustermann