[go_router] [test-exempt] Use make-deps-path-based script for analysis and tests (#2252)
* Use pub deps in go_router_builder
* use make-deps-path-based in analyze steps
* remove newline
* add make-deps-path-based for tests
* Cause go_router_builder to break, but go_router tests pass
* (test) bump go_router to 4.0.1
* Revert experimental breakage
* Revert go_router to 4.0.0
* Specify go_router_builder version in pubspec
* bump go_router_builder version
* Use path dependency overrides in example
* remove dependency overrides - unsupported by make-deps-path-based
* update go_router_builder/CHANGELOG.md
* Change go_router_builder/example pubspec to point to pub.dev
* Add separate pathified_* checks
* Update go_router_builder SDK constraints
Specify the same SDK constraints as go_router in go_router_builder
* Use path-based dependency for go_router_builder in example
* Address code review comments
* add --run-on-dirty-packages to pathified test script
* Use --run-on-changed-packages flag for analyze
* Bypass tool_runner.sh to use --run-on-dirty-packages flag
The tool_runner.sh script adds the "--packages-for-branch" flag,
which can't be used with "--run-on-dirty-packages flag"
https://github.com/flutter/packages/blob/main/script/tool_runner.sh#L12
* Remove unused _go_router_fake package
* Format .cirrus.yml, use a shared dart_unit_tests_exceptions.yaml file
* Remove redundant comment
* Update CHANGELOG.md
* Update .cirrus.yml
diff --git a/.cirrus.yml b/.cirrus.yml
index 9588f36..b19f3c5 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -70,7 +70,19 @@
always:
format_script: ./script/tool_runner.sh format --fail-on-change
license_script: dart pub global run flutter_plugin_tools license-check
- analyze_script: ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml
+ analyze_script:
+ - ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml
+ pathified_analyze_script:
+ # Run analysis with path-based dependencies to ensure that publishing
+ # the changes won't break analysis of other packages in the respository
+ # that depend on it.
+ - ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
+ # This uses --run-on-dirty-packages rather than --packages-for-branch
+ # since only the packages changed by 'make-deps-path-based' need to be
+ # checked.
+ - dart pub global run flutter_plugin_tools analyze --run-on-dirty-packages --custom-analysis=script/configs/custom_analysis.yaml
+ # Restore the tree to a clean state
+ - git checkout .
pubspec_script: ./script/tool_runner.sh pubspec-check
readme_script:
- ./script/tool_runner.sh readme-check
@@ -128,9 +140,14 @@
matrix:
CHANNEL: "master"
CHANNEL: "stable"
- script:
- # We exclude flutter_image because its tests need a test server, so are run via custom_package_tests.
- - ./script/tool_runner.sh test --exclude=flutter_image
+ unit_test_script:
+ - ./script/tool_runner.sh test --exclude=script/configs/dart_unit_tests_exceptions.yaml
+ pathified_unit_test_script:
+ # Run tests with path-based dependencies to ensure that publishing
+ # the changes won't break tests of other packages in the respository
+ # that depend on it.
+ - ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
+ - dart pub global run flutter_plugin_tools test --run-on-dirty-packages --exclude=script/configs/dart_unit_tests_exceptions.yaml
depends_on:
- format+analyze
- name: linux-custom_package_tests
diff --git a/packages/go_router_builder/CHANGELOG.md b/packages/go_router_builder/CHANGELOG.md
index 08c6981..1afb669 100644
--- a/packages/go_router_builder/CHANGELOG.md
+++ b/packages/go_router_builder/CHANGELOG.md
@@ -1,23 +1,27 @@
+## 1.0.6
+
+* Uses path-based deps in example.
+
## 1.0.5
-- Update example to avoid using `push()` to push the same page since is not supported. [#105150](https://github.com/flutter/flutter/issues/105150)
+* Update example to avoid using `push()` to push the same page since is not supported. [#105150](https://github.com/flutter/flutter/issues/105150)
## 1.0.4
-- Adds `push` method to generated GoRouteData's extension. [#103025](https://github.com/flutter/flutter/issues/103025)
+* Adds `push` method to generated GoRouteData's extension. [#103025](https://github.com/flutter/flutter/issues/103025)
## 1.0.3
-- Fixes incorrect separator at location path on Windows. [#102710](https://github.com/flutter/flutter/issues/102710)
+* Fixes incorrect separator at location path on Windows. [#102710](https://github.com/flutter/flutter/issues/102710)
## 1.0.2
-- Changes the parameter name of the auto-generated `go` method from `buildContext` to `context`.
+* Changes the parameter name of the auto-generated `go` method from `buildContext` to `context`.
## 1.0.1
-- Documentation fixes. [#102713](https://github.com/flutter/flutter/issues/102713).
+* Documentation fixes. [#102713](https://github.com/flutter/flutter/issues/102713).
## 1.0.0
-- First release.
+* First release.
diff --git a/packages/go_router_builder/_go_router_fake/README.md b/packages/go_router_builder/_go_router_fake/README.md
deleted file mode 100644
index 2308e9f..0000000
--- a/packages/go_router_builder/_go_router_fake/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-This is a fake package that includes mocks builder-specific classes from
-`go_router` to enable testing of `go_router_builder`.
diff --git a/packages/go_router_builder/_go_router_fake/lib/go_router.dart b/packages/go_router_builder/_go_router_fake/lib/go_router.dart
deleted file mode 100644
index 35f13e0..0000000
--- a/packages/go_router_builder/_go_router_fake/lib/go_router.dart
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2013 The Flutter Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// ignore_for_file: public_member_api_docs
-
-export 'src/route_data.dart';
-
-abstract class BuildContext {
- void go(String location, {Object? extra}) => throw UnimplementedError();
-}
diff --git a/packages/go_router_builder/_go_router_fake/lib/src/route_data.dart b/packages/go_router_builder/_go_router_fake/lib/src/route_data.dart
deleted file mode 100644
index 6f80f93..0000000
--- a/packages/go_router_builder/_go_router_fake/lib/src/route_data.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2013 The Flutter Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// ignore_for_file: public_member_api_docs
-
-import 'package:meta/meta_meta.dart';
-
-abstract class GoRouteData {
- const GoRouteData();
-
- static String $location(String path, {Map<String, String>? queryParams}) =>
- throw UnimplementedError();
- static GoRoute $route({
- required String path,
- required GoRouteData Function(GoRouterState) factory,
- List<GoRoute> routes = const <GoRoute>[],
- }) =>
- throw UnimplementedError();
-}
-
-abstract class GoRoute {}
-
-@Target(<TargetKind>{TargetKind.library, TargetKind.classType})
-class TypedGoRoute<T extends GoRouteData> {
- const TypedGoRoute({
- required this.path,
- this.routes = const <TypedGoRoute<GoRouteData>>[],
- });
-
- final String path;
- final List<TypedGoRoute<GoRouteData>> routes;
-}
-
-abstract class GoRouterState {
- Object? get extra;
- Map<String, String> get params;
- Map<String, String> get queryParams;
-}
diff --git a/packages/go_router_builder/_go_router_fake/pubspec.yaml b/packages/go_router_builder/_go_router_fake/pubspec.yaml
deleted file mode 100644
index ede1aba..0000000
--- a/packages/go_router_builder/_go_router_fake/pubspec.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-name: go_router
-description: This is a "fake" package to enable testing of go_router_builder
-publish_to: none
-
-environment:
- sdk: ">=2.14.0 <3.0.0"
-
-dependencies:
- meta: ^1.7.0
diff --git a/packages/go_router_builder/example/pubspec.yaml b/packages/go_router_builder/example/pubspec.yaml
index 35f12a4..f4bc1f1 100644
--- a/packages/go_router_builder/example/pubspec.yaml
+++ b/packages/go_router_builder/example/pubspec.yaml
@@ -8,8 +8,7 @@
dependencies:
flutter:
sdk: flutter
- # Uses path dependency override
- go_router: any
+ go_router: ^4.0.0
provider: ^6.0.0
dev_dependencies:
@@ -18,15 +17,9 @@
build_verify: ^3.0.0
flutter_test:
sdk: flutter
- # Uses path dependency override
go_router_builder:
+ path: ..
test: ^1.17.0
flutter:
uses-material-design: true
-
-dependency_overrides:
- go_router:
- path: ../../go_router
- go_router_builder:
- path: ../
diff --git a/packages/go_router_builder/pubspec.yaml b/packages/go_router_builder/pubspec.yaml
index e72d4a6..eada9e3 100644
--- a/packages/go_router_builder/pubspec.yaml
+++ b/packages/go_router_builder/pubspec.yaml
@@ -2,12 +2,13 @@
description: >-
A builder that supports generated strongly-typed route helpers for
package:go_router
-version: 1.0.5
+version: 1.0.6
repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22
environment:
- sdk: ">=2.14.0 <3.0.0"
+ sdk: ">=2.17.0 <3.0.0"
+ flutter: ">=3.0.0"
dependencies:
analyzer: '>=2.7.0 <4.0.0'
@@ -24,11 +25,6 @@
dev_dependencies:
all_lint_rules_community: ^0.0.4
build_runner: ^2.0.0
- # This is a "fake" package to enable testing
- go_router: any
+ go_router: ^4.0.0
source_gen_test: ^1.0.0
test: ^1.20.0
-
-dependency_overrides:
- go_router:
- path: _go_router_fake
diff --git a/script/configs/dart_unit_tests_exceptions.yaml b/script/configs/dart_unit_tests_exceptions.yaml
new file mode 100644
index 0000000..9de1f39
--- /dev/null
+++ b/script/configs/dart_unit_tests_exceptions.yaml
@@ -0,0 +1,5 @@
+# Packages that are excluded from dart unit tests
+#
+# We exclude flutter_image because its tests need a test server,
+# so are run via custom_package_tests.
+- flutter_image