Skip to content
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

expose librariesPath in DevCompilerBuilder #2404

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build_web_compilers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.0

- Make `librariesPath` configurable in `DevCompilerBuilder`.
jakemac53 marked this conversation as resolved.
Show resolved Hide resolved

## 2.1.5

- Add pre-emptive support for an upcoming breaking change in ddc
Expand Down
20 changes: 17 additions & 3 deletions build_web_compilers/lib/src/dev_compiler_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,21 @@ class DevCompilerBuilder implements Builder {
/// directory, which contains the platform kernel files.
final String platformSdk;

/// The absolute path to the libraries file for the current platform.
///
/// If not provided, defaults to "lib/libraries.json" in the sdk directory.
final String librariesPath;
jakemac53 marked this conversation as resolved.
Show resolved Hide resolved

DevCompilerBuilder(
{bool useIncrementalCompiler,
@required this.platform,
this.sdkKernelPath,
String librariesPath,
String platformSdk})
: useIncrementalCompiler = useIncrementalCompiler ?? true,
platformSdk = platformSdk ?? sdkDir,
librariesPath = librariesPath ??
p.join(platformSdk ?? sdkDir, 'lib', 'libraries.json'),
buildExtensions = {
moduleExtension(platform): [
jsModuleExtension,
Expand Down Expand Up @@ -77,7 +85,7 @@ class DevCompilerBuilder implements Builder {

try {
await _createDevCompilerModule(module, buildStep, useIncrementalCompiler,
platformSdk, sdkKernelPath);
platformSdk, sdkKernelPath, librariesPath);
} on DartDevcCompilationException catch (e) {
await handleError(e);
} on MissingModulesException catch (e) {
Expand All @@ -87,8 +95,13 @@ class DevCompilerBuilder implements Builder {
}

/// Compile [module] with the dev compiler.
Future<void> _createDevCompilerModule(Module module, BuildStep buildStep,
bool useIncrementalCompiler, String dartSdk, String sdkKernelPath,
Future<void> _createDevCompilerModule(
Module module,
BuildStep buildStep,
bool useIncrementalCompiler,
String dartSdk,
String sdkKernelPath,
String librariesPath,
{bool debugMode = true}) async {
var transitiveDeps = await buildStep.trackStage('CollectTransitiveDeps',
() => module.computeTransitiveDependencies(buildStep));
Expand Down Expand Up @@ -122,6 +135,7 @@ Future<void> _createDevCompilerModule(Module module, BuildStep buildStep,
'--multi-root=.',
'--track-widget-creation',
'--inline-source-map',
'--libraries-file=${p.toUri(librariesPath)}',
if (useIncrementalCompiler) ...[
'--reuse-compiler-result',
'--use-incremental-compiler',
Expand Down
2 changes: 1 addition & 1 deletion build_web_compilers/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_web_compilers
version: 2.1.5
version: 2.2.0
description: Builder implementations wrapping Dart compilers.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_web_compilers
Expand Down