-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[go_router] change fix_data.yaml uris to be absolute to fix lints
#3877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
416612f
d6bcf4f
17ff4d1
280bb99
c4a70c7
082bd09
6dd50ca
95a3b1e
d8b05ba
22979c1
7fd3b72
84abe08
3c15fd1
97fb307
89b929e
c0eddc0
6131a59
06a65d5
6b730ca
c893a19
769468a
1cdb2c0
dc99f47
9c08c45
a1914d4
2dd6f84
9cbbaa1
b0445fa
78a6b4d
9c78f19
78cb45c
8a0701c
4877b08
cda4ad7
258871f
91e8973
a836a06
025ffbc
2c43ec5
b64bc83
48c3ead
70ad1c9
751f84c
e06e62f
636b77b
3ef6158
f023598
11e168d
1bed8f8
932e272
219b9b0
0ee09bb
2d62b84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 7.0.1 | ||
|
|
||
| - Fixes the `dart fix --apply` command not working | ||
|
|
||
| ## 7.0.0 | ||
|
|
||
| - **BREAKING CHANGE**: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: test_fixes | ||
| publish_to: "none" | ||
| version: 1.0.0+1 | ||
|
|
||
| environment: | ||
| sdk: ">=2.18.0 <4.0.0" | ||
| flutter: ">=3.3.0" | ||
|
|
||
| dependencies: | ||
| flutter: | ||
| sdk: flutter | ||
| go_router: | ||
| path: ../ | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,27 +9,79 @@ | |
| // ignore_for_file: avoid_print | ||
|
|
||
| import 'dart:io'; | ||
| import 'package:io/io.dart' as io; | ||
| import 'package:path/path.dart' as p; | ||
| import 'package:yaml_edit/yaml_edit.dart'; | ||
|
|
||
| Future<void> main(List<String> args) async { | ||
| if (!Platform.isMacOS) { | ||
| print('This test can only be run on macOS.'); | ||
| if (!Platform.isMacOS && !Platform.isWindows) { | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| print('This test can only be run on macOS or windows.'); | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| exit(0); | ||
| } | ||
| final p.Context ctx = p.context; | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final Directory packageRoot = | ||
| Directory(p.dirname(Platform.script.path)).parent; | ||
| Directory(ctx.dirname(_ensureTrimLeadingSeparator(Platform.script.path))) | ||
| .parent; | ||
|
|
||
| //copy from go_router/test_fixes to temp directory | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final Directory testFixesTargetDir = await Directory.systemTemp.createTemp(); | ||
|
|
||
| await _prepareTemplate( | ||
| ctx: ctx, | ||
| testFixesDir: ctx.join(packageRoot.path, 'test_fixes'), | ||
| testFixesTargetDir: testFixesTargetDir.path, | ||
| ); | ||
| final int pubGet = await _runProcess( | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 'dart', | ||
| <String>[ | ||
| 'pub', | ||
| 'upgrade', | ||
| ], | ||
| workingDirectory: testFixesTargetDir.path, | ||
| ); | ||
| if (pubGet != 0) { | ||
| exit(pubGet); | ||
| } | ||
| final int status = await _runProcess( | ||
| 'dart', | ||
| <String>[ | ||
| 'fix', | ||
| '--compare-to-golden', | ||
| ], | ||
| workingDirectory: p.join(packageRoot.path, 'test_fixes'), | ||
| workingDirectory: testFixesTargetDir.path, | ||
| ); | ||
ahmednfwela marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| exit(status); | ||
| } | ||
|
|
||
| Future<void> _prepareTemplate({ | ||
| required String testFixesDir, | ||
| required String testFixesTargetDir, | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| required p.Context ctx, | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }) async { | ||
| await io.copyPath(testFixesDir, testFixesTargetDir); | ||
|
|
||
| final String pubspecYamlPath = ctx.join(testFixesTargetDir, 'pubspec.yaml'); | ||
| final File targetPubspecPath = File(pubspecYamlPath); | ||
|
|
||
| final YamlEditor editor = YamlEditor(await targetPubspecPath.readAsString()); | ||
| editor.update( | ||
| <String>['dependencies', 'go_router', 'path'], | ||
| ctx.dirname(testFixesDir), | ||
|
||
| ); | ||
| final String newYaml = editor.toString(); | ||
| await targetPubspecPath.writeAsString(newYaml); | ||
| } | ||
|
|
||
| String _ensureTrimLeadingSeparator(String path) { | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (Platform.isWindows) { | ||
| if (path.startsWith('/')) { | ||
ahmednfwela marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return path.substring(1); | ||
| } | ||
| } | ||
| return path; | ||
| } | ||
|
|
||
| Future<Process> _streamOutput(Future<Process> processFuture) async { | ||
| final Process process = await processFuture; | ||
| stdout.addStream(process.stdout); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.