Use flutter_tools to generate build_script (#27277)
diff --git a/dev/automated_tests/pubspec.yaml b/dev/automated_tests/pubspec.yaml
index 0e01c47..74cdeb3 100644
--- a/dev/automated_tests/pubspec.yaml
+++ b/dev/automated_tests/pubspec.yaml
@@ -9,7 +9,7 @@
sdk: flutter
flutter_test:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -56,7 +56,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -68,4 +68,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: e195
+# PUBSPEC CHECKSUM: 25f2
diff --git a/dev/benchmarks/complex_layout/pubspec.yaml b/dev/benchmarks/complex_layout/pubspec.yaml
index 3c6784c..8f4fbe5 100644
--- a/dev/benchmarks/complex_layout/pubspec.yaml
+++ b/dev/benchmarks/complex_layout/pubspec.yaml
@@ -40,7 +40,7 @@
dev_dependencies:
flutter_test:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -74,7 +74,7 @@
source_maps: 0.10.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -85,4 +85,4 @@
- packages/flutter_gallery_assets/people/square/ali.png
- packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png
-# PUBSPEC CHECKSUM: b266
+# PUBSPEC CHECKSUM: 39c3
diff --git a/dev/benchmarks/macrobenchmarks/pubspec.yaml b/dev/benchmarks/macrobenchmarks/pubspec.yaml
index 01d15fe..1252364 100644
--- a/dev/benchmarks/macrobenchmarks/pubspec.yaml
+++ b/dev/benchmarks/macrobenchmarks/pubspec.yaml
@@ -40,7 +40,7 @@
dev_dependencies:
flutter_test:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -74,7 +74,7 @@
source_maps: 0.10.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -82,4 +82,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: b266
+# PUBSPEC CHECKSUM: 39c3
diff --git a/dev/benchmarks/microbenchmarks/pubspec.yaml b/dev/benchmarks/microbenchmarks/pubspec.yaml
index 698c30b..f7317d6 100644
--- a/dev/benchmarks/microbenchmarks/pubspec.yaml
+++ b/dev/benchmarks/microbenchmarks/pubspec.yaml
@@ -13,7 +13,7 @@
sdk: flutter
stocks:
path: ../../../examples/stocks
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -64,7 +64,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -76,4 +76,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 61eb
+# PUBSPEC CHECKSUM: fd49
diff --git a/dev/bots/pubspec.yaml b/dev/bots/pubspec.yaml
index f13e21a..c9e4b5c 100644
--- a/dev/bots/pubspec.yaml
+++ b/dev/bots/pubspec.yaml
@@ -13,7 +13,7 @@
platform: 2.2.0
http: 0.12.0+1
http_parser: 3.1.3
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
async: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -55,7 +55,7 @@
stream_channel: 1.6.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service_client: 0.2.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -67,4 +67,4 @@
mockito: 4.0.0
test_api: 0.2.2
-# PUBSPEC CHECKSUM: 4e3a
+# PUBSPEC CHECKSUM: ca97
diff --git a/dev/devicelab/pubspec.yaml b/dev/devicelab/pubspec.yaml
index 6c2a62b..276a758 100644
--- a/dev/devicelab/pubspec.yaml
+++ b/dev/devicelab/pubspec.yaml
@@ -37,7 +37,7 @@
dev_dependencies:
# See packages/flutter_test/pubspec.yaml for why we're pinning this version.
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -69,9 +69,9 @@
source_maps: 0.10.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
-# PUBSPEC CHECKSUM: cf24
+# PUBSPEC CHECKSUM: bc81
diff --git a/dev/integration_tests/android_semantics_testing/pubspec.yaml b/dev/integration_tests/android_semantics_testing/pubspec.yaml
index 5acaaa7..7b443fc 100644
--- a/dev/integration_tests/android_semantics_testing/pubspec.yaml
+++ b/dev/integration_tests/android_semantics_testing/pubspec.yaml
@@ -6,7 +6,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -54,7 +54,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -66,4 +66,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 13de
+# PUBSPEC CHECKSUM: 7b3c
diff --git a/dev/integration_tests/android_views/pubspec.yaml b/dev/integration_tests/android_views/pubspec.yaml
index c910f58..7f0586f 100644
--- a/dev/integration_tests/android_views/pubspec.yaml
+++ b/dev/integration_tests/android_views/pubspec.yaml
@@ -37,7 +37,7 @@
dev_dependencies:
flutter_test:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -71,7 +71,7 @@
source_maps: 0.10.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -79,4 +79,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: eb90
+# PUBSPEC CHECKSUM: 1bed
diff --git a/dev/integration_tests/channels/pubspec.yaml b/dev/integration_tests/channels/pubspec.yaml
index 94834d9..2142a56 100644
--- a/dev/integration_tests/channels/pubspec.yaml
+++ b/dev/integration_tests/channels/pubspec.yaml
@@ -10,7 +10,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -58,7 +58,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -70,4 +70,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 13de
+# PUBSPEC CHECKSUM: 7b3c
diff --git a/dev/integration_tests/external_ui/pubspec.yaml b/dev/integration_tests/external_ui/pubspec.yaml
index 69c58bb..7492db3 100644
--- a/dev/integration_tests/external_ui/pubspec.yaml
+++ b/dev/integration_tests/external_ui/pubspec.yaml
@@ -10,7 +10,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -58,7 +58,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -70,4 +70,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 13de
+# PUBSPEC CHECKSUM: 7b3c
diff --git a/dev/integration_tests/flavors/pubspec.yaml b/dev/integration_tests/flavors/pubspec.yaml
index 10e51b5..656eb34 100644
--- a/dev/integration_tests/flavors/pubspec.yaml
+++ b/dev/integration_tests/flavors/pubspec.yaml
@@ -10,7 +10,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -58,7 +58,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -70,4 +70,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 13de
+# PUBSPEC CHECKSUM: 7b3c
diff --git a/dev/integration_tests/platform_interaction/pubspec.yaml b/dev/integration_tests/platform_interaction/pubspec.yaml
index 40b77b2..ba266fc 100644
--- a/dev/integration_tests/platform_interaction/pubspec.yaml
+++ b/dev/integration_tests/platform_interaction/pubspec.yaml
@@ -10,7 +10,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -58,7 +58,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -70,4 +70,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 13de
+# PUBSPEC CHECKSUM: 7b3c
diff --git a/dev/integration_tests/ui/pubspec.yaml b/dev/integration_tests/ui/pubspec.yaml
index 4beb8ba..ea71ee6 100644
--- a/dev/integration_tests/ui/pubspec.yaml
+++ b/dev/integration_tests/ui/pubspec.yaml
@@ -11,7 +11,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
archive: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -60,7 +60,7 @@
stream_channel: 1.6.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -80,4 +80,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: 54f5
+# PUBSPEC CHECKSUM: e153
diff --git a/dev/snippets/pubspec.yaml b/dev/snippets/pubspec.yaml
index 9be4f51..8e37cf0 100644
--- a/dev/snippets/pubspec.yaml
+++ b/dev/snippets/pubspec.yaml
@@ -43,7 +43,7 @@
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
- test: 1.5.2
+ test: 1.5.3
boolean_selector: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http: 0.12.0+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -68,7 +68,7 @@
stack_trace: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 1.6.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service_client: 0.2.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
web_socket_channel: 1.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -101,4 +101,4 @@
vm_service_client: 0.2.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
web_socket_channel: 1.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
-# PUBSPEC CHECKSUM: 48f7
+# PUBSPEC CHECKSUM: bb55
diff --git a/examples/catalog/pubspec.yaml b/examples/catalog/pubspec.yaml
index 0370376..a496ead 100644
--- a/examples/catalog/pubspec.yaml
+++ b/examples/catalog/pubspec.yaml
@@ -20,7 +20,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -66,7 +66,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service_client: 0.2.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -76,4 +76,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: c6c7
+# PUBSPEC CHECKSUM: d225
diff --git a/examples/flutter_gallery/pubspec.yaml b/examples/flutter_gallery/pubspec.yaml
index 239ede4..e1ba254 100644
--- a/examples/flutter_gallery/pubspec.yaml
+++ b/examples/flutter_gallery/pubspec.yaml
@@ -10,7 +10,7 @@
collection: 1.14.11
device_info: 0.4.0
intl: 0.15.7
- connectivity: 0.4.0
+ connectivity: 0.4.0+1
string_scanner: 1.0.4
url_launcher: 5.0.0
cupertino_icons: 0.1.2
@@ -36,7 +36,7 @@
sdk: flutter
flutter_goldens:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -79,7 +79,7 @@
stack_trace: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 1.6.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service_client: 0.2.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -242,4 +242,4 @@
- asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Regular.ttf
weight: 400
-# PUBSPEC CHECKSUM: 2c0e
+# PUBSPEC CHECKSUM: b3c7
diff --git a/examples/platform_channel/pubspec.yaml b/examples/platform_channel/pubspec.yaml
index a0ab404..42df5e2 100644
--- a/examples/platform_channel/pubspec.yaml
+++ b/examples/platform_channel/pubspec.yaml
@@ -18,7 +18,7 @@
sdk: flutter
flutter_driver:
sdk: flutter
- test: 1.5.2
+ test: 1.5.3
analyzer: 0.33.6+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -65,7 +65,7 @@
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test_core: 0.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_core: 0.2.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service_client: 0.2.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -75,4 +75,4 @@
flutter:
uses-material-design: true
-# PUBSPEC CHECKSUM: c6c7
+# PUBSPEC CHECKSUM: d225
diff --git a/packages/flutter_build/lib/src/kernel_builder.dart b/packages/flutter_build/lib/src/kernel_builder.dart
index 1ee2832..65f873d 100644
--- a/packages/flutter_build/lib/src/kernel_builder.dart
+++ b/packages/flutter_build/lib/src/kernel_builder.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Note: this Builder does not run in the same process as the flutter_tool, so
+// the DI provided getters such as `fs` will not work.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -14,7 +16,6 @@
const String _kFlutterDillOutputExtension = '.app.dill';
const String _kPackagesExtension = '.packages';
-const String multiRootScheme = 'org-dartlang-app';
/// A builder which creates a kernel and packages file for a Flutter app.
///
@@ -235,39 +236,47 @@
}
}
+
+class _CompilerOutput {
+ const _CompilerOutput(this.outputFilename, this.errorCount);
+
+ final String outputFilename;
+ final int errorCount;
+}
+
/// Converts filesystem paths to package URIs.
class _PackageUriMapper {
- _PackageUriMapper(String scriptPath, String packagesPath, this.fileSystemScheme, this.fileSystemRoots) {
+ _PackageUriMapper(String scriptPath, String packagesPath, String fileSystemScheme, List<String> fileSystemRoots) {
final List<int> bytes = File(path.absolute(packagesPath)).readAsBytesSync();
final Map<String, Uri> packageMap = packages_file.parse(bytes, Uri.file(packagesPath, windows: Platform.isWindows));
final String scriptUri = Uri.file(scriptPath, windows: Platform.isWindows).toString();
+
for (String packageName in packageMap.keys) {
final String prefix = packageMap[packageName].toString();
if (fileSystemScheme != null && fileSystemRoots != null && prefix.contains(fileSystemScheme)) {
_packageName = packageName;
- _uriPrefix = fileSystemRoots.map((String name) => Uri.file('$name/lib/', windows: Platform.isWindows).toString()).toList();
+ _uriPrefixes = fileSystemRoots
+ .map((String name) => Uri.file('$name/lib/', windows: Platform.isWindows).toString())
+ .toList();
return;
}
if (scriptUri.startsWith(prefix)) {
_packageName = packageName;
- _uriPrefix = <String>[prefix];
+ _uriPrefixes = <String>[prefix];
return;
}
}
}
- final String fileSystemScheme;
- final List<String> fileSystemRoots;
-
String _packageName;
- List<String> _uriPrefix;
+ List<String> _uriPrefixes;
Uri map(String scriptPath) {
if (_packageName == null) {
return null;
}
final String scriptUri = Uri.file(scriptPath, windows: Platform.isWindows).toString();
- for (String uriPrefix in _uriPrefix) {
+ for (String uriPrefix in _uriPrefixes) {
if (scriptUri.startsWith(uriPrefix)) {
return Uri.parse('package:$_packageName/${scriptUri.substring(uriPrefix.length)}');
}
@@ -279,10 +288,3 @@
return _PackageUriMapper(scriptPath, packagesPath, fileSystemScheme, fileSystemRoots).map(scriptPath);
}
}
-
-class _CompilerOutput {
- const _CompilerOutput(this.outputFilename, this.errorCount);
-
- final String outputFilename;
- final int errorCount;
-}
diff --git a/packages/flutter_build/pubspec.yaml b/packages/flutter_build/pubspec.yaml
index 1784a93..bd81dc5 100644
--- a/packages/flutter_build/pubspec.yaml
+++ b/packages/flutter_build/pubspec.yaml
@@ -7,7 +7,7 @@
dependencies:
# To update these, use "flutter update-packages --force-upgrade".
build: 1.1.0
- build_modules: 1.0.4
+ build_modules: 1.0.6
package_config: 1.0.5
path: 1.6.2
@@ -33,7 +33,7 @@
pedantic: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
plugin: 0.2.0+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pool: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- protobuf: 0.13.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ protobuf: 0.13.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pub_semver: 1.4.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pubspec_parse: 0.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
scratch_space: 0.0.3+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -50,4 +50,4 @@
# Exclude this package from the hosted API docs.
nodoc: true
-# PUBSPEC CHECKSUM: ec31
+# PUBSPEC CHECKSUM: 1f34
diff --git a/packages/flutter_tools/lib/src/build_runner/build_runner.dart b/packages/flutter_tools/lib/src/build_runner/build_runner.dart
index 3c062cf..68591c0 100644
--- a/packages/flutter_tools/lib/src/build_runner/build_runner.dart
+++ b/packages/flutter_tools/lib/src/build_runner/build_runner.dart
@@ -4,19 +4,22 @@
import 'dart:async';
+import 'package:build_runner_core/build_runner_core.dart';
import 'package:meta/meta.dart';
import '../artifacts.dart';
import '../base/context.dart';
import '../base/file_system.dart';
import '../base/io.dart';
+import '../base/logger.dart';
import '../base/platform.dart';
import '../base/process_manager.dart';
import '../cache.dart';
import '../convert.dart';
-import '../dart/package_map.dart';
+import '../dart/pub.dart';
import '../globals.dart';
import '../project.dart';
+import 'build_script_generator.dart';
/// The [BuildRunnerFactory] instance.
BuildRunnerFactory get buildRunnerFactory => context[BuildRunnerFactory];
@@ -26,17 +29,8 @@
/// This requires both an experimental opt in via the environment variable
/// 'FLUTTER_EXPERIMENTAL_BUILD' and that the project itself has a
/// dependency on the package 'flutter_build' and 'build_runner.'
-FutureOr<bool> get experimentalBuildEnabled async {
- if (_experimentalBuildEnabled != null) {
- return _experimentalBuildEnabled;
- }
- final bool flagEnabled = platform.environment['FLUTTER_EXPERIMENTAL_BUILD']?.toLowerCase() == 'true';
- if (!flagEnabled) {
- return _experimentalBuildEnabled = false;
- }
- final FlutterProject flutterProject = await FlutterProject.current();
- final Map<String, Uri> packages = PackageMap(flutterProject.packagesFile.path).map;
- return _experimentalBuildEnabled = packages.containsKey('flutter_build') && packages.containsKey('build_runner');
+bool get experimentalBuildEnabled {
+ return _experimentalBuildEnabled ??= platform.environment['FLUTTER_EXPERIMENTAL_BUILD']?.toLowerCase() == 'true';
}
bool _experimentalBuildEnabled;
@@ -74,53 +68,69 @@
@required String mainPath,
@required List<String> extraFrontEndOptions,
}) async {
+ await generateBuildScript();
final FlutterProject flutterProject = await FlutterProject.current();
final String frontendServerPath = artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk
);
- final String pubExecutable = fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk','bin', 'pub');
final String sdkRoot = artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath);
final String engineDartBinaryPath = artifacts.getArtifactPath(Artifact.engineDartBinary);
final String packagesPath = flutterProject.packagesFile.absolute.path;
- final Process process = await processManager.start(<String>[
- '$pubExecutable',
- 'run',
- 'build_runner',
- 'build',
- '--define', 'flutter_build|kernel=disabled=false',
- '--define', 'flutter_build|kernel=aot=$aot',
- '--define', 'flutter_build|kernel=linkPlatformKernelIn=$linkPlatformKernelIn',
- '--define', 'flutter_build|kernel=trackWidgetCreation=$trackWidgetCreation',
- '--define', 'flutter_build|kernel=targetProductVm=$targetProductVm',
- '--define', 'flutter_build|kernel=mainPath=$mainPath',
- '--define', 'flutter_build|kernel=packagesPath=$packagesPath',
- '--define', 'flutter_build|kernel=sdkRoot=$sdkRoot',
- '--define', 'flutter_build|kernel=frontendServerPath=$frontendServerPath',
- '--define', 'flutter_build|kernel=engineDartBinaryPath=$engineDartBinaryPath',
- '--define', 'flutter_build|kernel=extraFrontEndOptions=${extraFrontEndOptions ?? const <String>[]}',
- ]);
- process.stdout
- .transform(utf8.decoder)
- .transform(const LineSplitter())
- .listen(_handleOutput);
- process.stderr
- .transform(utf8.decoder)
- .transform(const LineSplitter())
- .listen(_handleError);
- final int exitCode = await process.exitCode;
- if (exitCode != 0) {
- throw Exception('build_runner exited with non-zero exit code: $exitCode');
+ final String buildScript = flutterProject
+ .dartTool
+ .childDirectory('build')
+ .childDirectory('entrypoint')
+ .childFile('build.dart')
+ .path;
+ final String scriptPackagesPath = flutterProject
+ .dartTool
+ .childDirectory('flutter_tool')
+ .childFile('.packages')
+ .path;
+ final String dartPath = fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dart');
+ final Status status = logger.startProgress('running builders...', timeout: null);
+ try {
+ final Process buildProcess = await processManager.start(<String>[
+ dartPath,
+ '--packages=$scriptPackagesPath',
+ buildScript,
+ 'build',
+ '--define', 'flutter_build|kernel=disabled=false',
+ '--define', 'flutter_build|kernel=aot=$aot',
+ '--define', 'flutter_build|kernel=linkPlatformKernelIn=$linkPlatformKernelIn',
+ '--define', 'flutter_build|kernel=trackWidgetCreation=$trackWidgetCreation',
+ '--define', 'flutter_build|kernel=targetProductVm=$targetProductVm',
+ '--define', 'flutter_build|kernel=mainPath=$mainPath',
+ '--define', 'flutter_build|kernel=packagesPath=$packagesPath',
+ '--define', 'flutter_build|kernel=sdkRoot=$sdkRoot',
+ '--define', 'flutter_build|kernel=frontendServerPath=$frontendServerPath',
+ '--define', 'flutter_build|kernel=engineDartBinaryPath=$engineDartBinaryPath',
+ '--define', 'flutter_build|kernel=extraFrontEndOptions=${extraFrontEndOptions ?? const <String>[]}',
+ ]);
+ buildProcess
+ .stdout
+ .transform(utf8.decoder)
+ .transform(const LineSplitter())
+ .listen(printStatus);
+ buildProcess
+ .stderr
+ .transform(utf8.decoder)
+ .transform(const LineSplitter())
+ .listen(printError);
+ await buildProcess.exitCode;
+ } finally {
+ status.stop();
}
/// We don't check for this above because it might be generated for the
/// first time by invoking the build.
final Directory dartTool = flutterProject.dartTool;
final String projectName = flutterProject.manifest.appName;
final Directory generatedDirectory = dartTool
- .absolute
- .childDirectory('build')
- .childDirectory('generated')
- .childDirectory(projectName);
- if (!await generatedDirectory.exists()) {
+ .absolute
+ .childDirectory('build')
+ .childDirectory('generated')
+ .childDirectory(projectName);
+ if (!generatedDirectory.existsSync()) {
throw Exception('build_runner cannot find generated directory');
}
final String relativeMain = fs.path.relative(mainPath, from: flutterProject.directory.path);
@@ -130,18 +140,66 @@
final File dillFile = fs.file(
fs.path.join(generatedDirectory.path, fs.path.setExtension(relativeMain, '.app.dill'))
);
- if (!await packagesFile.exists() || !await dillFile.exists()) {
+ if (!packagesFile.existsSync() || !dillFile.existsSync()) {
throw Exception('build_runner did not produce output at expected location: ${dillFile.path} missing');
}
return BuildResult(packagesFile, dillFile);
}
- void _handleOutput(String line) {
- printTrace(line);
+ /// Invalidates a generated build script by deleting it.
+ ///
+ /// Must be called any time a pubspec file update triggers a corresponding change
+ /// in .packages.
+ Future<void> invalidateBuildScript() async {
+ final FlutterProject flutterProject = await FlutterProject.current();
+ final File buildScript = flutterProject.dartTool
+ .absolute
+ .childDirectory('flutter_tool')
+ .childFile('build.dart');
+ if (!buildScript.existsSync()) {
+ return;
+ }
+ await buildScript.delete();
}
- void _handleError(String line) {
- printError(line);
+ // Generates a synthetic package under .dart_tool/flutter_tool which is in turn
+ // used to generate a build script.
+ Future<void> generateBuildScript() async {
+ final FlutterProject flutterProject = await FlutterProject.current();
+ final String generatedDirectory = fs.path.join(flutterProject.dartTool.path, 'flutter_tool');
+ final String resultScriptPath = fs.path.join(flutterProject.dartTool.path, 'build', 'entrypoint', 'build.dart');
+ if (fs.file(resultScriptPath).existsSync()) {
+ return;
+ }
+ final Status status = logger.startProgress('generating build script...', timeout: null);
+ try {
+ fs.directory(generatedDirectory).createSync(recursive: true);
+
+ final File syntheticPubspec = fs.file(fs.path.join(generatedDirectory, 'pubspec.yaml'));
+ final StringBuffer stringBuffer = StringBuffer();
+
+ stringBuffer.writeln('name: synthetic_example');
+ stringBuffer.writeln('dependencies:');
+ for (String builder in await flutterProject.builders) {
+ stringBuffer.writeln(' $builder: any');
+ }
+ stringBuffer.writeln(' build_runner: any');
+ stringBuffer.writeln(' flutter_build:');
+ stringBuffer.writeln(' sdk: flutter');
+ await syntheticPubspec.writeAsString(stringBuffer.toString());
+
+ await pubGet(
+ context: PubContext.pubGet,
+ directory: generatedDirectory,
+ upgrade: false,
+ checkLastModified: false,
+ );
+ final PackageGraph packageGraph = PackageGraph.forPath(syntheticPubspec.parent.path);
+ final BuildScriptGenerator buildScriptGenerator = buildScriptGeneratorFactory.create(flutterProject, packageGraph);
+ await buildScriptGenerator.generateBuildScript();
+ } finally {
+ status.stop();
+ }
}
}
diff --git a/packages/flutter_tools/lib/src/build_runner/build_script_generator.dart b/packages/flutter_tools/lib/src/build_runner/build_script_generator.dart
new file mode 100644
index 0000000..1467872
--- /dev/null
+++ b/packages/flutter_tools/lib/src/build_runner/build_script_generator.dart
@@ -0,0 +1,283 @@
+// Copyright 201 The Chromium Authors. 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_runner_core/build_runner_core.dart';
+import 'package:build/build.dart' show BuilderOptions;
+import 'package:build_config/build_config.dart';
+import 'package:code_builder/code_builder.dart';
+import 'package:dart_style/dart_style.dart';
+import 'package:graphs/graphs.dart';
+
+import '../base/common.dart';
+import '../base/context.dart';
+import '../base/file_system.dart';
+import '../project.dart';
+
+BuildScriptGeneratorFactory get buildScriptGeneratorFactory => context[BuildScriptGeneratorFactory];
+
+class BuildScriptGeneratorFactory {
+ const BuildScriptGeneratorFactory();
+
+ /// Creates a [BuildScriptGenerator] for the current flutter project.
+ BuildScriptGenerator create(FlutterProject flutterProject, PackageGraph packageGraph) {
+ return BuildScriptGenerator(flutterProject, packageGraph);
+ }
+}
+
+/// Generates a build_script for the current flutter project.
+class BuildScriptGenerator {
+ const BuildScriptGenerator(this.flutterProject, this.packageGraph);
+
+ final FlutterProject flutterProject;
+ final PackageGraph packageGraph;
+
+ /// Generate a build script for the curent flutter project.
+ ///
+ /// Requires the project to have a pubspec.yaml.
+ Future<void> generateBuildScript() async {
+ final Iterable<Expression> builders = await _findBuilderApplications();
+ final Library library = Library((LibraryBuilder libraryBuilder) => libraryBuilder.body.addAll(<Spec>[
+ literalList(builders, refer('BuilderApplication', 'package:build_runner_core/build_runner_core.dart'))
+ .assignFinal('_builders')
+ .statement,
+ _createMain()
+ ]));
+ final DartEmitter emitter = DartEmitter(Allocator.simplePrefixing());
+ try {
+ final String location = fs.path.join(flutterProject.dartTool.path, 'build', 'entrypoint', 'build.dart');
+ final String result = DartFormatter().format('''
+ // ignore_for_file: directives_ordering
+ ${library.accept(emitter)}''');
+ final File output = fs.file(location);
+ await output.create(recursive: true);
+ await fs.file(location).writeAsString(result);
+ } on FormatterException {
+ throwToolExit('Generated build script could not be parsed. '
+ 'This is likely caused by a misconfigured builder definition.');
+ }
+ }
+
+ /// Finds expressions to create all the `BuilderApplication` instances that
+ /// should be applied packages in the build.
+ ///
+ /// Adds `apply` expressions based on the BuildefDefinitions from any package
+ /// which has a `build.yaml`.
+ Future<Iterable<Expression>> _findBuilderApplications() async {
+ final List<Expression> builderApplications = <Expression>[];
+ final Iterable<PackageNode> orderedPackages = stronglyConnectedComponents<PackageNode>(
+ <PackageNode>[packageGraph.root],
+ (PackageNode node) => node.dependencies,
+ equals: (PackageNode a, PackageNode b) => a.name == b.name,
+ hashCode: (PackageNode n) => n.name.hashCode,
+ ).expand((List<PackageNode> nodes) => nodes);
+ Future<BuildConfig> _packageBuildConfig(PackageNode package) async {
+ try {
+ return await BuildConfig.fromBuildConfigDir(package.name, package.dependencies.map((PackageNode node) => node.name), package.path);
+ } on ArgumentError catch (_) {
+ // During the build an error will be logged.
+ return BuildConfig.useDefault(package.name, package.dependencies.map((PackageNode node) => node.name));
+ }
+ }
+
+ final Iterable<BuildConfig> orderedConfigs = await Future.wait(orderedPackages.map(_packageBuildConfig));
+ final List<BuilderDefinition> builderDefinitions = orderedConfigs
+ .expand((BuildConfig buildConfig) => buildConfig.builderDefinitions.values)
+ .where((BuilderDefinition builderDefinition) {
+ if (builderDefinition.import.startsWith('package:')) {
+ return true;
+ }
+ return builderDefinition.package == packageGraph.root.name;
+ })
+ .toList();
+
+ final List<BuilderDefinition> orderedBuilders = _findBuilderOrder(builderDefinitions).toList();
+ builderApplications.addAll(orderedBuilders.map(_applyBuilder));
+
+ final List<PostProcessBuilderDefinition> postProcessBuilderDefinitions = orderedConfigs
+ .expand((BuildConfig buildConfig) => buildConfig.postProcessBuilderDefinitions.values)
+ .where((PostProcessBuilderDefinition builderDefinition) {
+ if (builderDefinition.import.startsWith('package:')) {
+ return true;
+ }
+ return builderDefinition.package == packageGraph.root.name;
+ })
+ .toList();
+ builderApplications.addAll(postProcessBuilderDefinitions.map(_applyPostProcessBuilder));
+
+ return builderApplications;
+ }
+
+ /// A method forwarding to `run`.
+ Method _createMain() {
+ return Method((MethodBuilder b) => b
+ ..name = 'main'
+ ..modifier = MethodModifier.async
+ ..requiredParameters.add(Parameter((ParameterBuilder parameterBuilder) => parameterBuilder
+ ..name = 'args'
+ ..type = TypeReference((TypeReferenceBuilder typeReferenceBuilder) => typeReferenceBuilder
+ ..symbol = 'List'
+ ..types.add(refer('String')))))
+ ..optionalParameters.add(Parameter((ParameterBuilder parameterBuilder) => parameterBuilder
+ ..name = 'sendPort'
+ ..type = refer('SendPort', 'dart:isolate')))
+ ..body = Block.of(<Code>[
+ refer('run', 'package:build_runner/build_runner.dart')
+ .call(<Expression>[refer('args'), refer('_builders')])
+ .awaited
+ .assignVar('result')
+ .statement,
+ refer('sendPort')
+ .nullSafeProperty('send')
+ .call(<Expression>[refer('result')]).statement,
+ ]));
+ }
+
+ /// An expression calling `apply` with appropriate setup for a Builder.
+ Expression _applyBuilder(BuilderDefinition definition) {
+ final Map<String, Expression> namedArgs = <String, Expression>{};
+ if (definition.isOptional) {
+ namedArgs['isOptional'] = literalTrue;
+ }
+ if (definition.buildTo == BuildTo.cache) {
+ namedArgs['hideOutput'] = literalTrue;
+ } else {
+ namedArgs['hideOutput'] = literalFalse;
+ }
+ if (!identical(definition.defaults?.generateFor, InputSet.anything)) {
+ final Map<String, Expression> inputSetArgs = <String, Expression>{};
+ if (definition.defaults.generateFor.include != null) {
+ inputSetArgs['include'] = literalConstList(definition.defaults.generateFor.include);
+ }
+ if (definition.defaults.generateFor.exclude != null) {
+ inputSetArgs['exclude'] = literalConstList(definition.defaults.generateFor.exclude);
+ }
+ namedArgs['defaultGenerateFor'] =
+ refer('InputSet', 'package:build_config/build_config.dart')
+ .constInstance(<Expression>[], inputSetArgs);
+ }
+ if (!identical(definition.defaults?.options, BuilderOptions.empty)) {
+ namedArgs['defaultOptions'] = _constructBuilderOptions(definition.defaults.options);
+ }
+ if (!identical(definition.defaults?.devOptions, BuilderOptions.empty)) {
+ namedArgs['defaultDevOptions'] = _constructBuilderOptions(definition.defaults.devOptions);
+ }
+ if (!identical(definition.defaults?.releaseOptions, BuilderOptions.empty)) {
+ namedArgs['defaultReleaseOptions'] = _constructBuilderOptions(definition.defaults.releaseOptions);
+ }
+ if (definition.appliesBuilders.isNotEmpty) {
+ namedArgs['appliesBuilders'] = literalList(definition.appliesBuilders);
+ }
+ final String import = _buildScriptImport(definition.import);
+ return refer('apply', 'package:build_runner_core/build_runner_core.dart')
+ .call(<Expression>[
+ literalString(definition.key),
+ literalList(
+ definition.builderFactories.map((String f) => refer(f, import)).toList()),
+ _findToExpression(definition),
+ ], namedArgs);
+ }
+
+ /// An expression calling `applyPostProcess` with appropriate setup for a
+ /// PostProcessBuilder.
+ Expression _applyPostProcessBuilder(PostProcessBuilderDefinition definition) {
+ final Map<String, Expression> namedArgs = <String, Expression>{};
+ if (definition.defaults?.generateFor != null) {
+ final Map<String, Expression> inputSetArgs = <String, Expression>{};
+ if (definition.defaults.generateFor.include != null) {
+ inputSetArgs['include'] = literalConstList(definition.defaults.generateFor.include);
+ }
+ if (definition.defaults.generateFor.exclude != null) {
+ inputSetArgs['exclude'] = literalConstList(definition.defaults.generateFor.exclude);
+ }
+ if (!identical(definition.defaults?.options, BuilderOptions.empty)) {
+ namedArgs['defaultOptions'] = _constructBuilderOptions(definition.defaults.options);
+ }
+ if (!identical(definition.defaults?.devOptions, BuilderOptions.empty)) {
+ namedArgs['defaultDevOptions'] = _constructBuilderOptions(definition.defaults.devOptions);
+ }
+ if (!identical(definition.defaults?.releaseOptions, BuilderOptions.empty)) {
+ namedArgs['defaultReleaseOptions'] = _constructBuilderOptions(definition.defaults.releaseOptions);
+ }
+ namedArgs['defaultGenerateFor'] = refer('InputSet', 'package:build_config/build_config.dart').constInstance(<Expression>[], inputSetArgs);
+ }
+ final String import = _buildScriptImport(definition.import);
+ return refer('applyPostProcess', 'package:build_runner_core/build_runner_core.dart')
+ .call(<Expression>[
+ literalString(definition.key),
+ refer(definition.builderFactory, import),
+ ], namedArgs);
+ }
+
+ /// Returns the actual import to put in the generated script based on an import
+ /// found in the build.yaml.
+ String _buildScriptImport(String import) {
+ if (import.startsWith('package:')) {
+ return import;
+ }
+ throwToolExit('non-package import syntax in build.yaml is not supported');
+ return null;
+ }
+
+ Expression _findToExpression(BuilderDefinition definition) {
+ switch (definition.autoApply) {
+ case AutoApply.none:
+ return refer('toNoneByDefault',
+ 'package:build_runner_core/build_runner_core.dart')
+ .call(<Expression>[]);
+ case AutoApply.dependents:
+ return refer('toDependentsOf',
+ 'package:build_runner_core/build_runner_core.dart')
+ .call(<Expression>[literalString(definition.package)]);
+ case AutoApply.allPackages:
+ return refer('toAllPackages',
+ 'package:build_runner_core/build_runner_core.dart')
+ .call(<Expression>[]);
+ case AutoApply.rootPackage:
+ return refer('toRoot', 'package:build_runner_core/build_runner_core.dart')
+ .call(<Expression>[]);
+ }
+ throw ArgumentError('Unhandled AutoApply type: ${definition.autoApply}');
+ }
+
+ /// An expression creating a [BuilderOptions] from a json string.
+ Expression _constructBuilderOptions(BuilderOptions options) {
+ return refer('BuilderOptions', 'package:build/build.dart').newInstance(<Expression>[literalMap(options.config)]);
+ }
+
+ /// Put [builders] into an order such that any builder which specifies
+ /// [BuilderDefinition.requiredInputs] will come after any builder which
+ /// produces a desired output.
+ ///
+ /// Builders will be ordered such that their `required_inputs` and `runs_before`
+ /// constraints are met, but the rest of the ordering is arbitrary.
+ Iterable<BuilderDefinition> _findBuilderOrder(Iterable<BuilderDefinition> builders) {
+ Iterable<BuilderDefinition> dependencies(BuilderDefinition parent) {
+ return builders.where((BuilderDefinition child) => _hasInputDependency(parent, child) || _mustRunBefore(parent, child));
+ }
+ final List<List<BuilderDefinition>> components = stronglyConnectedComponents<BuilderDefinition>(
+ builders,
+ dependencies,
+ equals: (BuilderDefinition a, BuilderDefinition b) => a.key == b.key,
+ hashCode: (BuilderDefinition b) => b.key.hashCode,
+ );
+ return components.map((List<BuilderDefinition> component) {
+ if (component.length > 1) {
+ throw ArgumentError('Required input cycle for ${component.toList()}');
+ }
+ return component.single;
+ }).toList();
+ }
+
+ /// Whether [parent] has a `required_input` that wants to read outputs produced
+ /// by [child].
+ bool _hasInputDependency(BuilderDefinition parent, BuilderDefinition child) {
+ final Set<String> childOutputs = child.buildExtensions.values.expand((List<String> values) => values).toSet();
+ return parent.requiredInputs.any((String input) => childOutputs.any((String output) => output.endsWith(input)));
+ }
+
+ /// Whether [child] specifies that it wants to run before [parent].
+ bool _mustRunBefore(BuilderDefinition parent, BuilderDefinition child) => child.runsBefore.contains(parent.key);
+}
\ No newline at end of file
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index f1f9d3d..07aab13 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -119,7 +119,7 @@
);
}
// Only retain flutter, flutter_test, flutter_driver, and flutter_localizations.
- const List<String> consumerPackages = <String>['flutter', 'flutter_test', 'flutter_driver', 'flutter_localizations', 'flutter_build'];
+ const List<String> consumerPackages = <String>['flutter', 'flutter_test', 'flutter_driver', 'flutter_localizations'];
// ensure we only get flutter/packages
packages.retainWhere((Directory directory) {
return consumerPackages.any((String package) {
diff --git a/packages/flutter_tools/lib/src/context_runner.dart b/packages/flutter_tools/lib/src/context_runner.dart
index deb0e22..7229b90 100644
--- a/packages/flutter_tools/lib/src/context_runner.dart
+++ b/packages/flutter_tools/lib/src/context_runner.dart
@@ -22,6 +22,7 @@
import 'base/user_messages.dart';
import 'base/utils.dart';
import 'build_runner/build_runner.dart';
+import 'build_runner/build_script_generator.dart';
import 'cache.dart';
import 'compile.dart';
import 'devfs.dart';
@@ -60,6 +61,7 @@
Artifacts: () => CachedArtifacts(),
AssetBundleFactory: () => AssetBundleFactory.defaultInstance,
BotDetector: () => const BotDetector(),
+ BuildScriptGeneratorFactory: () => const BuildScriptGeneratorFactory(),
BuildRunnerFactory: () => const BuildRunnerFactory(),
Cache: () => Cache(),
CocoaPods: () => CocoaPods(),
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart
index bfbe689..68f1f12 100644
--- a/packages/flutter_tools/lib/src/project.dart
+++ b/packages/flutter_tools/lib/src/project.dart
@@ -4,7 +4,9 @@
import 'dart:async';
+import 'package:build_runner_core/build_runner_core.dart';
import 'package:meta/meta.dart';
+import 'package:yaml/yaml.dart';
import 'android/gradle.dart' as gradle;
import 'base/common.dart';
@@ -144,6 +146,23 @@
await ios.ensureReadyForPlatformSpecificTooling();
await injectPlugins(this);
}
+
+ /// Return the build_runner [PackageGraph] for this package.
+ Future<PackageGraph> get packageGraph async {
+ return PackageGraph.forPath(directory.path);
+ }
+
+ /// Return the set of builders used by this package.
+ Future<List<String>> get builders async {
+ final YamlMap pubspec = loadYaml(await pubspecFile.readAsString());
+ final YamlList builders = pubspec['builders'];
+ if (builders == null) {
+ return <String>[];
+ }
+ return builders.map<String>((Object node) {
+ return node.toString();
+ }).toList();
+ }
}
/// Represents the iOS sub-project of a Flutter project.
diff --git a/packages/flutter_tools/pubspec.yaml b/packages/flutter_tools/pubspec.yaml
index 25bc40f..5e2f0db 100644
--- a/packages/flutter_tools/pubspec.yaml
+++ b/packages/flutter_tools/pubspec.yaml
@@ -23,7 +23,7 @@
json_schema: 1.0.10
linter: 0.1.74
meta: 1.1.6
- mustache: 1.1.0
+ mustache: 1.1.1
package_config: 1.0.5
platform: 2.2.0
plugin: 0.2.0+3
@@ -39,23 +39,40 @@
flutter_goldens_client:
path: ../flutter_goldens_client
+ # build_runner depenencies needed for codegen.
+ build: 1.1.0
+ build_modules: 1.0.6
+
# We depend on very specific internal implementation details of the
# 'test' package, which change between versions, so when upgrading
# this, make sure the tests are still running correctly.
test_api: 0.2.2
- test_core: 0.2.1
+ test_core: 0.2.1+1
+
+ # Code generation dependencies
+ build_runner_core: 2.0.1
+ dart_style: 1.2.0
+ code_builder: 3.2.0
async: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ bazel_worker: 0.1.18 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ build_config: 0.3.1+4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ build_resolvers: 0.2.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ built_collection: 4.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ built_value: 6.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
charcode: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
convert: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
csslib: 0.14.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dart2_constant: 1.0.2+dart2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ fixnum: 0.10.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
front_end: 0.1.6+9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
glob: 1.1.7 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ graphs: 0.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
html: 0.13.3+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http_parser: 3.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
io: 0.3.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ json_annotation: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
kernel: 0.3.6+9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
logging: 0.11.3+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.3+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -64,12 +81,17 @@
pedantic: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
petitparser: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pool: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ protobuf: 0.13.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pub_semver: 1.4.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ pubspec_parse: 0.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ scratch_space: 0.0.3+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_map_stack_trace: 1.1.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_maps: 0.10.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.5.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ stream_transform: 0.0.14+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ timing: 0.1.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
utf: 0.9.0+5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -89,10 +111,10 @@
shelf_packages_handler: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
shelf_static: 0.2.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
shelf_web_socket: 0.2.2+4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
- test: 1.5.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test: 1.5.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dartdoc:
# Exclude this package from the hosted API docs.
nodoc: true
-# PUBSPEC CHECKSUM: 8bcf
+# PUBSPEC CHECKSUM: 7930
diff --git a/packages/flutter_tools/test/build_runner/build_runner_test.dart b/packages/flutter_tools/test/build_runner/build_runner_test.dart
index 289adbd..a69ee5f 100644
--- a/packages/flutter_tools/test/build_runner/build_runner_test.dart
+++ b/packages/flutter_tools/test/build_runner/build_runner_test.dart
@@ -2,103 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'dart:convert';
-import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_runner/build_runner.dart';
import 'package:mockito/mockito.dart';
-import 'package:process/process.dart';
import '../src/common.dart';
import '../src/context.dart';
void main() {
group('experimentalBuildEnabled', () {
- final MockProcessManager mockProcessManager = MockProcessManager();
final MockPlatform mockPlatform = MockPlatform();
- final MockFileSystem mockFileSystem = MockFileSystem();
setUp(() {
experimentalBuildEnabled = null;
});
- testUsingContext('is enabled if environment variable is enabled and project '
- 'contains a dependency on flutter_build and build_runner', () async {
- final MockDirectory projectDirectory = MockDirectory();
- final MockDirectory exampleDirectory = MockDirectory();
- final MockFile packagesFile = MockFile();
- final MockFile pubspecFile = MockFile();
- final MockFile examplePubspecFile = MockFile();
- const String packages = r'''
-flutter_build:file:///Users/tester/.pub-cache/hosted/pub.dartlang.org/flutter_build/lib/
-build_runner:file:///Users/tester/.pub-cache/hosted/pub.dartlang.org/build_runner/lib/
-example:lib/
-''';
- when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_EXPERIMENTAL_BUILD': 'true'});
- when(mockFileSystem.currentDirectory).thenReturn(projectDirectory);
- when(mockFileSystem.isFileSync(any)).thenReturn(false);
- when(projectDirectory.childFile('pubspec.yaml')).thenReturn(pubspecFile);
- when(projectDirectory.childFile('.packages')).thenReturn(packagesFile);
- when(projectDirectory.childDirectory('example')).thenReturn(exampleDirectory);
- when(exampleDirectory.childFile('pubspec.yaml')).thenReturn(examplePubspecFile);
- when(packagesFile.path).thenReturn('/test/.packages');
- when(pubspecFile.path).thenReturn('/test/pubspec.yaml');
- when(examplePubspecFile.path).thenReturn('/test/example/pubspec.yaml');
- when(mockFileSystem.file('/test/.packages')).thenReturn(packagesFile);
- when(packagesFile.readAsBytesSync()).thenReturn(utf8.encode(packages));
-
- expect(await experimentalBuildEnabled, true);
+ testUsingContext('is enabled if environment variable is enabled', () async {
+ when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_EXPERIMENTAL_BUILD': 'true'});
+ expect(experimentalBuildEnabled, true);
}, overrides: <Type, Generator>{
- ProcessManager: () => mockProcessManager,
Platform: () => mockPlatform,
- FileSystem: () => mockFileSystem,
});
- testUsingContext('is not enabled if environment variable is enabled and project '
- 'does not contain a dependency on flutter_build', () async {
- final MockDirectory projectDirectory = MockDirectory();
- final MockDirectory exampleDirectory = MockDirectory();
- final MockFile packagesFile = MockFile();
- final MockFile pubspecFile = MockFile();
- final MockFile examplePubspecFile = MockFile();
- const String packages = r'''
-build_runner:file:///Users/tester/.pub-cache/hosted/pub.dartlang.org/build_runner/lib/
-example:lib/
-''';
- when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_EXPERIMENTAL_BUILD': 'true'});
- when(mockFileSystem.currentDirectory).thenReturn(projectDirectory);
- when(mockFileSystem.isFileSync(any)).thenReturn(false);
- when(projectDirectory.childFile('pubspec.yaml')).thenReturn(pubspecFile);
- when(projectDirectory.childFile('.packages')).thenReturn(packagesFile);
- when(projectDirectory.childDirectory('example')).thenReturn(exampleDirectory);
- when(exampleDirectory.childFile('pubspec.yaml')).thenReturn(examplePubspecFile);
- when(packagesFile.path).thenReturn('/test/.packages');
- when(pubspecFile.path).thenReturn('/test/pubspec.yaml');
- when(examplePubspecFile.path).thenReturn('/test/example/pubspec.yaml');
- when(mockFileSystem.file('/test/.packages')).thenReturn(packagesFile);
- when(packagesFile.readAsBytesSync()).thenReturn(utf8.encode(packages));
-
- expect(await experimentalBuildEnabled, false);
- }, overrides: <Type, Generator>{
- ProcessManager: () => mockProcessManager,
- Platform: () => mockPlatform,
- FileSystem: () => mockFileSystem,
- });
-
-
testUsingContext('is not enabed if environment varable is not enabled', () async {
when(mockPlatform.environment).thenReturn(<String, String>{});
- expect(await experimentalBuildEnabled, false);
+ expect(experimentalBuildEnabled, false);
}, overrides: <Type, Generator>{
- ProcessManager: () => mockProcessManager,
Platform: () => mockPlatform,
- FileSystem: () => mockFileSystem,
});
});
}
-class MockProcessManager extends Mock implements ProcessManager {}
-class MockPlatform extends Mock implements Platform {}
-class MockFileSystem extends Mock implements FileSystem {}
-class MockDirectory extends Mock implements Directory {}
-class MockFile extends Mock implements File {}
+class MockPlatform extends Mock implements Platform {}
\ No newline at end of file
diff --git a/packages/flutter_tools/test/forbidden_imports_test.dart b/packages/flutter_tools/test/forbidden_imports_test.dart
index 06b1fc6..3b3c3c2 100644
--- a/packages/flutter_tools/test/forbidden_imports_test.dart
+++ b/packages/flutter_tools/test/forbidden_imports_test.dart
@@ -10,8 +10,11 @@
final String flutterTools = fs.path.join(getFlutterRoot(), 'packages', 'flutter_tools');
test('no unauthorized imports of dart:io', () {
- final String whitelistedPath = fs.path.join(flutterTools, 'lib', 'src', 'base', 'io.dart');
- bool _isNotWhitelisted(FileSystemEntity entity) => entity.path != whitelistedPath;
+ final List<String> whitelistedPaths = <String>[
+ fs.path.join(flutterTools, 'lib', 'src', 'base', 'io.dart'),
+ fs.path.join(flutterTools, 'lib', 'src', 'build_runner', 'kernel_builder.dart'),
+ ];
+ bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => path != entity.path);
for (String dirName in <String>['lib', 'bin']) {
final Iterable<File> files = fs.directory(fs.path.join(flutterTools, dirName))
@@ -32,14 +35,17 @@
});
test('no unauthorized imports of package:path', () {
+ final String whitelistedPath = fs.path.join(flutterTools, 'lib', 'src', 'build_runner', 'kernel_builder.dart');
for (String dirName in <String>['lib', 'bin', 'test']) {
final Iterable<File> files = fs.directory(fs.path.join(flutterTools, dirName))
.listSync(recursive: true)
.where(_isDartFile)
+ .where((FileSystemEntity entity) => entity.path != whitelistedPath)
.map(_asFile);
for (File file in files) {
for (String line in file.readAsLinesSync()) {
- if (line.startsWith(RegExp(r'import.*package:path/path.dart'))) {
+ if (line.startsWith(RegExp(r'import.*package:path/path.dart')) &&
+ !line.contains('ignore: package_path_import')) {
final String relativePath = fs.path.relative(file.path, from:flutterTools);
fail("$relativePath imports 'package:path/path.dart'; use 'fs.path' instead");
}
@@ -49,8 +55,11 @@
});
test('no unauthorized imports of dart:convert', () {
- final String whitelistedPath = fs.path.join(flutterTools, 'lib', 'src', 'convert.dart');
- bool _isNotWhitelisted(FileSystemEntity entity) => entity.path != whitelistedPath;
+ final List<String> whitelistedPaths = <String>[
+ fs.path.join(flutterTools, 'lib', 'src', 'convert.dart'),
+ fs.path.join(flutterTools, 'lib', 'src', 'build_runner', 'kernel_builder.dart'),
+ ];
+ bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => path != entity.path);
for (String dirName in <String>['lib']) {
final Iterable<File> files = fs.directory(fs.path.join(flutterTools, dirName))