Open matanlurey opened 5 years ago
So the reason I think this would happen is if you have duplicate sources across multiple targets.
I believe that you could resolve this issue by editing your default target in your build.yaml
from the swlegion
such that it excluded all sources from other targets.
The experience here is admittedly extremely poor though, i would not recommend using multiple targets unless you absolutely have to. They also mix very poorly with aggregate builders that use the magic placeholder files for instance.
Thanks! I admit the swlegion/build.yaml
is more complicated than it should be, mostly because I needed a way to make sure the built_value
generators ran before my own (so dependency order was important here). Is there another way I could have done this?
Thanks! It works with:
targets:
$default:
sources:
exclude:
- lib/src/database/**.dart
- lib/src/model/**.dart
- lib/src/all_models.dart
- test/entity/**.dart
... let me know if we should close this issue, though.
I think the best option for that would probably be specifying required_inputs
in your builder, which is a list of input extensions that must be built before your builder runs.
We also have runs_before
, which allows you to specify builder keys explicitly, but we don't have a corresponding runs_after
at this time (just because it hasn't been requested, and would be more difficult to use appropriately).
And ya I think it makes sense to just leave this open with the new title. We probably won't have time to address it soon, but its a valid issue that we should eventually address.
Thanks! I was able to simplify my entire build.yaml
down to:
builders:
_aggregate_database:
target: "_aggregate_database"
import: tool/src/aggregate_database.dart
builder_factories:
- aggregateDatabase
build_extensions:
$lib$:
- src/all_units.dart
- src/all_upgrades.dart
- src/all_weapons.dart
build_to: source
auto_apply: root_package
required_inputs:
- lib/src/model/**.g.dart
This could fall under the idea of having a validation tool: https://github.com/dart-lang/build/issues/885
I'm trying to consume my hobby package
hquplink/swlegion
:... in another package. I wrote the following
pubspec.yaml
:... and after
pub run build_runner serve
, I get:Here is an example of my
.dart_tool/build/build.dart
output: