Skip to content

Commit 85900b1

Browse files
authored
Update all usages of pub(.bat) run to dart run. (#3179)
This fixes our CI which is currently broken due to deprecation warnings.
1 parent 2159c90 commit 85900b1

File tree

27 files changed

+112
-101
lines changed

27 files changed

+112
-101
lines changed

.github/workflows/dart.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ jobs:
566566
- job_007
567567
- job_008
568568
job_013:
569-
name: "unit_test; linux; Dart dev; PKG: _test; `pub run build_runner test -- -p chrome --test-randomize-ordering-seed=random`, `pub run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random`"
569+
name: "unit_test; linux; Dart dev; PKG: _test; `dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random`, `dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random`"
570570
runs-on: ubuntu-latest
571571
steps:
572572
- name: Cache Pub hosted dependencies
@@ -589,14 +589,14 @@ jobs:
589589
if: "always() && steps.checkout.conclusion == 'success'"
590590
working-directory: _test
591591
run: dart pub upgrade
592-
- name: "_test; pub run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
592+
- name: "_test; dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
593593
if: "always() && steps._test_pub_upgrade.conclusion == 'success'"
594594
working-directory: _test
595-
run: "pub run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
596-
- name: "_test; pub run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
595+
run: "dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
596+
- name: "_test; dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
597597
if: "always() && steps._test_pub_upgrade.conclusion == 'success'"
598598
working-directory: _test
599-
run: "pub run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
599+
run: "dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
600600
needs:
601601
- job_001
602602
- job_002
@@ -1122,7 +1122,7 @@ jobs:
11221122
- job_007
11231123
- job_008
11241124
job_029:
1125-
name: "unit_test; windows; Dart dev; PKG: _test; `pub run build_runner test -- -p chrome --test-randomize-ordering-seed=random`, `pub run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random`"
1125+
name: "unit_test; windows; Dart dev; PKG: _test; `dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random`, `dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random`"
11261126
runs-on: windows-latest
11271127
steps:
11281128
- uses: dart-lang/[email protected]
@@ -1135,14 +1135,14 @@ jobs:
11351135
if: "always() && steps.checkout.conclusion == 'success'"
11361136
working-directory: _test
11371137
run: dart pub upgrade
1138-
- name: "_test; pub run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
1138+
- name: "_test; dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
11391139
if: "always() && steps._test_pub_upgrade.conclusion == 'success'"
11401140
working-directory: _test
1141-
run: "pub.bat run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
1142-
- name: "_test; pub run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
1141+
run: "dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random"
1142+
- name: "_test; dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
11431143
if: "always() && steps._test_pub_upgrade.conclusion == 'success'"
11441144
working-directory: _test
1145-
run: "pub.bat run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
1145+
run: "dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random"
11461146
needs:
11471147
- job_001
11481148
- job_002
@@ -1627,7 +1627,7 @@ jobs:
16271627
- job_038
16281628
- job_039
16291629
job_043:
1630-
name: "e2e_test; linux; Dart dev; PKG: _test_null_safety; `pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
1630+
name: "e2e_test; linux; Dart dev; PKG: _test_null_safety; `dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
16311631
runs-on: ubuntu-latest
16321632
steps:
16331633
- name: Cache Pub hosted dependencies
@@ -1650,14 +1650,14 @@ jobs:
16501650
if: "always() && steps.checkout.conclusion == 'success'"
16511651
working-directory: _test_null_safety
16521652
run: dart pub upgrade
1653-
- name: "_test_null_safety; pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
1653+
- name: "_test_null_safety; dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
16541654
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
16551655
working-directory: _test_null_safety
1656-
run: "pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
1657-
- name: "_test_null_safety; pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
1656+
run: "dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
1657+
- name: "_test_null_safety; dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
16581658
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
16591659
working-directory: _test_null_safety
1660-
run: "pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
1660+
run: "dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
16611661
needs:
16621662
- job_001
16631663
- job_002
@@ -2213,7 +2213,7 @@ jobs:
22132213
- job_038
22142214
- job_039
22152215
job_052:
2216-
name: "e2e_test; windows; Dart dev; PKG: _test_null_safety; `pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
2216+
name: "e2e_test; windows; Dart dev; PKG: _test_null_safety; `dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
22172217
runs-on: windows-latest
22182218
steps:
22192219
- uses: dart-lang/[email protected]
@@ -2226,14 +2226,14 @@ jobs:
22262226
if: "always() && steps.checkout.conclusion == 'success'"
22272227
working-directory: _test_null_safety
22282228
run: dart pub upgrade
2229-
- name: "_test_null_safety; pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2229+
- name: "_test_null_safety; dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
22302230
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
22312231
working-directory: _test_null_safety
2232-
run: "pub.bat run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2233-
- name: "_test_null_safety; pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
2232+
run: "dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2233+
- name: "_test_null_safety; dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
22342234
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
22352235
working-directory: _test_null_safety
2236-
run: "pub.bat run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
2236+
run: "dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
22372237
needs:
22382238
- job_001
22392239
- job_002
@@ -2357,7 +2357,7 @@ jobs:
23572357
- job_051
23582358
- job_052
23592359
job_054:
2360-
name: "e2e_test_cron; linux; Dart main; PKG: _test_null_safety; `pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
2360+
name: "e2e_test_cron; linux; Dart main; PKG: _test_null_safety; `dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
23612361
runs-on: ubuntu-latest
23622362
steps:
23632363
- name: Cache Pub hosted dependencies
@@ -2380,14 +2380,14 @@ jobs:
23802380
if: "always() && steps.checkout.conclusion == 'success'"
23812381
working-directory: _test_null_safety
23822382
run: dart pub upgrade
2383-
- name: "_test_null_safety; pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2383+
- name: "_test_null_safety; dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
23842384
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
23852385
working-directory: _test_null_safety
2386-
run: "pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2387-
- name: "_test_null_safety; pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
2386+
run: "dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2387+
- name: "_test_null_safety; dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
23882388
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
23892389
working-directory: _test_null_safety
2390-
run: "pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
2390+
run: "dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
23912391
if: "github.event_name == 'schedule'"
23922392
needs:
23932393
- job_001
@@ -2515,7 +2515,7 @@ jobs:
25152515
- job_051
25162516
- job_052
25172517
job_056:
2518-
name: "e2e_test_cron; windows; Dart main; PKG: _test_null_safety; `pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
2518+
name: "e2e_test_cron; windows; Dart main; PKG: _test_null_safety; `dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random`, `dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random`"
25192519
runs-on: windows-latest
25202520
steps:
25212521
- uses: dart-lang/[email protected]
@@ -2528,14 +2528,14 @@ jobs:
25282528
if: "always() && steps.checkout.conclusion == 'success'"
25292529
working-directory: _test_null_safety
25302530
run: dart pub upgrade
2531-
- name: "_test_null_safety; pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2531+
- name: "_test_null_safety; dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
25322532
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
25332533
working-directory: _test_null_safety
2534-
run: "pub.bat run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2535-
- name: "_test_null_safety; pub run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
2534+
run: "dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random"
2535+
- name: "_test_null_safety; dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
25362536
if: "always() && steps._test_null_safety_pub_upgrade.conclusion == 'success'"
25372537
working-directory: _test_null_safety
2538-
run: "pub.bat run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
2538+
run: "dart run build_runner test --define=\"build_web_compilers:entrypoint=compiler=dart2js\" -- -p chrome --test-randomize-ordering-seed=random"
25392539
if: "github.event_name == 'schedule'"
25402540
needs:
25412541
- job_001

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ TODO: scratch_space
7474
The [example](https://github.com/dart-lang/build/tree/master/example)
7575
directory has an example of a build with custom builders which generate outputs
7676
into both the source tree and a hidden generated directory. Try a build with
77-
`pub run build_runner build -o web:deploy` to see what the output looks like.
77+
`dart run build_runner build -o web:deploy` to see what the output looks like.
7878

7979
Most projects should not need custom builders.

_test/mono_pkg.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ stages:
1111
os: linux
1212
- unit_test:
1313
- group:
14-
- command: pub run build_runner test -- -p chrome --test-randomize-ordering-seed=random
15-
- command: pub run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random
14+
- command: dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random
15+
- command: dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random
1616
- e2e_test:
1717
- test: --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random
1818
os: linux

_test/test/common/utils.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@ Process? _process;
1717
Stream<String>? _stdOutLines;
1818
Stream<String>? get stdOutLines => _stdOutLines;
1919

20-
final String _pubBinary = Platform.isWindows ? 'pub.bat' : 'pub';
21-
22-
/// Runs a single build using `pub run build_runner build`, and returns the
20+
/// Runs a single build using `dart run build_runner build`, and returns the
2321
/// [ProcessResult].
2422
Future<ProcessResult> runBuild({List<String> trailingArgs = const []}) =>
25-
_runBuild(_pubBinary, ['run', 'build_runner', 'build', ...trailingArgs]);
23+
_runBuild('dart', ['run', 'build_runner', 'build', ...trailingArgs]);
2624

27-
/// Runs `pub run build_runner <args>`, and returns the [ProcessResult].
25+
/// Runs `dart run build_runner <args>`, and returns the [ProcessResult].
2826
Future<ProcessResult> runCommand(List<String> args) =>
29-
_runBuild(_pubBinary, ['run', 'build_runner', ...args]);
27+
_runBuild('dart', ['run', 'build_runner', ...args]);
3028

31-
/// Runs `pub run build_runner serve` in this package, and waits for the first
29+
/// Runs `dart run build_runner serve` in this package, and waits for the first
3230
/// build to complete.
3331
///
3432
/// To ensure a clean build, set [ensureCleanBuild] to `true`.
@@ -163,7 +161,7 @@ Future<TestProcess> runTests(
163161
{bool? usePrecompiled,
164162
List<String>? buildArgs,
165163
List<String>? testArgs}) async {
166-
return _runTests(_pubBinary, ['run', 'build_runner'],
164+
return _runTests('dart', ['run', 'build_runner'],
167165
usePrecompiled: usePrecompiled, buildArgs: buildArgs, testArgs: testArgs);
168166
}
169167

@@ -184,7 +182,7 @@ Future<TestProcess> _runTests(String executable, List<String> scriptArgs,
184182
return TestProcess.start(executable, args);
185183
} else {
186184
var args = ['run', 'test', '--pub-serve', '8081', ...testArgs];
187-
return TestProcess.start(_pubBinary, args);
185+
return TestProcess.start('dart', args);
188186
}
189187
}
190188

_test/test/help_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,35 @@ import 'package:test/test.dart';
1010
import 'common/utils.dart';
1111

1212
void main() {
13-
test('pub run build_runner help', () async {
13+
test('dart run build_runner help', () async {
1414
await _testHelpCommand(['help'],
1515
checkContent: 'Unified interface for running Dart builds.');
1616
await _testHelpCommand(['--help'],
1717
checkContent: 'Unified interface for running Dart builds.');
1818
});
1919

20-
test('pub run build_runner build --help', () async {
20+
test('dart run build_runner build --help', () async {
2121
await _testHelpCommand(['build', '--help'],
2222
checkContent: 'Performs a single build on the specified targets');
2323
await _testHelpCommand(['help', 'build'],
2424
checkContent: 'Performs a single build on the specified targets');
2525
});
2626

27-
test('pub run build_runner serve --help', () async {
27+
test('dart run build_runner serve --help', () async {
2828
await _testHelpCommand(['serve', '--help'],
2929
checkContent: 'Runs a development server');
3030
await _testHelpCommand(['help', 'serve'],
3131
checkContent: 'Runs a development server');
3232
});
3333

34-
test('pub run build_runner test --help', () async {
34+
test('dart run build_runner test --help', () async {
3535
await _testHelpCommand(['test', '--help'],
3636
checkContent: 'and then runs tests using');
3737
await _testHelpCommand(['help', 'test'],
3838
checkContent: 'and then runs tests using');
3939
});
4040

41-
test('pub run build_runner watch --help', () async {
41+
test('dart run build_runner watch --help', () async {
4242
await _testHelpCommand(['watch', '--help'],
4343
checkContent: 'watching the file system for updates');
4444
await _testHelpCommand(['help', 'watch'],

_test_null_safety/mono_pkg.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ stages:
1212
dart: dev
1313
- e2e_test:
1414
- group:
15-
- command: pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random
16-
- command: pub run build_runner test --define="build_web_compilers:entrypoint=compiler=dart2js" -- -p chrome --test-randomize-ordering-seed=random
15+
- command: dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random
16+
- command: dart run build_runner test --define="build_web_compilers:entrypoint=compiler=dart2js" -- -p chrome --test-randomize-ordering-seed=random
1717
# This stage is configured to only run for scheduled builds (see mono_repo.yaml)
1818
- e2e_test_cron:
1919
- group:
20-
- command: pub run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random
21-
- command: pub run build_runner test --define="build_web_compilers:entrypoint=compiler=dart2js" -- -p chrome --test-randomize-ordering-seed=random
20+
- command: dart run build_runner test -- -p chrome,vm --test-randomize-ordering-seed=random
21+
- command: dart run build_runner test --define="build_web_compilers:entrypoint=compiler=dart2js" -- -p chrome --test-randomize-ordering-seed=random
2222
dart:
2323
- be/raw/latest

build_runner/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 2.1.2-dev
2+
13
## 2.1.1
24

35
- Don't rethrow file watcher errors - instead log at severe level and continue

0 commit comments

Comments
 (0)