Skip to content

Commit c167ab3

Browse files
authored
Set isWindows to false by default in DDC's bootstrapper for DDC-compiled apps (#4383)
This was causing library maps in DDC's library loader to have both `/` and `\`, invalidating lookups on Windows. We could multiplex between platforms, but sticking to `/` is easier. Related: dart-lang/sdk#62824
1 parent 402553f commit c167ab3

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

build_runner/test/integration_tests/watch_command_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:test/test.dart';
1111
import '../common/common.dart';
1212

1313
void main() async {
14-
test('watch command', () async {
14+
test('watch command', timeout: const Timeout.factor(4), () async {
1515
final pubspecs = await Pubspecs.load();
1616
final tester = BuildRunnerTester(pubspecs);
1717

build_web_compilers/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.4.15
2+
- Normalize URIs in DDC's bootstrapper on Windows to always use forward slashes when running with the DDC Library Bundle module system.
3+
14
## 4.4.14
25
- Update DDC Library Bundle to use path-resolvable module names for sourcemap IDs.
36

build_web_compilers/lib/src/dev_compiler_bootstrap.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'dart:async';
66
import 'dart:collection';
77
import 'dart:convert';
8-
import 'dart:io';
98

109
import 'package:build/build.dart';
1110
import 'package:build_modules/build_modules.dart';
@@ -170,7 +169,6 @@ $librariesString
170169
'packages/build_web_compilers/src/dev_compiler/ddc_module_loader.js',
171170
mainBoostrapperUrl: bootstrapModuleName,
172171
mapperUrl: stackTraceMapperPath,
173-
isWindows: Platform.isWindows,
174172
scriptIdsToPath: modulePaths,
175173
);
176174
bootstrapEndContent = generateDDCLibraryBundleOnLoadEndBootstrap();
@@ -689,7 +687,6 @@ String generateDDCLibraryBundleBootstrapScript({
689687
required String ddcModuleLoaderUrl,
690688
required String mainBoostrapperUrl,
691689
required String mapperUrl,
692-
required bool isWindows,
693690
required Map<String, String> scriptIdsToPath,
694691
}) {
695692
final scriptsJs = StringBuffer();
@@ -753,8 +750,8 @@ $_simpleLoaderScript
753750
let scripts = [${scriptsJs.toString()}];
754751
755752
let loadConfig = new window.\$dartLoader.LoadConfiguration();
756-
// TODO(srujzs): Verify this is sufficient for Windows.
757-
loadConfig.isWindows = $isWindows;
753+
// `isWindows` must be false to avoid appending backlashes to paths.
754+
loadConfig.isWindows = false;
758755
loadConfig.root = trimmedDirectory;
759756
loadConfig.bootstrapScript = scripts[scripts.length - 1];
760757

build_web_compilers/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build_web_compilers
2-
version: 4.4.14
2+
version: 4.4.15
33
description: Builder implementations wrapping the dart2js and DDC compilers.
44
repository: https://github.com/dart-lang/build/tree/master/build_web_compilers
55
resolution: workspace

build_web_compilers/test/ddc_library_bundle_bootstrap_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void main() {
119119
// Imports the dart sdk.
120120
contains('"id": "dart_sdk"'),
121121
isNot(contains('lib/a')),
122+
contains('loadConfig.isWindows = false;'),
122123
]),
123124
),
124125
'a|web/index.digests': decodedMatches(contains('packages/')),

0 commit comments

Comments
 (0)