-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Still cannot get "enabled: false" to impact the generated "build.dart…
…" file
- Loading branch information
1 parent
3261128
commit b879dfb
Showing
6 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#--- | ||
## disable all inherited "provides_builder" builders... | ||
#targets: | ||
# $default: | ||
# auto_apply_builders: false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
builders: | ||
other_builder: | ||
import: "package:provides_builder/builders.dart" | ||
builder_factories: ["someBuilder"] | ||
build_extensions: {".dart": [".something.dart"]} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:build/build.dart'; | ||
|
||
class _SomeBuilder implements Builder { | ||
const _SomeBuilder(); | ||
|
||
factory _SomeBuilder.fromOptions(BuilderOptions options) { | ||
if (options.config['throw_in_constructor'] == true) { | ||
throw StateError('Throwing on purpose cause you asked for it!'); | ||
} | ||
return const _SomeBuilder(); | ||
} | ||
|
||
@override | ||
final buildExtensions = const { | ||
'.dart': ['.something.dart'] | ||
}; | ||
|
||
@override | ||
Future build(BuildStep buildStep) async { | ||
if (!await buildStep.canRead(buildStep.inputId)) return; | ||
|
||
await buildStep.writeAsBytes( | ||
buildStep.inputId.changeExtension('.something.dart'), | ||
buildStep.readAsBytes(buildStep.inputId)); | ||
} | ||
} | ||
|
||
|
||
Builder otherBuilder(BuilderOptions options) => | ||
_SomeBuilder.fromOptions(options); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: other_builder | ||
|
||
environment: | ||
sdk: ^3.0.0 | ||
|
||
dependencies: | ||
build: | ||
path: ../../../build | ||
provides_builder: | ||
path: ../provides_builder |
This file contains 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