Skip to content

Commit 25f6b06

Browse files
committed
Merge in changes from dart-lang#1954
1 parent 35fa34b commit 25f6b06

File tree

3 files changed

+58
-36
lines changed

3 files changed

+58
-36
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// INSTRUCTIONS:
6+
7+
// Builds the unminifed dart2js extension (see DDC issue:
8+
// see DDC issue: https://github.com/dart-lang/sdk/issues/49869).
9+
10+
// Run from the extension root directory:
11+
// - For dev: dart run tool/build_extension.dart
12+
// - For prod: dart run tool/build_extension.dart prod
13+
14+
import 'dart:io';
15+
16+
import 'package:args/args.dart';
17+
import 'package:path/path.dart' as p;
18+
19+
const prodFlag = 'prod';
20+
21+
void main(List<String> arguments) {
22+
exitCode = 0; // presume success
23+
final parser = ArgParser()
24+
..addFlag(prodFlag, negatable: true, defaultsTo: false);
25+
final argResults = parser.parse(arguments);
26+
27+
run(isProd: argResults[prodFlag] as bool);
28+
}
29+
30+
Future<void> run({required bool isProd}) async {
31+
logInfo('Building extension for ${isProd ? 'prod' : 'dev'}');
32+
logInfo('Compiling extension with dart2js to /compiled directory');
33+
logOutput(
34+
await Process.run(
35+
'dart',
36+
['run', 'build_runner', 'build', 'web', '--output', 'build', '--release'],
37+
),
38+
);
39+
logInfo('Updating manifest.json in /compiled directory.');
40+
logOutput(
41+
await Process.run(
42+
'dart',
43+
[p.join('tool', 'update_dev_files.dart')],
44+
),
45+
);
46+
}
47+
48+
void logInfo(String message) {
49+
print('[BUILD STEP] $message');
50+
}
51+
52+
void logOutput(ProcessResult result) {
53+
final output = result.stdout;
54+
final outputList = output is List ? output : [output ?? ''];
55+
print(outputList.map((output) => '$output').join('\n'));
56+
}

dwds/debug_extension_mv3/tool/build_extension.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

dwds/test/puppeteer/test_utils.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ import '../fixtures/utilities.dart';
1313

1414
Future<String> buildDebugExtension() async {
1515
final extensionDir = absolutePath(pathFromDwds: 'debug_extension_mv3');
16-
// TODO(elliette): This doesn't work on Windows, see https://github.com/dart-lang/webdev/issues/1724.
1716
await Process.run(
18-
p.join('tool', 'build_extension.sh'),
19-
[],
17+
'dart',
18+
[p.join('tool', 'build_extension.dart')],
2019
workingDirectory: extensionDir,
2120
);
2221
return p.join(extensionDir, 'compiled');

0 commit comments

Comments
 (0)