dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
153 stars 43 forks source link

Do not use pubspec.yaml for config #527

Open dcharkes opened 4 years ago

dcharkes commented 4 years ago

The reason pubspec.yaml is allowed to have contents Dart does not understand is because of Flutter. It is not supposed to be used for arbitrary things.

cc @mkustermann @jonasfj

jonasfj commented 4 years ago

The reason pubspec.yaml is allowed to have contents Dart does not understand is because of Flutter.

The reason is forwards and backwards compatibility.

Using custom properties in pubspec.yaml for configuration options is not inherently wrong. But if the configuration doesn't have anything to do with pub, and the configuration file might be useful in places where there is no pubspec.yaml, then it might be smarter to not have in pubspec.yaml.

There is no hard rules here, if you prefer to have the config in pubspec.yaml, then this is a valid opinion. If you wrote a code-generator that collected LICENSE files from all dependent packages, then this might be more attractive because it's related to the pubspec and pub packages.

dcharkes commented 4 years ago

Currently we support passing a path to a separate config file.

If we would like to make a default path (so that one does not have to pass it as argument to pub run ffigen), then there are questions to be answered about what to do when there are multiple things to generate. Should the format support multiple entries? This is probably something to solve with build_runner dart-lang/native#511.