[CFE] Remove many uses of .packages files in tests

Change-Id: I9c74b373d087984498debd987df55520c33ad1af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249190
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen
2022-06-22 07:34:49 +00:00
committed by Commit Bot
parent 8818828ff6
commit ac586ff2a6
61 changed files with 1170 additions and 245 deletions
@@ -0,0 +1,4 @@
{
"configVersion": 2,
"packages": []
}
@@ -1 +0,0 @@
# dummy
@@ -0,0 +1,9 @@
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
@@ -1 +0,0 @@
foo:.
@@ -0,0 +1,9 @@
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
@@ -0,0 +1,9 @@
{
"configVersion": 2,
"packages": [
{
"name": "foobar",
"rootUri": ".."
}
]
}
@@ -33,7 +33,7 @@ Future<void> main(List<String> args) async {
Uri packageConfigUri = repoDir.resolve(".dart_tool/package_config.json");
if (!new File.fromUri(packageConfigUri).existsSync()) {
throw "Couldn't find .packages";
throw "Couldn't find .dart_tool/package_config.json";
}
compilerOptions.packagesFileUri = packageConfigUri;
+7 -8
View File
@@ -785,14 +785,13 @@ class Compile extends Step<Example?, Null, MessageTestSuite> {
Uri output =
suite.fileSystem.currentDirectory.resolve("$dir/main.dart.dill");
// Setup .packages if it (or package_config.json) doesn't exist.
Uri dotPackagesUri =
suite.fileSystem.currentDirectory.resolve("$dir/.packages");
Uri packageConfigJsonUri = suite.fileSystem.currentDirectory
// Setup .dart_tool/package_config.json if it doesn't exist.
Uri packageConfigUri = suite.fileSystem.currentDirectory
.resolve("$dir/.dart_tool/package_config.json");
if (!await suite.fileSystem.entityForUri(dotPackagesUri).exists() &&
!await suite.fileSystem.entityForUri(packageConfigJsonUri).exists()) {
suite.fileSystem.entityForUri(dotPackagesUri).writeAsBytesSync([]);
if (!await suite.fileSystem.entityForUri(packageConfigUri).exists()) {
suite.fileSystem
.entityForUri(packageConfigUri)
.writeAsStringSync('{"configVersion": 2, "packages": []}');
}
print("Compiling $main");
@@ -805,7 +804,7 @@ class Compile extends Step<Example?, Null, MessageTestSuite> {
..explicitExperimentalFlags = example.experimentalFlags ?? {}
..target = new VmTarget(new TargetFlags())
..fileSystem = new HybridFileSystem(suite.fileSystem)
..packagesFileUri = dotPackagesUri
..packagesFileUri = packageConfigUri
..onDiagnostic = messages.add
..environmentDefines = const {}),
main,
@@ -182,7 +182,7 @@ Future<void> main(List<String> args) async {
"--output-dill",
"$rootPath/flutter_server_tmp.dill",
"--packages",
"$rootPath/gallery/.packages",
"$rootPath/gallery/.dart_tool/package_config.json",
"-Ddart.vm.profile=false",
"-Ddart.vm.product=false",
"--enable-asserts",
@@ -0,0 +1,9 @@
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": "../lib"
}
]
}
+5 -7
View File
@@ -400,7 +400,7 @@ Future<Null> basicTest(YamlMap sourceFiles, String entryPoint,
invalidateFilenames.remove(filename);
}
String source = sourceFiles[filename];
if (filename == ".packages") {
if (filename == ".dart_tool/package_config.json") {
packagesUri = uri;
}
File file = new File.fromUri(uri);
@@ -477,7 +477,7 @@ Future<Map<String, List<int>>> createModules(
Uri? packagesUri;
for (String filename in module[moduleName].keys) {
Uri uri = base.resolve(filename);
if (uri.pathSegments.last == ".packages") {
if (uri.pathSegments.last == "package_config.json") {
packagesUri = uri;
} else {
moduleSources.add(uri);
@@ -683,9 +683,7 @@ class NewWorldTest {
for (String filename in sourceFiles.keys) {
String data = sourceFiles[filename] ?? "";
Uri uri = base.resolve(filename);
if (filename == ".packages") {
packagesUri = uri;
} else if (filename == ".dart_tool/package_config.json") {
if (filename == ".dart_tool/package_config.json") {
packagesUri = uri;
}
if (world["enableStringReplacement"] == true) {
@@ -693,8 +691,8 @@ class NewWorldTest {
}
fs.entityForUri(uri).writeAsStringSync(data);
}
if (world["dotPackagesFile"] != null) {
packagesUri = base.resolve(world["dotPackagesFile"]);
if (world["packageConfigFile"] != null) {
packagesUri = base.resolve(world["packageConfigFile"]);
}
if (brandNewWorld) {
+8 -8
View File
@@ -167,23 +167,23 @@ class LintStep extends Step<LintTestDescription, LintTestDescription, Context> {
description.cache.firstToken = scanner.tokenize();
description.cache.lineStarts = scanner.lineStarts;
Uri dotPackages =
Uri packageConfig =
description.uri.resolve(".dart_tool/package_config.json");
while (true) {
if (new File.fromUri(dotPackages).existsSync()) {
if (new File.fromUri(packageConfig).existsSync()) {
break;
}
// Stupid bailout.
if (dotPackages.pathSegments.length < Uri.base.pathSegments.length) {
if (packageConfig.pathSegments.length < Uri.base.pathSegments.length) {
break;
}
dotPackages =
dotPackages.resolve("../../.dart_tool/package_config.json");
packageConfig =
packageConfig.resolve("../../.dart_tool/package_config.json");
}
File dotPackagesFile = new File.fromUri(dotPackages);
if (dotPackagesFile.existsSync()) {
description.cache.packages = await loadPackageConfigUri(dotPackages);
File packageConfigUri = new File.fromUri(packageConfig);
if (packageConfigUri.existsSync()) {
description.cache.packages = await loadPackageConfigUri(packageConfig);
}
}
@@ -100,7 +100,7 @@ class OutlineExtractorStep
@override
Future<Result<TestDescription>> run(
TestDescription description, Context context) async {
Uri? packages = description.uri.resolve(".packages");
Uri? packages = description.uri.resolve(".dart_tool/package_config.json");
if (!new File.fromUri(packages).existsSync()) {
packages = null;
}
@@ -141,7 +141,7 @@ class CompileAndCompareStep
@override
Future<Result<TestDescription>> run(
TestDescription description, Context context) async {
Uri? packages = description.uri.resolve(".packages");
Uri? packages = description.uri.resolve(".dart_tool/package_config.json");
if (!new File.fromUri(packages).existsSync()) {
packages = null;
}
@@ -22,8 +22,16 @@ modules:
b() {
a();
}
example_0.1.0/.packages: |
example:.
example_0.1.0/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": ".."
}
]
}
example_0.1.1:
example_0.1.1/b.dart: |
// @dart=2.9
@@ -31,8 +39,16 @@ modules:
print("Hello from v0.1.1");
}
bool example011 = true;
example_0.1.1/.packages: |
example:.
example_0.1.1/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": ".."
}
]
}
foo_1:
foo_1/foo.dart: |
// @dart=2.9
@@ -42,9 +58,20 @@ modules:
b();
}
bool foo1 = true;
foo_1/.packages: |
foo:.
example:../example_0.1.0
foo_1/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
},
{
"name": "example",
"rootUri": "../../example_0.1.0"
}
]
}
foo_2:
foo_2/foo.dart: |
// @dart=2.9
@@ -68,9 +95,20 @@ modules:
baz() {
print("hello from baz");
}
foo_2/.packages: |
foo:.
example:../example_0.1.1
foo_2/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
},
{
"name": "example",
"rootUri": "../../example_0.1.1"
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -82,7 +120,16 @@ worlds:
print("hello");
b();
}
.packages: example:example_0.1.0
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../example_0.1.0"
}
]
}
modules:
- example_0.1.0
expectedLibraryCount: 3
@@ -108,9 +155,20 @@ worlds:
print("hello");
foo();
}
.packages: |
example:example_0.1.0
foo:foo_1
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../example_0.1.0"
},
{
"name": "foo",
"rootUri": "../foo_1"
}
]
}
modules:
- example_0.1.0
- foo_1
@@ -139,9 +197,20 @@ worlds:
print("hello");
foo();
}
.packages: |
example:example_0.1.1
foo:foo_2
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../example_0.1.1"
},
{
"name": "foo",
"rootUri": "../foo_2"
}
]
}
modules:
- example_0.1.1
- foo_2
@@ -18,8 +18,16 @@ modules:
module/b.dart: |
// @dart=2.9
class B { }
module/.packages: |
module:.
module/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": ".."
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -28,8 +36,16 @@ worlds:
// @dart=2.9
import 'package:module/a.dart';
class Foo extends A {}
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 3
@@ -18,8 +18,16 @@ modules:
module/b.dart: |
// @dart=2.9
class B { }
module/.packages: |
module:.
module/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": ".."
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -28,8 +36,16 @@ worlds:
// @dart=2.9
import 'package:module/a.dart';
class Foo extends A {}
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 3
@@ -24,8 +24,16 @@ modules:
// @dart=2.9
import 'package:module/c.dart';
class D { }
module/.packages: |
module:.
module/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": ".."
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -33,8 +41,16 @@ worlds:
main.dart: |
// @dart=2.9
class Foo {}
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 1
@@ -14,8 +14,16 @@ modules:
class B { }
class C { }
class AB = A with B;
module/.packages: |
module:.
module/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": ".."
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -24,8 +32,16 @@ worlds:
// @dart=2.9
import "package:module/a.dart";
class ABC = AB with C;
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 2
@@ -12,16 +12,37 @@ target: DDC
modules:
moduleC:
moduleC/lib.dart: |
// @dart=2.9
const constC = ['value_c'];
moduleC/.packages: |
moduleC:.
moduleC/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleC",
"rootUri": ".."
}
]
}
moduleB:
moduleB/lib.dart: |
// @dart=2.9
import "package:moduleC/lib.dart";
const constB = ['value_b', constC];
moduleB/.packages: |
moduleB:.
moduleC:../moduleC
moduleB/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": ".."
},
{
"name": "moduleC",
"rootUri": "../../moduleC"
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -33,9 +54,20 @@ worlds:
const constLib = constFromLib;
lib.dart: |
const constFromLib = 42;
.packages: |
moduleB:moduleB
moduleC:moduleC
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": "../moduleB"
},
{
"name": "moduleC",
"rootUri": "../moduleC"
}
]
}
modules:
- moduleB
- moduleC
@@ -12,16 +12,37 @@ target: DDC
modules:
moduleC:
moduleC/lib.dart: |
// @dart=2.9
const constC = true;
moduleC/.packages: |
moduleC:.
moduleC/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleC",
"rootUri": ".."
}
]
}
moduleB:
moduleB/lib.dart: |
// @dart=2.9
import "package:moduleC/lib.dart";
const constB = false || constC;
moduleB/.packages: |
moduleB:.
moduleC:../moduleC
moduleB/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": ".."
},
{
"name": "moduleC",
"rootUri": "../../moduleC"
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -29,9 +50,20 @@ worlds:
main.dart: |
import 'package:moduleB/lib.dart';
const constA = true && constB;
.packages: |
moduleB:moduleB
moduleC:moduleC
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": "../moduleB"
},
{
"name": "moduleC",
"rootUri": "../moduleC"
}
]
}
modules:
- moduleB
- moduleC
@@ -12,22 +12,50 @@ modules:
// @dart=2.9
a() {}
var example = true;
example_1/.packages: |
example:.
example_1/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": ".."
}
]
}
example_2:
example_2/a.dart: |
// @dart=2.9
a() {}
var example = true;
example_2/.packages: |
example:.
example_2/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": ".."
}
]
}
foo:
foo/foo.dart: |
// @dart=2.9
export "package:example/a.dart";
var foo = true;
foo/.packages: |
foo:.
example:../example_1
foo/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
},
{
"name": "example",
"rootUri": "../../example_1"
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -38,9 +66,20 @@ worlds:
print("hello");
a();
}
.packages: |
foo:foo
example:example_1
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": "../foo"
},
{
"name": "example",
"rootUri": "../../example_1"
}
]
}
modules:
- foo
- example_1
@@ -60,9 +99,20 @@ worlds:
worldType: updated
expectInitializeFromDill: false
sources:
.packages: |
foo:foo
example:example_2
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": "../foo"
},
{
"name": "example",
"rootUri": "../../example_2"
}
]
}
modules:
- foo
- example_2
@@ -11,14 +11,30 @@ modules:
foo/foo.dart: |
// @dart=2.9
var foo = true;
foo/.packages: |
foo:.
foo/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
foo2:
foo2/foo.dart: |
// @dart=2.9
var foo2 = true;
foo2/.packages: |
foo:.
foo2/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -30,8 +46,16 @@ worlds:
main() {
print(foo);
}
.packages: |
foo:foo
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": "../foo"
}
]
}
modules:
- foo
expectedLibraryCount: 2
@@ -55,8 +79,16 @@ worlds:
main() {
print(foo2);
}
.packages: |
foo:foo2
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": "../foo2"
}
]
}
modules:
- foo2
expectedLibraryCount: 2
@@ -19,10 +19,24 @@ modules:
class A2 extends A3 {
int bar = 42;
}
moduleB/.packages: |
moduleB:.
moduleC:../moduleC
moduleD:../moduleD
moduleB/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": ".."
},
{
"name": "moduleC",
"rootUri": "../../moduleC"
},
{
"name": "moduleD",
"rootUri": "../../moduleD"
}
]
}
moduleC:
moduleC/c.dart: |
// @dart=2.9
@@ -34,15 +48,34 @@ modules:
class A3 {
int foo = 42;
}
moduleC/.packages: |
moduleC:.
moduleD:../moduleD
moduleC/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleC",
"rootUri": ".."
},
{
"name": "moduleD",
"rootUri": "../../moduleD"
}
]
}
moduleD:
moduleD/d.dart: |
// @dart=2.9
String baz3 = "baz3";
moduleD/.packages: |
moduleD:.
moduleD/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleD",
"rootUri": ".."
}
]
}
worlds:
- entry: a.dart
fromComponent: true
@@ -53,10 +86,24 @@ worlds:
String foo = baz;
var x = mya2.bar;
.packages: |
moduleB:moduleB
moduleC:moduleC
moduleD:moduleD
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": "../moduleB"
},
{
"name": "moduleC",
"rootUri": "../moduleC"
},
{
"name": "moduleD",
"rootUri": "../moduleD"
}
]
}
modules:
- moduleB
- moduleC
@@ -20,10 +20,24 @@ modules:
class A2 extends A3 {
int bar = 42;
}
moduleB/.packages: |
moduleB:.
moduleC:../moduleC
moduleD:../moduleD
moduleB/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": ".."
},
{
"name": "moduleC",
"rootUri": "../../moduleC"
},
{
"name": "moduleD",
"rootUri": "../../moduleD"
}
]
}
moduleC:
moduleC/c.dart: |
// @dart=2.9
@@ -35,15 +49,34 @@ modules:
class A3 {
int foo = 42;
}
moduleC/.packages: |
moduleC:.
moduleD:../moduleD
moduleC/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleC",
"rootUri": ".."
},
{
"name": "moduleD",
"rootUri": "../../moduleD"
}
]
}
moduleD:
moduleD/d.dart: |
// @dart=2.9
String baz3 = "baz3";
moduleD/.packages: |
moduleD:.
moduleD/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleD",
"rootUri": ".."
}
]
}
worlds:
- entry: a.dart
fromComponent: true
@@ -54,10 +87,24 @@ worlds:
var foo = bVar;
var foo2 = bVarFromC;
.packages: |
moduleB:moduleB
moduleC:moduleC
moduleD:moduleD
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": "../moduleB"
},
{
"name": "moduleC",
"rootUri": "../moduleC"
},
{
"name": "moduleD",
"rootUri": "../moduleD"
}
]
}
modules:
- moduleB
- moduleC
@@ -20,10 +20,24 @@ modules:
class A2 extends A3 {
int bar = 42;
}
moduleB/.packages: |
moduleB:.
moduleC:../moduleC
moduleD:../moduleD
moduleB/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": ".."
},
{
"name": "moduleC",
"rootUri": "../../moduleC"
},
{
"name": "moduleD",
"rootUri": "../../moduleD"
}
]
}
moduleC:
moduleC/c.dart: |
// @dart=2.9
@@ -35,15 +49,34 @@ modules:
class A3 {
int foo = 42;
}
moduleC/.packages: |
moduleC:.
moduleD:../moduleD
moduleC/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleC",
"rootUri": ".."
},
{
"name": "moduleD",
"rootUri": "../../moduleD"
}
]
}
moduleD:
moduleD/d.dart: |
// @dart=2.9
String baz3 = "baz3";
moduleD/.packages: |
moduleD:.
moduleD/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleD",
"rootUri": ".."
}
]
}
worlds:
- entry: a.dart
fromComponent: true
@@ -58,10 +91,24 @@ worlds:
class A1 extends A2 {
String fooMethod() => "42!";
}
.packages: |
moduleB:moduleB
moduleC:moduleC
moduleD:moduleD
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": "../moduleB"
},
{
"name": "moduleC",
"rootUri": "../moduleC"
},
{
"name": "moduleD",
"rootUri": "../moduleD"
}
]
}
modules:
- moduleB
- moduleC
@@ -36,9 +36,18 @@ modules:
String str() {}
}
module/lib4.dart: |
// @dart=2.9
class Class4 {}
module/.packages: |
module:.
module/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": ".."
}
]
}
worlds:
- entry: compileme.dart
fromComponent: true
@@ -60,8 +69,16 @@ worlds:
return class1;
}
}
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 5
@@ -105,8 +122,16 @@ worlds:
return class1;
}
}
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 5
@@ -31,8 +31,16 @@ modules:
class XIdentityHashSet implements XLinkedHashSet {
XIdentityHashSet();
}
module/.packages: |
module:.
module/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": ".."
}
]
}
worlds:
- entry: compileme.dart
fromComponent: true
@@ -44,8 +52,16 @@ worlds:
main() {
XSet history = new XSet.identity();
}
.packages: |
module:module
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "module",
"rootUri": "../module"
}
]
}
modules:
- module
expectedLibraryCount: 4
@@ -14,17 +14,36 @@ modules:
export 'package:moduleB/b.dart';
class A { }
moduleA/.packages: |
moduleA:.
moduleB:../moduleB
moduleA/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleA",
"rootUri": ".."
},
{
"name": "moduleB",
"rootUri": "../../moduleB"
}
]
}
moduleB:
moduleB/b.dart: |
// @dart=2.9
class B {
int foo = 42;
}
moduleB/.packages: |
moduleB:.
moduleB/.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleB",
"rootUri": ".."
}
]
}
worlds:
- entry: main.dart
fromComponent: true
@@ -36,9 +55,20 @@ worlds:
main() {
A a = new A();
}
.packages: |
moduleA:moduleA
moduleB:moduleB
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "moduleA",
"rootUri": "../moduleA"
},
{
"name": "moduleB",
"rootUri": "../moduleB"
}
]
}
modules:
- moduleA
- moduleB
@@ -2,16 +2,25 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a package. Update the world so that the .packages
# no longer reference the package (and the source no longe ruse it) and
# recompile. The now no longer referenced package library should also have been
# removed from the uri to sources.
# Compile an application with a package. Update the world so that the
# .dart_tool/package_config.json no longer reference the package (and the source
# no longer use it) and recompile. The now no longer referenced package library
# should also have been removed from the uri to sources.
type: newworld
worlds:
- entry: main.dart
sources:
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
main.dart: |
// @dart=2.9
import "package:example/b.dart";
@@ -24,10 +33,14 @@ worlds:
worldType: updated
invalidate:
- main.dart
- .packages
- .dart_tool/package_config.json
expectInitializeFromDill: false
sources:
.packages:
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": []
}
main.dart: |
// @dart=2.9
main() {}
@@ -3,8 +3,8 @@
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a package and use it.
# Then remove the package from .packages and remove any use of it.
# The package is still included in the dill file we initialize from,
# Then remove the package from .dart_tool/package_config.json and remove any use
# of it. The package is still included in the dill file we initialize from,
# but shouldn't cause trouble, nor be included in the output.
type: newworld
@@ -23,7 +23,16 @@ worlds:
b() {
print("b");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 2
- entry: main.dart
# TODO(jensj): For now we don't initialize from dill when a package was
@@ -37,5 +46,9 @@ worlds:
main() {
print("hello");
}
.packages:
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": []
}
expectedLibraryCount: 1
@@ -13,7 +13,16 @@ worlds:
// @dart=2.9
main() {
}
.packages: untitled:/
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "untitled",
"rootUri": "/"
}
]
}
expectedLibraryCount: 1
errors: false
warnings: false
@@ -15,7 +15,16 @@ worlds:
main() {
asdf;
}
.packages: untitled:/
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "untitled",
"rootUri": "/"
}
]
}
expectedLibraryCount: 1
errors: true
warnings: false
@@ -12,7 +12,16 @@ worlds:
main.dart: |
// @dart=2.9
notMain() {}
.packages: untitled:/
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "untitled",
"rootUri": "/"
}
]
}
expectedLibraryCount: 1
errors: false
warnings: false
@@ -51,8 +51,16 @@ worlds:
/// Optional locations of the parameters of the member at this location.
final List<_Location> parameterLocations;
}
.packages: |
flutter:flutter/lib
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "flutter",
"rootUri": "../flutter/lib"
}
]
}
expectedLibraryCount: 3
- entry: main.dart
worldType: updated
@@ -34,9 +34,20 @@ worlds:
lib3() {
return lib1();
}
.packages: |
package1:package1
package2:package2
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "package1",
"rootUri": "../package1"
},
{
"name": "package2",
"rootUri": "../package2"
}
]
}
expectedLibraryCount: 4
incrementalSerializationDoesWork: true
- entry: main.dart
@@ -36,8 +36,16 @@ worlds:
lib3() {
return lib1();
}
.packages: |
package1:package1
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "package1",
"rootUri": "../package1"
}
]
}
expectedLibraryCount: 4
incrementalSerializationDoesWork: true
- entry: main.dart
@@ -46,10 +46,24 @@ worlds:
lib3() {
print("lib3");
}
.packages: |
package1:package1
package2:package2
package3:package3
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "package1",
"rootUri": "../package1"
},
{
"name": "package2",
"rootUri": "../package2"
},
{
"name": "package3",
"rootUri": "../package3"
}
]
}
expectedLibraryCount: 5
incrementalSerializationDoesWork: true
- entry: main.dart
@@ -89,9 +103,23 @@ worlds:
lib3() {
print("lib3");
}
.packages: |
package1:package1
package2:package2
package3:package3
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "package1",
"rootUri": "../package1"
},
{
"name": "package2",
"rootUri": "../package2"
},
{
"name": "package3",
"rootUri": "../package3"
}
]
}
expectedLibraryCount: 5
incrementalSerializationDoesWork: true
@@ -45,9 +45,20 @@ worlds:
p1();
print("Package 2");
}
.packages: |
package1:package1
package2:package2
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "package1",
"rootUri": "../package1"
},
{
"name": "package2",
"rootUri": "../package2"
}
]
}
expectedLibraryCount: 3
incrementalSerializationDoesWork: true
- entry: main.dart
@@ -86,8 +97,19 @@ worlds:
p1();
print("Package 2");
}
.packages: |
package1:package1v2
package2:package2
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "package1",
"rootUri": "../package1v2"
},
{
"name": "package2",
"rootUri": "../package2"
}
]
}
expectedLibraryCount: 3
incrementalSerializationDoesWork: true
@@ -27,7 +27,16 @@ worlds:
print("Foo!");
}
}
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
expectedLibraryCount: 2
- entry: main.dart
invalidate:
@@ -45,7 +54,16 @@ worlds:
print("Foo!");
}
}
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
expectedLibraryCount: 1
expectInitializeFromDill: true
- entry: main.dart
@@ -22,7 +22,16 @@ worlds:
b() {
print("b1");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 1
- entry: "package:example/main.dart"
invalidate:
@@ -43,7 +52,16 @@ worlds:
b() {
print("b2");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 1
- entry: "package:example/main.dart"
invalidate:
@@ -64,5 +82,14 @@ worlds:
b() {
print("b3");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 1
@@ -21,7 +21,16 @@ worlds:
b() {
print("b1");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 1
- entry: "package:example/main.dart"
worldType: updated
@@ -37,7 +46,16 @@ worlds:
b() {
print("b2");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 1
- entry: "package:example/main.dart"
worldType: updated
@@ -53,5 +71,14 @@ worlds:
b() {
print("b3");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
expectedLibraryCount: 1
@@ -22,4 +22,13 @@ sources:
b() {
print("b1");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
@@ -22,4 +22,13 @@ sources:
b() {
print("b1");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
@@ -23,4 +23,13 @@ sources:
b() {
print("b1");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
@@ -23,4 +23,13 @@ sources:
b() {
print("b1");
}
.packages: example:pkg/example
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../pkg/example"
}
]
}
@@ -22,8 +22,16 @@ worlds:
libMethod() {
print("Hello from lib!");
}
.packages: |
foo:.
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
expectedLibraryCount: 2
- entry: main.dart
warnings: false
@@ -7,8 +7,16 @@ worlds:
- entry: package:foo/main.dart
checkEntries: false
sources:
.packages: |
foo:.
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
main.dart: |
// @dart=2.9
part of 'lib.dart';
@@ -8,8 +8,16 @@ worlds:
warnings: false
checkEntries: false
sources:
.packages: |
foo:.
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
main.dart: |
// @dart=2.9
part of 'lib.dart';
@@ -7,8 +7,16 @@ worlds:
- entry: package:foo/main.dart
errors: true
sources:
.packages: |
foo:.
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "foo",
"rootUri": ".."
}
]
}
main.dart: |
// @dart=2.9
part 'lib.dart';
@@ -10,7 +10,16 @@ type: newworld
worlds:
- entry: main.dart
sources:
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
main.dart: |
// @dart=2.9
import "package:mypackage/a.dart";
@@ -34,7 +43,16 @@ worlds:
expectedLibraryCount: 3
- entry: main.dart
sources:
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
main.dart: |
// @dart=2.9
import "package:mypackage/a.dart";
@@ -10,7 +10,16 @@ type: newworld
worlds:
- entry: main.dart
sources:
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
main.dart: |
// @dart=2.9
import "package:mypackage/a.dart";
@@ -38,7 +47,16 @@ worlds:
expectedLibraryCount: 3
- entry: main.dart
sources:
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
main.dart: |
// @dart=2.9
import "package:mypackage/a.dart";
@@ -10,7 +10,16 @@ type: newworld
worlds:
- entry: main.dart
sources:
.packages: mypackage:mypackage
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "mypackage",
"rootUri": "../mypackage"
}
]
}
main.dart: |
// @dart=2.9
import "package:mypackage/a.dart" as a;
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a package and use it.
# Then update the package from .packages.
# Then update the package from .dart_tool/package_config.json.
# The old package is still included in the dill file we initialize from,
# but shouldn't cause trouble, nor be included in the output.
@@ -32,7 +32,16 @@ worlds:
b() {
a();
}
.packages: example:package_0.1.0
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.0"
}
]
}
expectedLibraryCount: 3
- entry: main.dart
# TODO(jensj): For now we don't initialize from dill when a package was
@@ -67,5 +76,14 @@ worlds:
b() {
print("hello from v0.1.1");
}
.packages: example:package_0.1.1
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.1"
}
]
}
expectedLibraryCount: 2
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a package and use it.
# Then update the package from .packages.
# Then update the package from .dart_tool/package_config.json.
# The old package is still included in the dill file we initialize from,
# but shouldn't cause trouble, nor be included in the output.
@@ -32,7 +32,16 @@ worlds:
b() {
a();
}
.packages: example:package_0.1.0
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.0"
}
]
}
expectedLibraryCount: 3
- entry: main.dart
invalidate:
@@ -66,5 +75,14 @@ worlds:
b() {
print("hello from v0.1.1");
}
.packages: example:package_0.1.1
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.1"
}
]
}
expectedLibraryCount: 2
@@ -3,8 +3,8 @@
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a package and use it.
# Then update the package from .packages but change nothing else and call
# computeDelta on the same compiler.
# Then update the package from .dart_tool/package_config.json but change nothing
# else and call computeDelta on the same compiler.
# The output should not include the old package.
type: newworld
@@ -32,7 +32,16 @@ worlds:
b() {
a();
}
.packages: example:package_0.1.0
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.0"
}
]
}
expectedLibraryCount: 3
- entry: main.dart
worldType: updated
@@ -46,5 +55,14 @@ worlds:
b() {
print("hello from v0.1.1");
}
.packages: example:package_0.1.1
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.1"
}
]
}
expectedLibraryCount: 2
@@ -2,9 +2,9 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a .packages.
# Then delete the content of .packages, still using the package in code.
# This should be an error.
# Compile an application with a .dart_tool/package_config.json.
# Then delete the content of .dart_tool/package_config.json, still using the
# package in code. This should be an error.
type: newworld
worlds:
@@ -22,15 +22,28 @@ worlds:
b() {
print("hello from package");
}
.packages: example:package
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package"
}
]
}
expectedLibraryCount: 2
- entry: main.dart
worldType: updated
expectInitializeFromDill: false
checkInvalidatedFiles: false
invalidate:
- .packages
- .dart_tool/package_config.json
sources:
.packages:
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": []
}
errors: true
expectedLibraryCount: 1
@@ -2,9 +2,10 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
# Compile an application with a .packages file.
# Then change which file should be the .packages file to use, and everything
# should now be relative to the new .packages file.
# Compile an application with a .dart_tool/package_config.json file.
# Then change which file should be the package_config.json file to
# use, and everything should now be relative to the new
# package_config.json file.
type: newworld
worlds:
@@ -31,7 +32,16 @@ worlds:
b() {
a();
}
.packages: example:package_0.1.0
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.0"
}
]
}
expectedLibraryCount: 3
- entry: main.dart
worldType: updated
@@ -42,6 +52,15 @@ worlds:
b() {
print("hello from v0.1.1");
}
.packages2: example:package_0.1.1
dotPackagesFile: .packages2
.dart_tool/package_config2.json: |
{
"configVersion": 2,
"packages": [
{
"name": "example",
"rootUri": "../package_0.1.1"
}
]
}
packageConfigFile: .dart_tool/package_config2.json
expectedLibraryCount: 2
+2 -2
View File
@@ -90,7 +90,7 @@ Future setup(Uri entryUri) async {
// allowlisting of error messages in the error handler.
..onDiagnostic = onDiagnosticMessageHandler()
..compileSdk = true
..packagesFileUri = Uri.base.resolve('.packages')
..packagesFileUri = Uri.base.resolve('.dart_tool/package_config.json')
..target = createTarget(isFlutter: false);
uriResolver = await new ProcessedOptions(options: options).getUriTranslator();
}
@@ -231,7 +231,7 @@ Future<CompilerResult> generateKernel(Uri entryUri,
..sdkRoot = sdkRoot
..onDiagnostic = onDiagnosticMessageHandler()
..target = createTarget(isFlutter: false)
..packagesFileUri = Uri.base.resolve('.packages')
..packagesFileUri = Uri.base.resolve('.dart_tool/package_config.json')
..compileSdk = compileSdk
..environmentDefines = const {};
if (!compileSdk) {
+3 -3
View File
@@ -215,9 +215,9 @@ class OverlayFileSystem implements FileSystem {
if (uri.isScheme('org-dartlang-overlay')) {
return new OverlayFileSystemEntity(uri, this);
} else if (uri.isScheme('file')) {
// The IKG compiler reads ".packages" which might contain absolute file
// URIs (which it will then try to use on the FS). We therefore replace
// them with overlay-fs URIs as usual.
// The IKG compiler reads ".dart_tool/package_config.json" which might
// contain absolute file URIs (which it will then try to use on the FS).
// We therefore replace them with overlay-fs URIs as usual.
return new OverlayFileSystemEntity(_resolveOverlayUri('$uri'), this);
} else {
throw "Unsupported scheme: ${uri.scheme}."