Index: sdk/lib/_internal/pub/lib/src/dart.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart |
index 9e84360a24a67a59a4be60e1b020754f788c0bce..17162ce3fd497ede00d55389ae6fd1ff3b966d4a 100644 |
--- a/sdk/lib/_internal/pub/lib/src/dart.dart |
+++ b/sdk/lib/_internal/pub/lib/src/dart.dart |
@@ -18,7 +18,6 @@ import '../../../compiler/implementation/filenames.dart' |
import '../../asset/dart/serialize.dart'; |
import 'io.dart'; |
-import 'sdk.dart' as sdk; |
import 'utils.dart'; |
/// Interface to communicate with dart2js. |
@@ -28,6 +27,12 @@ import 'utils.dart'; |
/// [compiler.DiagnosticHandler] function types so that we can provide them |
/// as a single unit. |
abstract class CompilerProvider { |
+ /// The URI to the root directory where "dart:" libraries can be found. |
+ /// |
+ /// This is used as the base URL to generate library URLs that are then sent |
+ /// back to [provideInput]. |
+ Uri get libraryRoot; |
+ |
/// Given [uri], responds with a future that completes to the contents of |
/// the input file at that URI. |
/// |
@@ -93,7 +98,7 @@ Future compile(String entrypoint, CompilerProvider provider, { |
return Chain.track(compiler.compile( |
path.toUri(entrypoint), |
- path.toUri(appendSlash(_libPath)), |
+ provider.libraryRoot, |
path.toUri(appendSlash(packageRoot)), |
provider.provideInput, |
provider.handleDiagnostic, |
@@ -103,15 +108,6 @@ Future compile(String entrypoint, CompilerProvider provider, { |
}); |
} |
-/// Returns the path to the directory containing the Dart core libraries. |
-/// |
-/// This corresponds to the "sdk" directory in the repo and to the root of the |
-/// compiled SDK. |
-String get _libPath { |
- if (runningFromSdk) return sdk.rootDirectory; |
- return path.join(repoRoot, 'sdk'); |
-} |
- |
/// Returns whether [dart] looks like an entrypoint file. |
bool isEntrypoint(CompilationUnit dart) { |
// Allow two or fewer arguments so that entrypoints intended for use with |