Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit bb8b96a

Browse files
authored
Fix path for require.js (#118722)
Matches new location in the Dart SDK. https://dart-review.googlesource.com/c/sdk/+/275482 Includes fall back logic so the old file location will continue to be used until the new location change lands. Then we can remove the logic and only use the new location in a future change. Issue: #118119
1 parent ae1cc18 commit bb8b96a

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

packages/flutter_tools/lib/src/test/flutter_web_platform.dart

+25-8
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,31 @@ class FlutterWebPlatform extends PlatformPlugin {
187187
));
188188

189189
/// The require js binary.
190-
File get _requireJs => _fileSystem.file(_fileSystem.path.join(
191-
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
192-
'lib',
193-
'dev_compiler',
194-
'kernel',
195-
'amd',
196-
'require.js',
197-
));
190+
File get _requireJs {
191+
// TODO(nshahan): Remove the initializing function once the file location
192+
// change in the Dart SDK has landed and rolled to the engine
193+
// and flutter repos. There is no long-term need for the
194+
// fallback logic.
195+
// See https://github.com/flutter/flutter/issues/118119
196+
final File oldFile = _fileSystem.file(_fileSystem.path.join(
197+
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
198+
'lib',
199+
'dev_compiler',
200+
'kernel',
201+
'amd',
202+
'require.js',
203+
));
204+
205+
return oldFile.existsSync()
206+
? oldFile
207+
: _fileSystem.file(_fileSystem.path.join(
208+
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
209+
'lib',
210+
'dev_compiler',
211+
'amd',
212+
'require.js',
213+
));
214+
}
198215

199216
/// The ddc to dart stack trace mapper.
200217
File get _stackTraceMapper => _fileSystem.file(_fileSystem.path.join(

0 commit comments

Comments
 (0)