Stop reading .packages from flutter_tools. (#154912)
This commit is contained in:
parent
15c0ae0e5a
commit
2812d4685c
@ -215,8 +215,9 @@ class Cache {
|
|||||||
/// 1. FLUTTER_ROOT environment variable contains the path.
|
/// 1. FLUTTER_ROOT environment variable contains the path.
|
||||||
/// 2. Platform script is a data URI scheme, returning `../..` to support
|
/// 2. Platform script is a data URI scheme, returning `../..` to support
|
||||||
/// tests run from `packages/flutter_tools`.
|
/// tests run from `packages/flutter_tools`.
|
||||||
/// 3. Platform script is package URI scheme, returning the grandparent directory
|
/// 3. Platform script is package URI scheme, returning the grandgrandparent
|
||||||
/// of the package config file location from `packages/flutter_tools/.packages`.
|
/// directory of the package config file location from
|
||||||
|
/// `packages/flutter_tools/.dart_tool/package_config.json`.
|
||||||
/// 4. Platform script file path is the snapshot path generated by `bin/flutter`,
|
/// 4. Platform script file path is the snapshot path generated by `bin/flutter`,
|
||||||
/// returning the grandparent directory from `bin/cache`.
|
/// returning the grandparent directory from `bin/cache`.
|
||||||
/// 5. Platform script file name is the entrypoint in `packages/flutter_tools/bin/flutter_tools.dart`,
|
/// 5. Platform script file name is the entrypoint in `packages/flutter_tools/bin/flutter_tools.dart`,
|
||||||
@ -246,7 +247,7 @@ class Cache {
|
|||||||
final String packageConfigPath = Uri.parse(platform.packageConfig!).toFilePath(
|
final String packageConfigPath = Uri.parse(platform.packageConfig!).toFilePath(
|
||||||
windows: platform.isWindows,
|
windows: platform.isWindows,
|
||||||
);
|
);
|
||||||
return normalize(dirname(dirname(dirname(packageConfigPath))));
|
return normalize(dirname(dirname(dirname(dirname(packageConfigPath)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform.script.scheme == 'file') {
|
if (platform.script.scheme == 'file') {
|
||||||
|
@ -33,12 +33,6 @@ File? findPackageConfigFile(Directory dir) {
|
|||||||
if (candidatePackageConfigFile.existsSync()) {
|
if (candidatePackageConfigFile.existsSync()) {
|
||||||
return candidatePackageConfigFile;
|
return candidatePackageConfigFile;
|
||||||
}
|
}
|
||||||
// TODO(sigurdm): we should not need to check this file, it is obsolete,
|
|
||||||
// https://github.com/flutter/flutter/issues/150908.
|
|
||||||
final File candidatePackagesFile = candidateDir.childFile('.packages');
|
|
||||||
if (candidatePackagesFile.existsSync()) {
|
|
||||||
return candidatePackagesFile;
|
|
||||||
}
|
|
||||||
final Directory parentDir = candidateDir.parent;
|
final Directory parentDir = candidateDir.parent;
|
||||||
if (fileSystem.identicalSync(parentDir.path, candidateDir.path)) {
|
if (fileSystem.identicalSync(parentDir.path, candidateDir.path)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -98,7 +98,7 @@ void main() {
|
|||||||
// Sets up the minimal mock project files necessary to look like a Flutter project.
|
// Sets up the minimal mock project files necessary to look like a Flutter project.
|
||||||
void createCoreMockProjectFiles() {
|
void createCoreMockProjectFiles() {
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ void main() {
|
|||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ void main() {
|
|||||||
// Sets up the minimal mock project files necessary to look like a Flutter project.
|
// Sets up the minimal mock project files necessary to look like a Flutter project.
|
||||||
void createCoreMockProjectFiles() {
|
void createCoreMockProjectFiles() {
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ void main() {
|
|||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ void main() {
|
|||||||
// Creates the mock files necessary to look like a Flutter project.
|
// Creates the mock files necessary to look like a Flutter project.
|
||||||
void setUpMockCoreProjectFiles() {
|
void setUpMockCoreProjectFiles() {
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,7 +664,7 @@ project(runner LANGUAGES CXX)
|
|||||||
set(BINARY_NAME "fizz_bar")
|
set(BINARY_NAME "fizz_bar")
|
||||||
''');
|
''');
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||||
|
|
||||||
expect(getCmakeExecutableName(flutterProject.linux), 'fizz_bar');
|
expect(getCmakeExecutableName(flutterProject.linux), 'fizz_bar');
|
||||||
|
@ -47,7 +47,7 @@ void main() {
|
|||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('name: foo\n');
|
..writeAsStringSync('name: foo\n');
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('web', 'index.html')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('web', 'index.html')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
artifacts = Artifacts.test(fileSystem: fileSystem);
|
artifacts = Artifacts.test(fileSystem: fileSystem);
|
||||||
@ -430,10 +430,28 @@ void setupFileSystemForEndToEndTest(FileSystem fileSystem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Project files.
|
// Project files.
|
||||||
fileSystem.file('.packages')
|
fileSystem
|
||||||
.writeAsStringSync('''
|
.directory('.dart_tool')
|
||||||
foo:lib/
|
.childFile('package_config.json')
|
||||||
fizz:bar/lib/
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "foo",
|
||||||
|
"rootUri": "../",
|
||||||
|
"packageUri": "lib/",
|
||||||
|
"languageVersion": "3.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fizz",
|
||||||
|
"rootUri": "../bar",
|
||||||
|
"packageUri": "lib/",
|
||||||
|
"languageVersion": "3.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configVersion": 2
|
||||||
|
}
|
||||||
''');
|
''');
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
.writeAsStringSync('''
|
.writeAsStringSync('''
|
||||||
|
@ -65,7 +65,7 @@ void main() {
|
|||||||
// Creates the mock files necessary to look like a Flutter project.
|
// Creates the mock files necessary to look like a Flutter project.
|
||||||
void setUpMockCoreProjectFiles() {
|
void setUpMockCoreProjectFiles() {
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,13 @@ void main() {
|
|||||||
|
|
||||||
expect(projectUnderTest.flutterPluginsFile, isNot(exists));
|
expect(projectUnderTest.flutterPluginsFile, isNot(exists));
|
||||||
expect(projectUnderTest.flutterPluginsDependenciesFile, isNot(exists));
|
expect(projectUnderTest.flutterPluginsDependenciesFile, isNot(exists));
|
||||||
expect(projectUnderTest.directory.childFile('.packages'), isNot(exists));
|
expect(
|
||||||
|
projectUnderTest
|
||||||
|
.directory
|
||||||
|
.childDirectory('.dart_tool')
|
||||||
|
.childFile('package_config.json'),
|
||||||
|
isNot(exists),
|
||||||
|
);
|
||||||
|
|
||||||
expect(xcodeProjectInterpreter.workspaces, const <CleanWorkspaceCall>[
|
expect(xcodeProjectInterpreter.workspaces, const <CleanWorkspaceCall>[
|
||||||
CleanWorkspaceCall('/ios/Runner.xcworkspace', 'Runner', false),
|
CleanWorkspaceCall('/ios/Runner.xcworkspace', 'Runner', false),
|
||||||
@ -231,7 +237,7 @@ FlutterProject setupProjectUnderTest(Directory currentDirectory, bool setupXcode
|
|||||||
projectUnderTest.macos.hostAppRoot.childDirectory('Runner.xcworkspace').createSync(recursive: true);
|
projectUnderTest.macos.hostAppRoot.childDirectory('Runner.xcworkspace').createSync(recursive: true);
|
||||||
}
|
}
|
||||||
projectUnderTest.dartTool.createSync(recursive: true);
|
projectUnderTest.dartTool.createSync(recursive: true);
|
||||||
projectUnderTest.directory.childFile('.packages').createSync(recursive: true);
|
projectUnderTest.directory.childDirectory('.dart_tool').childFile('package_config.jon').createSync(recursive: true);
|
||||||
projectUnderTest.android.ephemeralDirectory.createSync(recursive: true);
|
projectUnderTest.android.ephemeralDirectory.createSync(recursive: true);
|
||||||
|
|
||||||
projectUnderTest.ios.ephemeralDirectory.createSync(recursive: true);
|
projectUnderTest.ios.ephemeralDirectory.createSync(recursive: true);
|
||||||
|
@ -40,7 +40,7 @@ class FakePub extends Fake implements Pub {
|
|||||||
bool shouldSkipThirdPartyGenerator = true,
|
bool shouldSkipThirdPartyGenerator = true,
|
||||||
PubOutputMode outputMode = PubOutputMode.all,
|
PubOutputMode outputMode = PubOutputMode.all,
|
||||||
}) async {
|
}) async {
|
||||||
project.directory.childFile('.packages').createSync();
|
project.directory.childDirectory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
if (offline) {
|
if (offline) {
|
||||||
calledGetOffline += 1;
|
calledGetOffline += 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,7 +83,6 @@ void main() {
|
|||||||
fileSystem.currentDirectory.childFile('pubspec.yaml').createSync();
|
fileSystem.currentDirectory.childFile('pubspec.yaml').createSync();
|
||||||
fileSystem.currentDirectory.childFile('.flutter-plugins').createSync();
|
fileSystem.currentDirectory.childFile('.flutter-plugins').createSync();
|
||||||
fileSystem.currentDirectory.childFile('.flutter-plugins-dependencies').createSync();
|
fileSystem.currentDirectory.childFile('.flutter-plugins-dependencies').createSync();
|
||||||
fileSystem.currentDirectory.childFile('.packages').writeAsBytesSync(<int>[0]);
|
|
||||||
fileSystem.currentDirectory.childFile('.dart_tool/package_config.json')
|
fileSystem.currentDirectory.childFile('.dart_tool/package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsBytesSync(<int>[0]);
|
..writeAsBytesSync(<int>[0]);
|
||||||
|
@ -122,7 +122,6 @@ void main() {
|
|||||||
testUsingContext('bundle fails to build for Windows if feature is disabled', () async {
|
testUsingContext('bundle fails to build for Windows if feature is disabled', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync(recursive: true);
|
globals.fs.file('pubspec.yaml').createSync(recursive: true);
|
||||||
globals.fs.file('.packages').createSync(recursive: true);
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -142,7 +141,6 @@ void main() {
|
|||||||
testUsingContext('bundle fails to build for Linux if feature is disabled', () async {
|
testUsingContext('bundle fails to build for Linux if feature is disabled', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -162,7 +160,6 @@ void main() {
|
|||||||
testUsingContext('bundle fails to build for macOS if feature is disabled', () async {
|
testUsingContext('bundle fails to build for macOS if feature is disabled', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -182,7 +179,6 @@ void main() {
|
|||||||
testUsingContext('bundle --tree-shake-icons fails', () async {
|
testUsingContext('bundle --tree-shake-icons fails', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -201,7 +197,6 @@ void main() {
|
|||||||
testUsingContext('bundle can build for Windows if feature is enabled', () async {
|
testUsingContext('bundle can build for Windows if feature is enabled', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -221,7 +216,6 @@ void main() {
|
|||||||
testUsingContext('bundle can build for Linux if feature is enabled', () async {
|
testUsingContext('bundle can build for Linux if feature is enabled', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -241,7 +235,6 @@ void main() {
|
|||||||
testUsingContext('bundle can build for macOS if feature is enabled', () async {
|
testUsingContext('bundle can build for macOS if feature is enabled', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -261,7 +254,7 @@ void main() {
|
|||||||
testUsingContext('passes track widget creation through', () async {
|
testUsingContext('passes track widget creation through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -294,7 +287,6 @@ void main() {
|
|||||||
testUsingContext('passes dart-define through', () async {
|
testUsingContext('passes dart-define through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -328,7 +320,6 @@ void main() {
|
|||||||
testUsingContext('passes filesystem-scheme through', () async {
|
testUsingContext('passes filesystem-scheme through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -361,7 +352,6 @@ void main() {
|
|||||||
testUsingContext('passes filesystem-roots through', () async {
|
testUsingContext('passes filesystem-roots through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -395,7 +385,6 @@ void main() {
|
|||||||
testUsingContext('passes extra frontend-options through', () async {
|
testUsingContext('passes extra frontend-options through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -429,7 +418,6 @@ void main() {
|
|||||||
testUsingContext('passes extra gen_snapshot-options through', () async {
|
testUsingContext('passes extra gen_snapshot-options through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -463,7 +451,6 @@ void main() {
|
|||||||
testUsingContext('passes profile options through', () async {
|
testUsingContext('passes profile options through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
@ -505,7 +492,6 @@ void main() {
|
|||||||
testUsingContext('passes release options through', () async {
|
testUsingContext('passes release options through', () async {
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
));
|
));
|
||||||
|
@ -189,7 +189,6 @@ name: example
|
|||||||
flutter:
|
flutter:
|
||||||
module: {}
|
module: {}
|
||||||
''');
|
''');
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = FlutterProjectFactory(
|
final FlutterProject flutterProject = FlutterProjectFactory(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
@ -202,7 +201,6 @@ flutter:
|
|||||||
testWithoutContext('isSupportedForProject is true with editable host app', () async {
|
testWithoutContext('isSupportedForProject is true with editable host app', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.directory('android').createSync();
|
fileSystem.directory('android').createSync();
|
||||||
final FlutterProject flutterProject = FlutterProjectFactory(
|
final FlutterProject flutterProject = FlutterProjectFactory(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
@ -217,7 +215,6 @@ flutter:
|
|||||||
testWithoutContext('isSupportedForProject is false with no host app and no module', () async {
|
testWithoutContext('isSupportedForProject is false with no host app and no module', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = FlutterProjectFactory(
|
final FlutterProject flutterProject = FlutterProjectFactory(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
|
@ -424,7 +424,6 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('returns null when there is no ios or .ios directory', () async {
|
testUsingContext('returns null when there is no ios or .ios directory', () async {
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
||||||
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
|
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
|
||||||
|
|
||||||
@ -433,7 +432,6 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('returns null when there is no Runner.xcodeproj', () async {
|
testUsingContext('returns null when there is no Runner.xcodeproj', () async {
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
globals.fs.file('ios/FooBar.xcodeproj').createSync(recursive: true);
|
globals.fs.file('ios/FooBar.xcodeproj').createSync(recursive: true);
|
||||||
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
||||||
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
|
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
|
||||||
@ -443,7 +441,6 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('returns null when there is no Runner.xcodeproj/project.pbxproj', () async {
|
testUsingContext('returns null when there is no Runner.xcodeproj/project.pbxproj', () async {
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
globals.fs.file('ios/Runner.xcodeproj').createSync(recursive: true);
|
globals.fs.file('ios/Runner.xcodeproj').createSync(recursive: true);
|
||||||
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
||||||
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
|
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
|
||||||
@ -453,7 +450,6 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('returns null when there with no product identifier', () async {
|
testUsingContext('returns null when there with no product identifier', () async {
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final Directory project = globals.fs.directory('ios/Runner.xcodeproj')..createSync(recursive: true);
|
final Directory project = globals.fs.directory('ios/Runner.xcodeproj')..createSync(recursive: true);
|
||||||
project.childFile('project.pbxproj').createSync();
|
project.childFile('project.pbxproj').createSync();
|
||||||
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
|
||||||
|
@ -32,7 +32,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
||||||
flavor: flavor,
|
flavor: flavor,
|
||||||
);
|
);
|
||||||
@ -45,7 +45,7 @@ void main() {
|
|||||||
final BufferLogger logger = BufferLogger.test();
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final FakePlatform platform = FakePlatform();
|
final FakePlatform platform = FakePlatform();
|
||||||
|
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('assets', 'common', 'image.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('assets', 'common', 'image.png')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('assets', 'vanilla', 'ice-cream.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('assets', 'vanilla', 'ice-cream.png')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('assets', 'strawberry', 'ice-cream.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('assets', 'strawberry', 'ice-cream.png')).createSync(recursive: true);
|
||||||
@ -108,7 +108,7 @@ flutter:
|
|||||||
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
||||||
final BufferLogger logger = BufferLogger.test();
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final FakePlatform platform = FakePlatform();
|
final FakePlatform platform = FakePlatform();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('assets', 'unflavored.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('assets', 'unflavored.png')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('assets', 'vanillaOrange.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('assets', 'vanillaOrange.png')).createSync(recursive: true);
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ flutter:
|
|||||||
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
||||||
final BufferLogger logger = BufferLogger.test();
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final FakePlatform platform = FakePlatform();
|
final FakePlatform platform = FakePlatform();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('vanilla', 'vanilla.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('vanilla', 'vanilla.png')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('vanilla', 'flavorless.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('vanilla', 'flavorless.png')).createSync(recursive: true);
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ flutter:
|
|||||||
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
||||||
final BufferLogger logger = BufferLogger.test();
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final FakePlatform platform = FakePlatform();
|
final FakePlatform platform = FakePlatform();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file('orange.png').createSync(recursive: true);
|
fileSystem.file('orange.png').createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -215,7 +215,7 @@ flutter:
|
|||||||
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
fileSystem.currentDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
|
||||||
final BufferLogger logger = BufferLogger.test();
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final FakePlatform platform = FakePlatform();
|
final FakePlatform platform = FakePlatform();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('vanilla', 'actually-strawberry.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('vanilla', 'actually-strawberry.png')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('vanilla', 'vanilla.png')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('vanilla', 'vanilla.png')).createSync(recursive: true);
|
||||||
|
|
||||||
|
@ -46,10 +46,25 @@ $fontsSection
|
|||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void writePackagesFile(String packages) {
|
void writePackageConfigFile(Map<String, String> packages) {
|
||||||
globals.fs.file('.packages')
|
globals.fs.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync()
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync(packages);
|
..writeAsStringSync(
|
||||||
|
json.encode(<String, dynamic>{
|
||||||
|
'packages': <dynamic>[
|
||||||
|
...packages.entries.map((MapEntry<String, String> entry) {
|
||||||
|
return <String, dynamic>{
|
||||||
|
'name': entry.key,
|
||||||
|
'rootUri': '../${entry.value}',
|
||||||
|
'packageUri': 'lib/',
|
||||||
|
'languageVersion': '3.2',
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
'configVersion': 2,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> buildAndVerifyFonts(
|
Future<void> buildAndVerifyFonts(
|
||||||
@ -59,7 +74,7 @@ $fontsSection
|
|||||||
String expectedAssetManifest,
|
String expectedAssetManifest,
|
||||||
) async {
|
) async {
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
for (final String packageName in packages) {
|
for (final String packageName in packages) {
|
||||||
for (final String packageFont in packageFonts) {
|
for (final String packageFont in packageFonts) {
|
||||||
@ -106,11 +121,11 @@ $fontsSection
|
|||||||
|
|
||||||
testUsingContext('App includes neither font manifest nor fonts when no defines fonts', () async {
|
testUsingContext('App includes neither font manifest nor fonts when no defines fonts', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.bin',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.bin',
|
||||||
'AssetManifest.json', 'FontManifest.json', 'NOTICES.Z']));
|
'AssetManifest.json', 'FontManifest.json', 'NOTICES.Z']));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -125,7 +140,7 @@ $fontsSection
|
|||||||
- asset: packages/test_package/bar
|
- asset: packages/test_package/bar
|
||||||
''';
|
''';
|
||||||
writePubspecFile('pubspec.yaml', 'test', fontsSection: fontsSection);
|
writePubspecFile('pubspec.yaml', 'test', fontsSection: fontsSection);
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
||||||
|
|
||||||
const String font = 'bar';
|
const String font = 'bar';
|
||||||
@ -152,7 +167,7 @@ $fontsSection
|
|||||||
- asset: a/bar
|
- asset: a/bar
|
||||||
''';
|
''';
|
||||||
writePubspecFile('pubspec.yaml', 'test', fontsSection: fontsSection);
|
writePubspecFile('pubspec.yaml', 'test', fontsSection: fontsSection);
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
||||||
|
|
||||||
const String packageFont = 'bar';
|
const String packageFont = 'bar';
|
||||||
@ -176,7 +191,7 @@ $fontsSection
|
|||||||
|
|
||||||
testUsingContext('App uses package font with own font file', () async {
|
testUsingContext('App uses package font with own font file', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
const String fontsSection = '''
|
const String fontsSection = '''
|
||||||
- family: foo
|
- family: foo
|
||||||
fonts:
|
fonts:
|
||||||
@ -207,7 +222,12 @@ $fontsSection
|
|||||||
|
|
||||||
testUsingContext('App uses package font with font file from another package', () async {
|
testUsingContext('App uses package font with font file from another package', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
|
writePackageConfigFile(
|
||||||
|
<String, String>{
|
||||||
|
'test_package': 'p/p/',
|
||||||
|
'test_package2': 'p2/p/',
|
||||||
|
},
|
||||||
|
);
|
||||||
const String fontsSection = '''
|
const String fontsSection = '''
|
||||||
- family: foo
|
- family: foo
|
||||||
fonts:
|
fonts:
|
||||||
@ -239,7 +259,7 @@ $fontsSection
|
|||||||
|
|
||||||
testUsingContext('App uses package font with properties and own font file', () async {
|
testUsingContext('App uses package font with properties and own font file', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
const String pubspec = '''
|
const String pubspec = '''
|
||||||
- family: foo
|
- family: foo
|
||||||
@ -281,7 +301,7 @@ $fontsSection
|
|||||||
'test',
|
'test',
|
||||||
fontsSection: fontsSection,
|
fontsSection: fontsSection,
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
'p/p/pubspec.yaml',
|
'p/p/pubspec.yaml',
|
||||||
'test_package',
|
'test_package',
|
||||||
|
@ -57,10 +57,25 @@ $assetsSection
|
|||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void writePackagesFile(String packages) {
|
void writePackageConfigFile(Map<String, String> packages) {
|
||||||
globals.fs.file('.packages')
|
globals.fs.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync()
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync(packages);
|
..writeAsStringSync(
|
||||||
|
json.encode(<String, dynamic>{
|
||||||
|
'packages': <dynamic>[
|
||||||
|
...packages.entries.map((MapEntry<String, String> entry) {
|
||||||
|
return <String, dynamic>{
|
||||||
|
'name': entry.key,
|
||||||
|
'rootUri': '../${entry.value}',
|
||||||
|
'packageUri': 'lib/',
|
||||||
|
'languageVersion': '3.2',
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
'configVersion': 2,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Object, Object> assetManifestBinToJson(Map<Object, Object> manifest) {
|
Map<Object, Object> assetManifestBinToJson(Map<Object, Object> manifest) {
|
||||||
@ -78,7 +93,7 @@ $assetsSection
|
|||||||
) async {
|
) async {
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
for (final String packageName in packages) {
|
for (final String packageName in packages) {
|
||||||
for (final String asset in assets) {
|
for (final String asset in assets) {
|
||||||
@ -134,11 +149,11 @@ $assetsSection
|
|||||||
group('AssetBundle assets from packages', () {
|
group('AssetBundle assets from packages', () {
|
||||||
testUsingContext('No assets are bundled when the package has no assets', () async {
|
testUsingContext('No assets are bundled when the package has no assets', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(
|
expect(bundle.entries.keys, unorderedEquals(
|
||||||
<String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json']));
|
<String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json']));
|
||||||
const String expectedAssetManifest = '{}';
|
const String expectedAssetManifest = '{}';
|
||||||
@ -157,14 +172,14 @@ $assetsSection
|
|||||||
|
|
||||||
testUsingContext('No assets are bundled when the package has an asset that is not listed', () async {
|
testUsingContext('No assets are bundled when the package has an asset that is not listed', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
||||||
|
|
||||||
final List<String> assets = <String>['a/foo'];
|
final List<String> assets = <String>['a/foo'];
|
||||||
writeAssets('p/p/', assets);
|
writeAssets('p/p/', assets);
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(
|
expect(bundle.entries.keys, unorderedEquals(
|
||||||
<String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json']));
|
<String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json']));
|
||||||
const String expectedAssetManifest = '{}';
|
const String expectedAssetManifest = '{}';
|
||||||
@ -184,7 +199,7 @@ $assetsSection
|
|||||||
testUsingContext('One asset is bundled when the package has and lists one '
|
testUsingContext('One asset is bundled when the package has and lists one '
|
||||||
'asset its pubspec', () async {
|
'asset its pubspec', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assets = <String>['a/foo'];
|
final List<String> assets = <String>['a/foo'];
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
@ -221,7 +236,7 @@ $assetsSection
|
|||||||
'test',
|
'test',
|
||||||
assets: assetEntries,
|
assets: assetEntries,
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
writePubspecFile('p/p/pubspec.yaml', 'test_package');
|
||||||
|
|
||||||
final List<String> assets = <String>['a/foo'];
|
final List<String> assets = <String>['a/foo'];
|
||||||
@ -246,7 +261,7 @@ $assetsSection
|
|||||||
testUsingContext('One asset and its variant are bundled when the package '
|
testUsingContext('One asset and its variant are bundled when the package '
|
||||||
'has an asset and a variant, and lists the asset in its pubspec', () async {
|
'has an asset and a variant, and lists the asset in its pubspec', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
'p/p/pubspec.yaml',
|
'p/p/pubspec.yaml',
|
||||||
'test_package',
|
'test_package',
|
||||||
@ -283,7 +298,7 @@ $assetsSection
|
|||||||
'test',
|
'test',
|
||||||
assets: <String>['packages/test_package/a/foo'],
|
assets: <String>['packages/test_package/a/foo'],
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
'p/p/pubspec.yaml',
|
'p/p/pubspec.yaml',
|
||||||
'test_package',
|
'test_package',
|
||||||
@ -312,7 +327,7 @@ $assetsSection
|
|||||||
testUsingContext('Two assets are bundled when the package has and lists '
|
testUsingContext('Two assets are bundled when the package has and lists '
|
||||||
'two assets in its pubspec', () async {
|
'two assets in its pubspec', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assets = <String>['a/foo', 'a/bar'];
|
final List<String> assets = <String>['a/foo', 'a/bar'];
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
@ -351,7 +366,7 @@ $assetsSection
|
|||||||
'test',
|
'test',
|
||||||
assets: assetEntries,
|
assets: assetEntries,
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assets = <String>['a/foo', 'a/bar'];
|
final List<String> assets = <String>['a/foo', 'a/bar'];
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
@ -384,7 +399,12 @@ $assetsSection
|
|||||||
'pubspec.yaml',
|
'pubspec.yaml',
|
||||||
'test',
|
'test',
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
|
writePackageConfigFile(
|
||||||
|
<String, String>{
|
||||||
|
'test_package': 'p/p/',
|
||||||
|
'test_package2': 'p2/p/',
|
||||||
|
},
|
||||||
|
);
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
'p/p/pubspec.yaml',
|
'p/p/pubspec.yaml',
|
||||||
'test_package',
|
'test_package',
|
||||||
@ -431,7 +451,12 @@ $assetsSection
|
|||||||
'test',
|
'test',
|
||||||
assets: assetEntries,
|
assets: assetEntries,
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
|
writePackageConfigFile(
|
||||||
|
<String, String>{
|
||||||
|
'test_package': 'p/p/',
|
||||||
|
'test_package2': 'p2/p/',
|
||||||
|
},
|
||||||
|
);
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
'p/p/pubspec.yaml',
|
'p/p/pubspec.yaml',
|
||||||
'test_package',
|
'test_package',
|
||||||
@ -472,7 +497,12 @@ $assetsSection
|
|||||||
'pubspec.yaml',
|
'pubspec.yaml',
|
||||||
'test',
|
'test',
|
||||||
);
|
);
|
||||||
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
|
writePackageConfigFile(
|
||||||
|
<String, String>{
|
||||||
|
'test_package': 'p/p/',
|
||||||
|
'test_package2': 'p2/p/',
|
||||||
|
},
|
||||||
|
);
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
'p/p/pubspec.yaml',
|
'p/p/pubspec.yaml',
|
||||||
'test_package',
|
'test_package',
|
||||||
@ -506,7 +536,7 @@ $assetsSection
|
|||||||
|
|
||||||
testUsingContext('Asset paths can contain URL reserved characters', () async {
|
testUsingContext('Asset paths can contain URL reserved characters', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assets = <String>['a/foo', 'a/foo [x]'];
|
final List<String> assets = <String>['a/foo', 'a/foo [x]'];
|
||||||
writePubspecFile(
|
writePubspecFile(
|
||||||
@ -538,7 +568,7 @@ $assetsSection
|
|||||||
group('AssetBundle assets from scanned paths', () {
|
group('AssetBundle assets from scanned paths', () {
|
||||||
testUsingContext('Two assets are bundled when scanning their directory', () async {
|
testUsingContext('Two assets are bundled when scanning their directory', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assetsOnDisk = <String>['a/foo', 'a/bar'];
|
final List<String> assetsOnDisk = <String>['a/foo', 'a/bar'];
|
||||||
final List<String> assetsOnManifest = <String>['a/'];
|
final List<String> assetsOnManifest = <String>['a/'];
|
||||||
@ -571,7 +601,7 @@ $assetsSection
|
|||||||
|
|
||||||
testUsingContext('Two assets are bundled when listing one and scanning second directory', () async {
|
testUsingContext('Two assets are bundled when listing one and scanning second directory', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assetsOnDisk = <String>['a/foo', 'abc/bar'];
|
final List<String> assetsOnDisk = <String>['a/foo', 'abc/bar'];
|
||||||
final List<String> assetOnManifest = <String>['a/foo', 'abc/'];
|
final List<String> assetOnManifest = <String>['a/foo', 'abc/'];
|
||||||
@ -604,7 +634,7 @@ $assetsSection
|
|||||||
|
|
||||||
testUsingContext('One asset is bundled with variant, scanning wrong directory', () async {
|
testUsingContext('One asset is bundled with variant, scanning wrong directory', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assetsOnDisk = <String>['a/foo','a/b/foo','a/bar'];
|
final List<String> assetsOnDisk = <String>['a/foo','a/b/foo','a/bar'];
|
||||||
final List<String> assetOnManifest = <String>['a','a/bar']; // can't list 'a' as asset, should be 'a/'
|
final List<String> assetOnManifest = <String>['a','a/bar']; // can't list 'a' as asset, should be 'a/'
|
||||||
@ -618,7 +648,7 @@ $assetsSection
|
|||||||
writeAssets('p/p/', assetsOnDisk);
|
writeAssets('p/p/', assetsOnDisk);
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
expect(bundle.entries['AssetManifest.json'], isNull,
|
expect(bundle.entries['AssetManifest.json'], isNull,
|
||||||
reason: 'Invalid pubspec.yaml should not generate AssetManifest.json' );
|
reason: 'Invalid pubspec.yaml should not generate AssetManifest.json' );
|
||||||
@ -631,7 +661,7 @@ $assetsSection
|
|||||||
group('AssetBundle assets from scanned paths with MemoryFileSystem', () {
|
group('AssetBundle assets from scanned paths with MemoryFileSystem', () {
|
||||||
testUsingContext('One asset is bundled with variant, scanning directory', () async {
|
testUsingContext('One asset is bundled with variant, scanning directory', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assetsOnDisk = <String>['a/foo','a/2x/foo'];
|
final List<String> assetsOnDisk = <String>['a/foo','a/2x/foo'];
|
||||||
final List<String> assetOnManifest = <String>['a/',];
|
final List<String> assetOnManifest = <String>['a/',];
|
||||||
@ -661,7 +691,7 @@ $assetsSection
|
|||||||
|
|
||||||
testUsingContext('No asset is bundled with variant, no assets or directories are listed', () async {
|
testUsingContext('No asset is bundled with variant, no assets or directories are listed', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assetsOnDisk = <String>['a/foo', 'a/2x/foo'];
|
final List<String> assetsOnDisk = <String>['a/foo', 'a/2x/foo'];
|
||||||
final List<String> assetOnManifest = <String>[];
|
final List<String> assetOnManifest = <String>[];
|
||||||
@ -687,7 +717,7 @@ $assetsSection
|
|||||||
|
|
||||||
testUsingContext('Expect error generating manifest, wrong non-existing directory is listed', () async {
|
testUsingContext('Expect error generating manifest, wrong non-existing directory is listed', () async {
|
||||||
writePubspecFile('pubspec.yaml', 'test');
|
writePubspecFile('pubspec.yaml', 'test');
|
||||||
writePackagesFile('test_package:p/p/lib/');
|
writePackageConfigFile(<String, String>{'test_package': 'p/p/'});
|
||||||
|
|
||||||
final List<String> assetOnManifest = <String>['c/'];
|
final List<String> assetOnManifest = <String>['c/'];
|
||||||
|
|
||||||
@ -698,7 +728,7 @@ $assetsSection
|
|||||||
);
|
);
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => testFileSystem,
|
FileSystem: () => testFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
@ -27,6 +27,31 @@ import '../src/context.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
const String shaderLibDir = '/./shader_lib';
|
const String shaderLibDir = '/./shader_lib';
|
||||||
|
|
||||||
|
File createPackageConfig(
|
||||||
|
FileSystem fileSystem, {
|
||||||
|
Map<String, String> packages = const <String, String>{},
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
final File file = fileSystem.directory('.dart_tool').childFile('package_config.json');
|
||||||
|
file.createSync(recursive: true);
|
||||||
|
file.writeAsStringSync(
|
||||||
|
json.encode(<String, dynamic>{
|
||||||
|
'packages': <dynamic>[
|
||||||
|
...packages.entries.map((MapEntry<String, String> entry) {
|
||||||
|
return <String, dynamic>{
|
||||||
|
'name': entry.key,
|
||||||
|
'rootUri': '../${entry.value}',
|
||||||
|
'packageUri': 'lib/',
|
||||||
|
'languageVersion': '3.2',
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
'configVersion': 2,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
group('AssetBundle.build (using context)', () {
|
group('AssetBundle.build (using context)', () {
|
||||||
late FileSystem testFileSystem;
|
late FileSystem testFileSystem;
|
||||||
late Platform platform;
|
late Platform platform;
|
||||||
@ -39,7 +64,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('nonempty', () async {
|
testUsingContext('nonempty', () async {
|
||||||
final AssetBundle ab = AssetBundleFactory.instance.createBundle();
|
final AssetBundle ab = AssetBundleFactory.instance.createBundle();
|
||||||
expect(await ab.build(packageConfigPath: '.packages'), 0);
|
expect(await ab.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect(ab.entries.length, greaterThan(0));
|
expect(ab.entries.length, greaterThan(0));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => testFileSystem,
|
FileSystem: () => testFileSystem,
|
||||||
@ -53,7 +78,7 @@ void main() {
|
|||||||
..writeAsStringSync('');
|
..writeAsStringSync('');
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys,
|
expect(bundle.entries.keys,
|
||||||
unorderedEquals(<String>['AssetManifest.json', 'AssetManifest.bin'])
|
unorderedEquals(<String>['AssetManifest.json', 'AssetManifest.bin'])
|
||||||
);
|
);
|
||||||
@ -75,7 +100,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('wildcard directories do not include subdirectories', () async {
|
testUsingContext('wildcard directories do not include subdirectories', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file('pubspec.yaml').writeAsStringSync(
|
globals.fs.file('pubspec.yaml').writeAsStringSync(
|
||||||
'''
|
'''
|
||||||
name: test
|
name: test
|
||||||
@ -104,7 +129,7 @@ flutter:
|
|||||||
}
|
}
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>[
|
expect(bundle.entries.keys, unorderedEquals(<String>[
|
||||||
'AssetManifest.json',
|
'AssetManifest.json',
|
||||||
@ -121,7 +146,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('wildcard directories are updated when filesystem changes', () async {
|
testUsingContext('wildcard directories are updated when filesystem changes', () async {
|
||||||
final File packageFile = globals.fs.file('.packages')..createSync();
|
final File packageFile = createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -132,7 +157,7 @@ flutter:
|
|||||||
- assets/foo/
|
- assets/foo/
|
||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
||||||
// Simulate modifying the files by updating the filestat time manually.
|
// Simulate modifying the files by updating the filestat time manually.
|
||||||
@ -141,7 +166,7 @@ flutter:
|
|||||||
..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1)));
|
..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1)));
|
||||||
|
|
||||||
expect(bundle.needsBuild(), true);
|
expect(bundle.needsBuild(), true);
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt',
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt',
|
||||||
'assets/foo/fizz.txt']));
|
'assets/foo/fizz.txt']));
|
||||||
@ -161,9 +186,9 @@ flutter:
|
|||||||
assets:
|
assets:
|
||||||
- assets/foo/
|
- assets/foo/
|
||||||
''');
|
''');
|
||||||
globals.fs.file('.packages').createSync();
|
final File packageConfig = createPackageConfig(globals.fs);
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
||||||
expect(bundle.needsBuild(), false);
|
expect(bundle.needsBuild(), false);
|
||||||
@ -177,15 +202,14 @@ flutter:
|
|||||||
name: example''')
|
name: example''')
|
||||||
..setLastModifiedSync(modifiedTime);
|
..setLastModifiedSync(modifiedTime);
|
||||||
|
|
||||||
// touch .packages to make sure its change time is after pubspec.yaml's
|
// touch the package config to make sure its change time is after pubspec.yaml's
|
||||||
globals.fs.file('.packages')
|
packageConfig.setLastModifiedSync(modifiedTime);
|
||||||
.setLastModifiedSync(modifiedTime);
|
|
||||||
|
|
||||||
// Even though the previous file was removed, it is left in the
|
// Even though the previous file was removed, it is left in the
|
||||||
// asset manifest and not updated. This is due to the devfs not
|
// asset manifest and not updated. This is due to the devfs not
|
||||||
// supporting file deletion.
|
// supporting file deletion.
|
||||||
expect(bundle.needsBuild(), true);
|
expect(bundle.needsBuild(), true);
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -208,9 +232,9 @@ flutter:
|
|||||||
assets:
|
assets:
|
||||||
- assets/foo/
|
- assets/foo/
|
||||||
''');
|
''');
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
||||||
expect(bundle.needsBuild(), false);
|
expect(bundle.needsBuild(), false);
|
||||||
@ -221,7 +245,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('deferred assets are parsed', () async {
|
testUsingContext('deferred assets are parsed', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'bar', 'barbie.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'bar', 'barbie.txt')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'wild', 'dash.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'wild', 'dash.txt')).createSync(recursive: true);
|
||||||
@ -244,7 +268,7 @@ flutter:
|
|||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
splitDeferredAssets: true,
|
splitDeferredAssets: true,
|
||||||
).createBundle();
|
).createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages', deferredComponentsEnabled: true);
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json', deferredComponentsEnabled: true);
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
|
||||||
expect(bundle.deferredComponentsEntries.length, 1);
|
expect(bundle.deferredComponentsEntries.length, 1);
|
||||||
@ -257,7 +281,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('deferred assets are parsed regularly when splitDeferredAssets Disabled', () async {
|
testUsingContext('deferred assets are parsed regularly when splitDeferredAssets Disabled', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'bar', 'barbie.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'bar', 'barbie.txt')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'wild', 'dash.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'wild', 'dash.txt')).createSync(recursive: true);
|
||||||
@ -275,7 +299,7 @@ flutter:
|
|||||||
- assets/wild/
|
- assets/wild/
|
||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
|
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
|
||||||
'assets/bar/barbie.txt', 'assets/wild/dash.txt', 'AssetManifest.json',
|
'assets/bar/barbie.txt', 'assets/wild/dash.txt', 'AssetManifest.json',
|
||||||
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
||||||
@ -288,7 +312,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('deferred assets wildcard parsed', () async {
|
testUsingContext('deferred assets wildcard parsed', () async {
|
||||||
final File packageFile = globals.fs.file('.packages')..createSync();
|
final File packageFile = createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'bar', 'barbie.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'bar', 'barbie.txt')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'wild', 'dash.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'wild', 'dash.txt')).createSync(recursive: true);
|
||||||
@ -311,7 +335,7 @@ flutter:
|
|||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
splitDeferredAssets: true,
|
splitDeferredAssets: true,
|
||||||
).createBundle();
|
).createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages', deferredComponentsEnabled: true);
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json', deferredComponentsEnabled: true);
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
|
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
|
||||||
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
||||||
expect(bundle.deferredComponentsEntries.length, 1);
|
expect(bundle.deferredComponentsEntries.length, 1);
|
||||||
@ -324,7 +348,7 @@ flutter:
|
|||||||
..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1)));
|
..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1)));
|
||||||
|
|
||||||
expect(bundle.needsBuild(), true);
|
expect(bundle.needsBuild(), true);
|
||||||
await bundle.build(packageConfigPath: '.packages', deferredComponentsEnabled: true);
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json', deferredComponentsEnabled: true);
|
||||||
|
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
|
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
|
||||||
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
||||||
@ -348,7 +372,7 @@ flutter:
|
|||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
);
|
);
|
||||||
|
|
||||||
fileSystem.file('.packages').createSync();
|
createPackageConfig(fileSystem);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -366,7 +390,7 @@ flutter:
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
() => bundle.build(
|
() => bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(
|
flutterProject: FlutterProject.fromDirectoryTest(
|
||||||
fileSystem.currentDirectory,
|
fileSystem.currentDirectory,
|
||||||
),
|
),
|
||||||
@ -400,7 +424,7 @@ flutter:
|
|||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
);
|
);
|
||||||
fileSystem.file('.packages').createSync();
|
createPackageConfig(fileSystem);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -418,7 +442,7 @@ flutter:
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
() => bundle.build(
|
() => bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(
|
flutterProject: FlutterProject.fromDirectoryTest(
|
||||||
fileSystem.currentDirectory,
|
fileSystem.currentDirectory,
|
||||||
),
|
),
|
||||||
@ -436,7 +460,7 @@ flutter:
|
|||||||
|
|
||||||
final BufferLogger logger = BufferLogger.test();
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final FakePlatform platform = FakePlatform();
|
final FakePlatform platform = FakePlatform();
|
||||||
fileSystem.file('.packages').createSync();
|
createPackageConfig(fileSystem);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -459,7 +483,7 @@ flutter:
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(
|
flutterProject: FlutterProject.fromDirectoryTest(
|
||||||
fileSystem.currentDirectory,
|
fileSystem.currentDirectory,
|
||||||
),
|
),
|
||||||
@ -468,7 +492,7 @@ flutter:
|
|||||||
expect(bundle.entries['my-asset.txt']!.content.isModified, isTrue);
|
expect(bundle.entries['my-asset.txt']!.content.isModified, isTrue);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(
|
flutterProject: FlutterProject.fromDirectoryTest(
|
||||||
fileSystem.currentDirectory,
|
fileSystem.currentDirectory,
|
||||||
),
|
),
|
||||||
@ -487,7 +511,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(
|
flutterProject: FlutterProject.fromDirectoryTest(
|
||||||
fileSystem.currentDirectory,
|
fileSystem.currentDirectory,
|
||||||
),
|
),
|
||||||
@ -513,7 +537,7 @@ flutter:
|
|||||||
..writeAsStringSync('');
|
..writeAsStringSync('');
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages', targetPlatform: TargetPlatform.web_javascript);
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json', targetPlatform: TargetPlatform.web_javascript);
|
||||||
|
|
||||||
expect(bundle.entries.keys,
|
expect(bundle.entries.keys,
|
||||||
unorderedEquals(<String>[
|
unorderedEquals(<String>[
|
||||||
@ -537,7 +561,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('pubspec contains an asset', () async {
|
testUsingContext('pubspec contains an asset', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file('pubspec.yaml').writeAsStringSync(r'''
|
globals.fs.file('pubspec.yaml').writeAsStringSync(r'''
|
||||||
name: test
|
name: test
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -552,7 +576,7 @@ flutter:
|
|||||||
).createSync(recursive: true);
|
).createSync(recursive: true);
|
||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages', targetPlatform: TargetPlatform.web_javascript);
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json', targetPlatform: TargetPlatform.web_javascript);
|
||||||
|
|
||||||
expect(bundle.entries.keys,
|
expect(bundle.entries.keys,
|
||||||
unorderedEquals(<String>[
|
unorderedEquals(<String>[
|
||||||
@ -618,7 +642,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('does not unnecessarily recreate asset manifest, font manifest, license', () async {
|
testUsingContext('does not unnecessarily recreate asset manifest, font manifest, license', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -629,13 +653,13 @@ assets:
|
|||||||
- assets/foo/bar.txt
|
- assets/foo/bar.txt
|
||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
final AssetBundleEntry? assetManifest = bundle.entries['AssetManifest.json'];
|
final AssetBundleEntry? assetManifest = bundle.entries['AssetManifest.json'];
|
||||||
final AssetBundleEntry? fontManifest = bundle.entries['FontManifest.json'];
|
final AssetBundleEntry? fontManifest = bundle.entries['FontManifest.json'];
|
||||||
final AssetBundleEntry? license = bundle.entries['NOTICES'];
|
final AssetBundleEntry? license = bundle.entries['NOTICES'];
|
||||||
|
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
expect(assetManifest, bundle.entries['AssetManifest.json']);
|
expect(assetManifest, bundle.entries['AssetManifest.json']);
|
||||||
expect(fontManifest, bundle.entries['FontManifest.json']);
|
expect(fontManifest, bundle.entries['FontManifest.json']);
|
||||||
@ -648,7 +672,7 @@ assets:
|
|||||||
|
|
||||||
testUsingContext('inserts dummy file into additionalDependencies when '
|
testUsingContext('inserts dummy file into additionalDependencies when '
|
||||||
'wildcards are used', () async {
|
'wildcards are used', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -660,7 +684,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect(bundle.additionalDependencies.single.path, contains('DOES_NOT_EXIST_RERUN_FOR_WILDCARD'));
|
expect(bundle.additionalDependencies.single.path, contains('DOES_NOT_EXIST_RERUN_FOR_WILDCARD'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -670,7 +694,7 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('Does not insert dummy file into additionalDependencies '
|
testUsingContext('Does not insert dummy file into additionalDependencies '
|
||||||
'when wildcards are not used', () async {
|
'when wildcards are not used', () async {
|
||||||
globals.fs.file('.packages').createSync();
|
createPackageConfig(globals.fs);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'bar.txt')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('assets', 'bar.txt')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -682,7 +706,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect(bundle.additionalDependencies, isEmpty);
|
expect(bundle.additionalDependencies, isEmpty);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -715,7 +739,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Including a shader triggers the shader compiler', () async {
|
testUsingContext('Including a shader triggers the shader compiler', () async {
|
||||||
fileSystem.file('.packages').createSync();
|
createPackageConfig(fileSystem);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -726,7 +750,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
|
|
||||||
await writeBundle(
|
await writeBundle(
|
||||||
output,
|
output,
|
||||||
@ -768,7 +792,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Included shaders are compiled for the web', () async {
|
testUsingContext('Included shaders are compiled for the web', () async {
|
||||||
fileSystem.file('.packages').createSync();
|
createPackageConfig(fileSystem);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -779,7 +803,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages', targetPlatform: TargetPlatform.web_javascript), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json', targetPlatform: TargetPlatform.web_javascript), 0);
|
||||||
|
|
||||||
await writeBundle(
|
await writeBundle(
|
||||||
output,
|
output,
|
||||||
@ -820,7 +844,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Material shaders are compiled for the web', () async {
|
testUsingContext('Material shaders are compiled for the web', () async {
|
||||||
fileSystem.file('.packages').createSync();
|
createPackageConfig(fileSystem);
|
||||||
|
|
||||||
final String materialIconsPath = fileSystem.path.join(
|
final String materialIconsPath = fileSystem.path.join(
|
||||||
getFlutterRoot(),
|
getFlutterRoot(),
|
||||||
@ -867,7 +891,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages', targetPlatform: TargetPlatform.web_javascript), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json', targetPlatform: TargetPlatform.web_javascript), 0);
|
||||||
|
|
||||||
await writeBundle(
|
await writeBundle(
|
||||||
output,
|
output,
|
||||||
@ -891,10 +915,13 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('Does not insert dummy file into additionalDependencies '
|
testUsingContext('Does not insert dummy file into additionalDependencies '
|
||||||
'when wildcards are used by dependencies', () async {
|
'when wildcards are used by dependencies', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
foo:foo/lib/
|
packages: <String, String> {
|
||||||
''');
|
'example': '',
|
||||||
|
'foo': 'foo',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
@ -916,7 +943,7 @@ flutter:
|
|||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true);
|
globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true);
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect(bundle.additionalDependencies, isEmpty);
|
expect(bundle.additionalDependencies, isEmpty);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -925,10 +952,13 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('does not track wildcard directories from dependencies', () async {
|
testUsingContext('does not track wildcard directories from dependencies', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
foo:foo/lib/
|
packages: <String, String> {
|
||||||
''');
|
'example': '',
|
||||||
|
'foo': 'foo',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
@ -950,7 +980,7 @@ flutter:
|
|||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true);
|
globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true);
|
||||||
|
|
||||||
await bundle.build(packageConfigPath: '.packages');
|
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
|
||||||
|
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['packages/foo/bar/fizz.txt',
|
expect(bundle.entries.keys, unorderedEquals(<String>['packages/foo/bar/fizz.txt',
|
||||||
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
||||||
@ -969,10 +999,13 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('reports package that causes asset bundle error when it is '
|
testUsingContext('reports package that causes asset bundle error when it is '
|
||||||
'a dependency', () async {
|
'a dependency', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
foo:foo/lib/
|
packages: <String, String> {
|
||||||
''');
|
'example': '',
|
||||||
|
'foo': 'foo',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
|
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
@ -993,7 +1026,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 1);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 1);
|
||||||
expect(testLogger.errorText, contains('This asset was included from package foo'));
|
expect(testLogger.errorText, contains('This asset was included from package foo'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -1003,9 +1036,13 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('does not report package that causes asset bundle error '
|
testUsingContext('does not report package that causes asset bundle error '
|
||||||
'when it is from own pubspec', () async {
|
'when it is from own pubspec', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
''');
|
packages: <String, String> {
|
||||||
|
'example': '',
|
||||||
|
'foo': 'foo',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -1016,7 +1053,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 1);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 1);
|
||||||
expect(testLogger.errorText, isNot(contains('This asset was included from')));
|
expect(testLogger.errorText, isNot(contains('This asset was included from')));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -1026,10 +1063,13 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('does not include Material Design assets if uses-material-design: true is '
|
testUsingContext('does not include Material Design assets if uses-material-design: true is '
|
||||||
'specified only by a dependency', () async {
|
'specified only by a dependency', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
foo:foo/lib/
|
packages: <String, String> {
|
||||||
''');
|
'example': '',
|
||||||
|
'foo': 'foo',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -1050,7 +1090,7 @@ flutter:
|
|||||||
''');
|
''');
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect((bundle.entries['FontManifest.json']!.content as DevFSStringContent).string, '[]');
|
expect((bundle.entries['FontManifest.json']!.content as DevFSStringContent).string, '[]');
|
||||||
expect((bundle.entries['AssetManifest.json']!.content as DevFSStringContent).string, '{}');
|
expect((bundle.entries['AssetManifest.json']!.content as DevFSStringContent).string, '{}');
|
||||||
expect(testLogger.errorText, contains(
|
expect(testLogger.errorText, contains(
|
||||||
@ -1063,9 +1103,12 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('does not include assets in project directories as asset variants', () async {
|
testUsingContext('does not include assets in project directories as asset variants', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
''');
|
packages: <String, String> {
|
||||||
|
'example': '',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -1087,7 +1130,7 @@ flutter:
|
|||||||
|
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo.txt',
|
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo.txt',
|
||||||
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -1097,9 +1140,12 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('deferred and regular assets are included in manifest alphabetically', () async {
|
testUsingContext('deferred and regular assets are included in manifest alphabetically', () async {
|
||||||
globals.fs.file('.packages').writeAsStringSync(r'''
|
createPackageConfig(
|
||||||
example:lib/
|
globals.fs,
|
||||||
''');
|
packages: <String, String> {
|
||||||
|
'example': '',
|
||||||
|
},
|
||||||
|
);
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync(r'''
|
..writeAsStringSync(r'''
|
||||||
@ -1122,7 +1168,7 @@ flutter:
|
|||||||
globals.fs.file('assets/zebra.jpg').createSync();
|
globals.fs.file('assets/zebra.jpg').createSync();
|
||||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||||
|
|
||||||
expect(await bundle.build(packageConfigPath: '.packages'), 0);
|
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
|
||||||
expect((bundle.entries['FontManifest.json']!.content as DevFSStringContent).string, '[]');
|
expect((bundle.entries['FontManifest.json']!.content as DevFSStringContent).string, '[]');
|
||||||
// The assets from deferred components and regular assets
|
// The assets from deferred components and regular assets
|
||||||
// are both included in alphabetical order
|
// are both included in alphabetical order
|
||||||
|
@ -52,8 +52,14 @@ void main() {
|
|||||||
fileSystem: fs,
|
fileSystem: fs,
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
);
|
);
|
||||||
|
fs.directory('.dart_tool').childFile('package_config.json')
|
||||||
fs.file('.packages').createSync();
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
});
|
});
|
||||||
|
|
||||||
void createPubspec({
|
void createPubspec({
|
||||||
@ -99,7 +105,7 @@ ${assets.map((String entry) => ' - $entry').join('\n')}
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -154,7 +160,7 @@ ${assets.map((String entry) => ' - $entry').join('\n')}
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -210,7 +216,7 @@ ${assets.map((String entry) => ' - $entry').join('\n')}
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -256,7 +262,7 @@ ${assets.map((String entry) => ' - $entry').join('\n')}
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -290,7 +296,14 @@ ${assets.map((String entry) => ' - $entry').join('\n')}
|
|||||||
userMessages: UserMessages()
|
userMessages: UserMessages()
|
||||||
);
|
);
|
||||||
|
|
||||||
fs.file('.packages').createSync();
|
fs.directory('.dart_tool').childFile('package_config.json')
|
||||||
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
|
|
||||||
fs.file('pubspec.yaml').writeAsStringSync(
|
fs.file('pubspec.yaml').writeAsStringSync(
|
||||||
'''
|
'''
|
||||||
@ -328,7 +341,7 @@ flutter:
|
|||||||
);
|
);
|
||||||
|
|
||||||
await bundle.build(
|
await bundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('app font uses local font file', () async {
|
testWithoutContext('app font uses local font file', () async {
|
||||||
final String packagesPath = fileSystem.path.join('main', '.packages');
|
final String packagesPath = fileSystem.path.join('main', '.dart_tool', 'package_config.json');
|
||||||
final String manifestPath =
|
final String manifestPath =
|
||||||
fileSystem.path.join('main', 'pubspec.yaml');
|
fileSystem.path.join('main', 'pubspec.yaml');
|
||||||
final ManifestAssetBundle assetBundle = ManifestAssetBundle(
|
final ManifestAssetBundle assetBundle = ManifestAssetBundle(
|
||||||
@ -137,13 +137,13 @@ dependencies:
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('handles empty pubspec with .packages', () async {
|
testWithoutContext('handles empty pubspec with .dart_tool/package_config.json', () async {
|
||||||
final String packagesPath = fileSystem.path.join('fuchsia_test', 'main', '.packages');
|
final String packageConfigPath = fileSystem.path.join('fuchsia_test', 'main', '.dart_tool', 'package_config.json');
|
||||||
final String manifestPath =
|
final String manifestPath =
|
||||||
fileSystem.path.join('fuchsia_test', 'main', 'pubspec.yaml');
|
fileSystem.path.join('fuchsia_test', 'main', 'pubspec.yaml');
|
||||||
|
|
||||||
fileSystem.directory(fileSystem.file(manifestPath)).parent.createSync(recursive: true);
|
fileSystem.directory(fileSystem.file(manifestPath)).parent.createSync(recursive: true);
|
||||||
fileSystem.directory(fileSystem.file(packagesPath)).parent.createSync(recursive: true);
|
fileSystem.directory(fileSystem.file(packageConfigPath)).parent.createSync(recursive: true);
|
||||||
|
|
||||||
final ManifestAssetBundle assetBundle = ManifestAssetBundle(
|
final ManifestAssetBundle assetBundle = ManifestAssetBundle(
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@ -155,7 +155,7 @@ dependencies:
|
|||||||
|
|
||||||
await assetBundle.build(
|
await assetBundle.build(
|
||||||
manifestPath: manifestPath, // file doesn't exist
|
manifestPath: manifestPath, // file doesn't exist
|
||||||
packageConfigPath: packagesPath,
|
packageConfigPath: packageConfigPath,
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.file(manifestPath).parent),
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.file(manifestPath).parent),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ dependencies:
|
|||||||
);
|
);
|
||||||
|
|
||||||
await assetBundle.build(
|
await assetBundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
targetPlatform: TargetPlatform.android_arm,
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
||||||
);
|
);
|
||||||
@ -248,7 +248,7 @@ dependencies:
|
|||||||
);
|
);
|
||||||
|
|
||||||
await assetBundle.build(
|
await assetBundle.build(
|
||||||
packageConfigPath: '.packages',
|
packageConfigPath: '.dart_tool/package_config.json',
|
||||||
targetPlatform: TargetPlatform.web_javascript,
|
targetPlatform: TargetPlatform.web_javascript,
|
||||||
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
||||||
);
|
);
|
||||||
|
@ -185,7 +185,6 @@ void main() {
|
|||||||
));
|
));
|
||||||
environment.buildDir.createSync(recursive: true);
|
environment.buildDir.createSync(recursive: true);
|
||||||
environment.buildDir.childFile('app.dill').createSync();
|
environment.buildDir.childFile('app.dill').createSync();
|
||||||
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
|
|
||||||
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
|
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
|
||||||
|
|
||||||
await androidAot.build(environment);
|
await androidAot.build(environment);
|
||||||
@ -224,7 +223,6 @@ void main() {
|
|||||||
));
|
));
|
||||||
environment.buildDir.createSync(recursive: true);
|
environment.buildDir.createSync(recursive: true);
|
||||||
environment.buildDir.childFile('app.dill').createSync();
|
environment.buildDir.childFile('app.dill').createSync();
|
||||||
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
|
|
||||||
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
|
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
|
||||||
|
|
||||||
await androidAot.build(environment);
|
await androidAot.build(environment);
|
||||||
@ -266,7 +264,6 @@ void main() {
|
|||||||
));
|
));
|
||||||
environment.buildDir.createSync(recursive: true);
|
environment.buildDir.createSync(recursive: true);
|
||||||
environment.buildDir.childFile('app.dill').createSync();
|
environment.buildDir.childFile('app.dill').createSync();
|
||||||
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
|
|
||||||
|
|
||||||
await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release)
|
await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release)
|
||||||
.build(environment);
|
.build(environment);
|
||||||
@ -304,7 +301,6 @@ void main() {
|
|||||||
));
|
));
|
||||||
environment.buildDir.createSync(recursive: true);
|
environment.buildDir.createSync(recursive: true);
|
||||||
environment.buildDir.childFile('app.dill').createSync();
|
environment.buildDir.childFile('app.dill').createSync();
|
||||||
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
|
|
||||||
|
|
||||||
await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release)
|
await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release)
|
||||||
.build(environment);
|
.build(environment);
|
||||||
@ -529,7 +525,10 @@ void main() {
|
|||||||
.file(artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: BuildMode.debug))
|
.file(artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: BuildMode.debug))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello\nflutter:\n shaders:\n - shader.glsl');
|
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello\nflutter:\n shaders:\n - shader.glsl');
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
fileSystem.file('shader.glsl').writeAsStringSync('test');
|
fileSystem.file('shader.glsl').writeAsStringSync('test');
|
||||||
|
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
|
@ -49,8 +49,10 @@ void main() {
|
|||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('assets/wildcard/#bar.png')
|
fileSystem.file('assets/wildcard/#bar.png')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('.packages')
|
fileSystem
|
||||||
.createSync();
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('''
|
..writeAsStringSync('''
|
||||||
@ -65,8 +67,22 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('includes LICENSE file inputs in dependencies', () async {
|
testUsingContext('includes LICENSE file inputs in dependencies', () async {
|
||||||
fileSystem.file('.packages')
|
fileSystem
|
||||||
.writeAsStringSync('foo:file:///bar/lib');
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "foo",
|
||||||
|
"rootUri": "file:///bar",
|
||||||
|
"packageUri": "lib/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
''');
|
||||||
fileSystem.file('bar/LICENSE')
|
fileSystem.file('bar/LICENSE')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('THIS IS A LICENSE');
|
..writeAsStringSync('THIS IS A LICENSE');
|
||||||
@ -185,7 +201,10 @@ flutter:
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await fileSystem.file('.packages').create();
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
|
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -272,7 +291,10 @@ flutter:
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await fileSystem.file('.packages').create();
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
|
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -370,7 +392,10 @@ flutter:
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await fileSystem.file('.packages').create();
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
|
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
|
@ -56,11 +56,6 @@ const String _kSamplePackageJson = '''
|
|||||||
}
|
}
|
||||||
''';
|
''';
|
||||||
|
|
||||||
const String _kSamplePackagesFile = '''
|
|
||||||
path_provider_linux:/path_provider_linux/lib/
|
|
||||||
path_provider_example:lib/
|
|
||||||
''';
|
|
||||||
|
|
||||||
const String _kSamplePubspecFile = '''
|
const String _kSamplePubspecFile = '''
|
||||||
name: path_provider_example
|
name: path_provider_example
|
||||||
description: Demonstrates how to use the path_provider plugin.
|
description: Demonstrates how to use the path_provider plugin.
|
||||||
@ -177,8 +172,6 @@ void main() {
|
|||||||
|
|
||||||
projectDir.childFile('pubspec.yaml').createSync();
|
projectDir.childFile('pubspec.yaml').createSync();
|
||||||
|
|
||||||
projectDir.childFile('.packages').createSync();
|
|
||||||
|
|
||||||
final FlutterProject testProject = FlutterProject.fromDirectoryTest(projectDir);
|
final FlutterProject testProject = FlutterProject.fromDirectoryTest(projectDir);
|
||||||
await DartPluginRegistrantTarget.test(testProject).build(environment);
|
await DartPluginRegistrantTarget.test(testProject).build(environment);
|
||||||
|
|
||||||
@ -211,8 +204,6 @@ void main() {
|
|||||||
|
|
||||||
projectDir.childFile('pubspec.yaml').writeAsStringSync(_kSamplePubspecFile);
|
projectDir.childFile('pubspec.yaml').writeAsStringSync(_kSamplePubspecFile);
|
||||||
|
|
||||||
projectDir.childFile('.packages').writeAsStringSync(_kSamplePackagesFile);
|
|
||||||
|
|
||||||
projectDir.childDirectory('lib').childFile('main.dart').createSync(recursive: true);
|
projectDir.childDirectory('lib').childFile('main.dart').createSync(recursive: true);
|
||||||
|
|
||||||
environment.fileSystem.currentDirectory
|
environment.fileSystem.currentDirectory
|
||||||
@ -289,8 +280,6 @@ void main() {
|
|||||||
|
|
||||||
final File pubspec = projectDir.childFile('pubspec.yaml')..writeAsStringSync(_kSamplePubspecFile);
|
final File pubspec = projectDir.childFile('pubspec.yaml')..writeAsStringSync(_kSamplePubspecFile);
|
||||||
|
|
||||||
final File packages = projectDir.childFile('.packages')..writeAsStringSync(_kSamplePackagesFile);
|
|
||||||
|
|
||||||
environment.fileSystem.currentDirectory
|
environment.fileSystem.currentDirectory
|
||||||
.childDirectory('path_provider_linux')
|
.childDirectory('path_provider_linux')
|
||||||
.childFile('pubspec.yaml')
|
.childFile('pubspec.yaml')
|
||||||
@ -308,7 +297,6 @@ void main() {
|
|||||||
|
|
||||||
// Simulate a user removing everything from pubspec.yaml.
|
// Simulate a user removing everything from pubspec.yaml.
|
||||||
pubspec.writeAsStringSync(_kEmptyPubspecFile);
|
pubspec.writeAsStringSync(_kEmptyPubspecFile);
|
||||||
packages.writeAsStringSync(_kEmptyPackageJson);
|
|
||||||
config.writeAsStringSync(_kEmptyPackageJson);
|
config.writeAsStringSync(_kEmptyPackageJson);
|
||||||
|
|
||||||
await DartPluginRegistrantTarget.test(testProject).build(environment);
|
await DartPluginRegistrantTarget.test(testProject).build(environment);
|
||||||
@ -337,8 +325,6 @@ void main() {
|
|||||||
|
|
||||||
projectDir.childFile('pubspec.yaml').writeAsStringSync(_kSamplePubspecFile);
|
projectDir.childFile('pubspec.yaml').writeAsStringSync(_kSamplePubspecFile);
|
||||||
|
|
||||||
projectDir.childFile('.packages').writeAsStringSync(_kSamplePackagesFile);
|
|
||||||
|
|
||||||
projectDir.childDirectory('lib').childFile('main.dart').createSync(recursive: true);
|
projectDir.childDirectory('lib').childFile('main.dart').createSync(recursive: true);
|
||||||
|
|
||||||
environment.fileSystem.currentDirectory
|
environment.fileSystem.currentDirectory
|
||||||
|
@ -196,7 +196,10 @@ void main() {
|
|||||||
.createSync();
|
.createSync();
|
||||||
// Project info
|
// Project info
|
||||||
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello');
|
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello');
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
// Plist file
|
// Plist file
|
||||||
fileSystem.file(fileSystem.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
fileSystem.file(fileSystem.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
@ -271,7 +274,10 @@ void main() {
|
|||||||
.createSync();
|
.createSync();
|
||||||
// Project info
|
// Project info
|
||||||
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello\nflutter:\n shaders:\n - shader.glsl');
|
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello\nflutter:\n shaders:\n - shader.glsl');
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
// Plist file
|
// Plist file
|
||||||
fileSystem.file(fileSystem.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
fileSystem.file(fileSystem.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
@ -341,7 +347,10 @@ void main() {
|
|||||||
|
|
||||||
// Project info
|
// Project info
|
||||||
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello');
|
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello');
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
// Plist file
|
// Plist file
|
||||||
fileSystem.file(fileSystem.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
fileSystem.file(fileSystem.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
@ -992,9 +992,6 @@ void main() {
|
|||||||
|
|
||||||
expect(await pubDependencies.isUpToDate(fileSystem), false); // no package config
|
expect(await pubDependencies.isUpToDate(fileSystem), false); // no package config
|
||||||
|
|
||||||
fileSystem.file('packages/flutter_tools/.packages')
|
|
||||||
..createSync(recursive: true)
|
|
||||||
..writeAsStringSync('\n');
|
|
||||||
fileSystem.file('packages/flutter_tools/.dart_tool/package_config.json')
|
fileSystem.file('packages/flutter_tools/.dart_tool/package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('''
|
..writeAsStringSync('''
|
||||||
|
@ -53,7 +53,7 @@ void main() {
|
|||||||
platform: FakePlatform(
|
platform: FakePlatform(
|
||||||
environment: <String, String>{},
|
environment: <String, String>{},
|
||||||
script: Uri.parse('package:flutter_tools/flutter_tools.dart'),
|
script: Uri.parse('package:flutter_tools/flutter_tools.dart'),
|
||||||
packageConfig: 'flutter/packages/flutter_tools/.packages'
|
packageConfig: 'flutter/packages/flutter_tools/.dart_tool/package_config.json'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'file:///path/to/main.dart',
|
'file:///path/to/main.dart',
|
||||||
], completer: completer),
|
], completer: completer),
|
||||||
@ -77,7 +77,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
||||||
completer.complete();
|
completer.complete();
|
||||||
@ -109,7 +109,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'file:///path/to/main.dart',
|
'file:///path/to/main.dart',
|
||||||
], completer: completer),
|
], completer: completer),
|
||||||
@ -122,7 +122,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
stdoutHandler.compilerOutput?.complete();
|
stdoutHandler.compilerOutput?.complete();
|
||||||
completer.complete();
|
completer.complete();
|
||||||
@ -154,7 +154,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'file:///path/to/main.dart',
|
'file:///path/to/main.dart',
|
||||||
], completer: completer, exitCode: 127),
|
], completer: completer, exitCode: 127),
|
||||||
@ -167,7 +167,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
||||||
completer.complete();
|
completer.complete();
|
||||||
@ -202,7 +202,7 @@ void main() {
|
|||||||
'--aot',
|
'--aot',
|
||||||
'--tfa',
|
'--tfa',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'file:///path/to/main.dart',
|
'file:///path/to/main.dart',
|
||||||
], completer: completer),
|
], completer: completer),
|
||||||
@ -216,7 +216,7 @@ void main() {
|
|||||||
aot: true,
|
aot: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
||||||
completer.complete();
|
completer.complete();
|
||||||
@ -251,7 +251,7 @@ void main() {
|
|||||||
'--aot',
|
'--aot',
|
||||||
'--tfa',
|
'--tfa',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'file:///path/to/main.dart',
|
'file:///path/to/main.dart',
|
||||||
], completer: completer),
|
], completer: completer),
|
||||||
@ -265,7 +265,7 @@ void main() {
|
|||||||
aot: true,
|
aot: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
||||||
completer.complete();
|
completer.complete();
|
||||||
@ -299,7 +299,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'file:///path/to/main.dart',
|
'file:///path/to/main.dart',
|
||||||
], completer: completer),
|
], completer: completer),
|
||||||
@ -313,7 +313,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>['FOO=bar', 'BAZ=qux'],
|
dartDefines: const <String>['FOO=bar', 'BAZ=qux'],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
|
|
||||||
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
||||||
@ -348,7 +348,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
'scheme:///main.dart',
|
'scheme:///main.dart',
|
||||||
], completer: completer),
|
], completer: completer),
|
||||||
@ -362,7 +362,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
);
|
);
|
||||||
|
|
||||||
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
stdoutHandler.compilerOutput?.complete(const CompilerOutput('', 0, <Uri>[]));
|
||||||
@ -397,7 +397,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--source',
|
'--source',
|
||||||
'.dart_tools/flutter_build/dart_plugin_registrant.dart',
|
'.dart_tools/flutter_build/dart_plugin_registrant.dart',
|
||||||
'--source',
|
'--source',
|
||||||
@ -422,7 +422,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
buildDir: buildDir,
|
buildDir: buildDir,
|
||||||
checkDartPluginRegistry: true,
|
checkDartPluginRegistry: true,
|
||||||
);
|
);
|
||||||
@ -456,7 +456,7 @@ void main() {
|
|||||||
'--enable-asserts',
|
'--enable-asserts',
|
||||||
'--no-link-platform',
|
'--no-link-platform',
|
||||||
'--packages',
|
'--packages',
|
||||||
'.packages',
|
'.dart_tool/package_config.json',
|
||||||
'--native-assets',
|
'--native-assets',
|
||||||
'path/to/native_assets.yaml',
|
'path/to/native_assets.yaml',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
@ -472,7 +472,7 @@ void main() {
|
|||||||
trackWidgetCreation: false,
|
trackWidgetCreation: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
packagesPath: '.packages',
|
packagesPath: '.dart_tool/package_config.json',
|
||||||
nativeAssets: 'path/to/native_assets.yaml',
|
nativeAssets: 'path/to/native_assets.yaml',
|
||||||
);
|
);
|
||||||
stdoutHandler.compilerOutput
|
stdoutHandler.compilerOutput
|
||||||
|
@ -297,7 +297,10 @@ void main() {
|
|||||||
testWithoutContext('CustomDevice.isSupportedForProject is true with editable host app', () async {
|
testWithoutContext('CustomDevice.isSupportedForProject is true with editable host app', () async {
|
||||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
|
|
||||||
final FlutterProject flutterProject = _setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = _setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
|
@ -132,9 +132,14 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('setupHotRestart function fails', () async {
|
testUsingContext('setupHotRestart function fails', () async {
|
||||||
fileSystem.file('.packages')
|
fileSystem.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('\n');
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
final FakeDevice device = FakeDevice();
|
final FakeDevice device = FakeDevice();
|
||||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||||
FakeFlutterDevice(device),
|
FakeFlutterDevice(device),
|
||||||
@ -158,9 +163,14 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('setupHotReload function fails', () async {
|
testUsingContext('setupHotReload function fails', () async {
|
||||||
fileSystem.file('.packages')
|
fileSystem.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('\n');
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
final FakeDevice device = FakeDevice();
|
final FakeDevice device = FakeDevice();
|
||||||
final FakeFlutterDevice fakeFlutterDevice = FakeFlutterDevice(device);
|
final FakeFlutterDevice fakeFlutterDevice = FakeFlutterDevice(device);
|
||||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||||
@ -203,9 +213,14 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('shutdown hook called after signal', () async {
|
testUsingContext('shutdown hook called after signal', () async {
|
||||||
fileSystem.file('.packages')
|
fileSystem.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('\n');
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
final FakeDevice device = FakeDevice();
|
final FakeDevice device = FakeDevice();
|
||||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||||
FlutterDevice(device, generator: residentCompiler, buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler()),
|
FlutterDevice(device, generator: residentCompiler, buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler()),
|
||||||
@ -226,9 +241,14 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('shutdown hook called after app stop', () async {
|
testUsingContext('shutdown hook called after app stop', () async {
|
||||||
fileSystem.file('.packages')
|
fileSystem.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('\n');
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
final FakeDevice device = FakeDevice();
|
final FakeDevice device = FakeDevice();
|
||||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||||
FlutterDevice(device, generator: residentCompiler, buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler()),
|
FlutterDevice(device, generator: residentCompiler, buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler()),
|
||||||
@ -545,9 +565,14 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Exits with code 2 when HttpException is thrown '
|
testUsingContext('Exits with code 2 when HttpException is thrown '
|
||||||
'during VM service connection', () async {
|
'during VM service connection', () async {
|
||||||
fileSystem.file('.packages')
|
fileSystem.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('\n');
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": []
|
||||||
|
}
|
||||||
|
''');
|
||||||
|
|
||||||
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
|
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
|
||||||
final FakeDevice device = FakeDevice();
|
final FakeDevice device = FakeDevice();
|
||||||
|
@ -39,7 +39,6 @@ name: example
|
|||||||
flutter:
|
flutter:
|
||||||
module: {}
|
module: {}
|
||||||
''');
|
''');
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
|
||||||
final FlutterProject flutterProject =
|
final FlutterProject flutterProject =
|
||||||
FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||||
final IOSDevice device = setUpIOSDevice(fileSystem);
|
final IOSDevice device = setUpIOSDevice(fileSystem);
|
||||||
@ -53,7 +52,6 @@ flutter:
|
|||||||
testUsingContext('IOSDevice.isSupportedForProject is true with editable host app', () async {
|
testUsingContext('IOSDevice.isSupportedForProject is true with editable host app', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
|
||||||
fileSystem.directory('ios').createSync();
|
fileSystem.directory('ios').createSync();
|
||||||
final FlutterProject flutterProject =
|
final FlutterProject flutterProject =
|
||||||
FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||||
@ -69,7 +67,6 @@ flutter:
|
|||||||
testUsingContext('IOSDevice.isSupportedForProject is false with no host app and no module', () async {
|
testUsingContext('IOSDevice.isSupportedForProject is false with no host app and no module', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
|
||||||
final FlutterProject flutterProject =
|
final FlutterProject flutterProject =
|
||||||
FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||||
final IOSDevice device = setUpIOSDevice(fileSystem);
|
final IOSDevice device = setUpIOSDevice(fileSystem);
|
||||||
|
@ -114,9 +114,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
fakeXcodeProjectInterpreter = FakeXcodeProjectInterpreter(projectInfo: projectInfo);
|
fakeXcodeProjectInterpreter = FakeXcodeProjectInterpreter(projectInfo: projectInfo);
|
||||||
xcode = Xcode.test(processManager: FakeProcessManager.any(), xcodeProjectInterpreter: fakeXcodeProjectInterpreter);
|
xcode = Xcode.test(processManager: FakeProcessManager.any(), xcodeProjectInterpreter: fakeXcodeProjectInterpreter);
|
||||||
fileSystem.file('foo/.packages')
|
|
||||||
..createSync(recursive: true)
|
|
||||||
..writeAsStringSync('\n');
|
|
||||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||||
fs: fileSystem,
|
fs: fileSystem,
|
||||||
fakeFlutterVersion: FakeFlutterVersion(),
|
fakeFlutterVersion: FakeFlutterVersion(),
|
||||||
@ -421,9 +418,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
fakeXcodeProjectInterpreter = FakeXcodeProjectInterpreter(projectInfo: projectInfo);
|
fakeXcodeProjectInterpreter = FakeXcodeProjectInterpreter(projectInfo: projectInfo);
|
||||||
xcode = Xcode.test(processManager: FakeProcessManager.any(), xcodeProjectInterpreter: fakeXcodeProjectInterpreter);
|
xcode = Xcode.test(processManager: FakeProcessManager.any(), xcodeProjectInterpreter: fakeXcodeProjectInterpreter);
|
||||||
fileSystem.file('foo/.packages')
|
|
||||||
..createSync(recursive: true)
|
|
||||||
..writeAsStringSync('\n');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group('in release mode', () {
|
group('in release mode', () {
|
||||||
@ -920,7 +914,10 @@ void main() {
|
|||||||
|
|
||||||
void setUpIOSProject(FileSystem fileSystem, {bool createWorkspace = true}) {
|
void setUpIOSProject(FileSystem fileSystem, {bool createWorkspace = true}) {
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
fileSystem.directory('ios').createSync();
|
fileSystem.directory('ios').createSync();
|
||||||
if (createWorkspace) {
|
if (createWorkspace) {
|
||||||
fileSystem.directory('ios/Runner.xcworkspace').createSync();
|
fileSystem.directory('ios/Runner.xcworkspace').createSync();
|
||||||
|
@ -645,7 +645,6 @@ duplicate symbol '_$s29plugin_1_name23PluginNamePluginC9setDouble3key5valueySS_S
|
|||||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||||
final FakeFlutterProject project = FakeFlutterProject(fileSystem: fs);
|
final FakeFlutterProject project = FakeFlutterProject(fileSystem: fs);
|
||||||
project.ios.podfile.createSync(recursive: true);
|
project.ios.podfile.createSync(recursive: true);
|
||||||
project.directory.childFile('.packages').createSync(recursive: true);
|
|
||||||
project.manifest = FakeFlutterManifest();
|
project.manifest = FakeFlutterManifest();
|
||||||
createFakePlugins(project, fs, <String>['plugin_1_name', 'plugin_2_name']);
|
createFakePlugins(project, fs, <String>['plugin_1_name', 'plugin_2_name']);
|
||||||
fs.systemTempDirectory.childFile('cache/plugin_1_name/ios/plugin_1_name/Package.swift')
|
fs.systemTempDirectory.childFile('cache/plugin_1_name/ios/plugin_1_name/Package.swift')
|
||||||
|
@ -1292,7 +1292,6 @@ name: example
|
|||||||
flutter:
|
flutter:
|
||||||
module: {}
|
module: {}
|
||||||
''');
|
''');
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
|
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
|
||||||
|
|
||||||
final IOSSimulator simulator = IOSSimulator(
|
final IOSSimulator simulator = IOSSimulator(
|
||||||
@ -1312,7 +1311,6 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('is true with editable host app', () async {
|
testUsingContext('is true with editable host app', () async {
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
globals.fs.directory('ios').createSync();
|
globals.fs.directory('ios').createSync();
|
||||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
|
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
|
||||||
|
|
||||||
@ -1332,7 +1330,6 @@ flutter:
|
|||||||
|
|
||||||
testUsingContext('is false with no host app and no module', () async {
|
testUsingContext('is false with no host app and no module', () async {
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
|
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
|
||||||
|
|
||||||
final IOSSimulator simulator = IOSSimulator(
|
final IOSSimulator simulator = IOSSimulator(
|
||||||
|
@ -26,8 +26,6 @@ void main() {
|
|||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
testbed = Testbed(setup: () {
|
testbed = Testbed(setup: () {
|
||||||
globals.fs.file('.packages')
|
|
||||||
.writeAsStringSync('\n');
|
|
||||||
globals.fs.file(globals.fs.path.join('build', 'app.dill'))
|
globals.fs.file(globals.fs.path.join('build', 'app.dill'))
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('ABC');
|
..writeAsStringSync('ABC');
|
||||||
|
@ -119,7 +119,6 @@ void main() {
|
|||||||
testWithoutContext('LinuxDevice.isSupportedForProject is true with editable host app', () async {
|
testWithoutContext('LinuxDevice.isSupportedForProject is true with editable host app', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.directory('linux').createSync();
|
fileSystem.directory('linux').createSync();
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
@ -134,7 +133,6 @@ void main() {
|
|||||||
testWithoutContext('LinuxDevice.isSupportedForProject is false with no host app', () async {
|
testWithoutContext('LinuxDevice.isSupportedForProject is false with no host app', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
expect(LinuxDevice(
|
expect(LinuxDevice(
|
||||||
|
@ -173,7 +173,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.directory('macos').createSync();
|
fileSystem.directory('macos').createSync();
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
@ -217,7 +216,6 @@ void main() {
|
|||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
expect(device.isSupportedForProject(flutterProject), false);
|
expect(device.isSupportedForProject(flutterProject), false);
|
||||||
|
@ -1863,7 +1863,7 @@ The Flutter Preview device does not support the following plugins from your pubs
|
|||||||
..flutterPluginsDependenciesFile = dependenciesFile
|
..flutterPluginsDependenciesFile = dependenciesFile
|
||||||
..windows = windowsProject;
|
..windows = windowsProject;
|
||||||
|
|
||||||
flutterProject.directory.childFile('.packages').createSync(recursive: true);
|
flutterProject.directory.childDirectory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
|
|
||||||
const String dependenciesFileContents = r'''
|
const String dependenciesFileContents = r'''
|
||||||
{
|
{
|
||||||
@ -1993,7 +1993,7 @@ The Flutter Preview device does not support the following plugins from your pubs
|
|||||||
flutterProject.directory.childFile('.flutter-plugins-dependencies')
|
flutterProject.directory.childFile('.flutter-plugins-dependencies')
|
||||||
..windows = windowsProject;
|
..windows = windowsProject;
|
||||||
|
|
||||||
flutterProject.directory.childFile('.packages').createSync(recursive: true);
|
flutterProject.directory.childDirectory('.dart_tool').childFile('package_config.json').createSync(recursive: true);
|
||||||
|
|
||||||
createPluginSymlinks(
|
createPluginSymlinks(
|
||||||
flutterProject,
|
flutterProject,
|
||||||
|
@ -51,8 +51,6 @@ void main() {
|
|||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
testbed = Testbed(setup: () {
|
testbed = Testbed(setup: () {
|
||||||
globals.fs.file('.packages')
|
|
||||||
.writeAsStringSync('\n');
|
|
||||||
globals.fs.file(globals.fs.path.join('build', 'app.dill'))
|
globals.fs.file(globals.fs.path.join('build', 'app.dill'))
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('ABC');
|
..writeAsStringSync('ABC');
|
||||||
@ -1172,9 +1170,6 @@ dependencies:
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
''');
|
|
||||||
globals.fs.file('.packages').writeAsStringSync('''
|
|
||||||
path_provider_linux:/path_provider_linux/lib/
|
|
||||||
''');
|
''');
|
||||||
final Directory fakePluginDir = globals.fs.directory('path_provider_linux');
|
final Directory fakePluginDir = globals.fs.directory('path_provider_linux');
|
||||||
final File pluginPubspec = fakePluginDir.childFile('pubspec.yaml');
|
final File pluginPubspec = fakePluginDir.childFile('pubspec.yaml');
|
||||||
|
@ -38,7 +38,10 @@ void main() {
|
|||||||
mockFlutterDevice = FakeFlutterDevice(mockWebDevice);
|
mockFlutterDevice = FakeFlutterDevice(mockWebDevice);
|
||||||
mockFlutterDevice._devFS = mockWebDevFS;
|
mockFlutterDevice._devFS = mockWebDevFS;
|
||||||
|
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
fileSystem.file(fileSystem.path.join('web', 'index.html')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('web', 'index.html')).createSync(recursive: true);
|
||||||
|
@ -127,7 +127,10 @@ void main() {
|
|||||||
.._devFS = webDevFS
|
.._devFS = webDevFS
|
||||||
..device = mockDevice
|
..device = mockDevice
|
||||||
..generator = residentCompiler;
|
..generator = residentCompiler;
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||||
fs: fileSystem,
|
fs: fileSystem,
|
||||||
fakeFlutterVersion: test_fakes.FakeFlutterVersion(),
|
fakeFlutterVersion: test_fakes.FakeFlutterVersion(),
|
||||||
|
@ -213,9 +213,9 @@ void main() {
|
|||||||
testUsingContext("Doesn't crash on invalid .packages file", () async {
|
testUsingContext("Doesn't crash on invalid .packages file", () async {
|
||||||
final FlutterCommandRunner runner = createTestCommandRunner(DummyFlutterCommand()) as FlutterCommandRunner;
|
final FlutterCommandRunner runner = createTestCommandRunner(DummyFlutterCommand()) as FlutterCommandRunner;
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages')
|
fileSystem.directory('.dart_tool').childFile('package_config.json')
|
||||||
..createSync()
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('Not a valid package');
|
..writeAsStringSync('Not a valid package config');
|
||||||
|
|
||||||
await runner.run(<String>['dummy']);
|
await runner.run(<String>['dummy']);
|
||||||
|
|
||||||
|
@ -814,7 +814,6 @@ void main() {
|
|||||||
testUsingContext('parses values from JSON files and includes them in defines list', () async {
|
testUsingContext('parses values from JSON files and includes them in defines list', () async {
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('config1.json').writeAsString(
|
await fileSystem.file('config1.json').writeAsString(
|
||||||
'''
|
'''
|
||||||
{
|
{
|
||||||
@ -864,7 +863,6 @@ void main() {
|
|||||||
.file(fileSystem.path.join('lib', 'main.dart'))
|
.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.file('.env').writeAsStringSync('''
|
fileSystem.file('.env').writeAsStringSync('''
|
||||||
MY_VALUE=VALUE_FROM_ENV_FILE
|
MY_VALUE=VALUE_FROM_ENV_FILE
|
||||||
''');
|
''');
|
||||||
@ -893,7 +891,6 @@ void main() {
|
|||||||
.file(fileSystem.path.join('lib', 'main.dart'))
|
.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('.env').writeAsString('''
|
await fileSystem.file('.env').writeAsString('''
|
||||||
# comment
|
# comment
|
||||||
kInt=1
|
kInt=1
|
||||||
@ -956,7 +953,6 @@ void main() {
|
|||||||
.file(fileSystem.path.join('lib', 'main.dart'))
|
.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('.env').writeAsString('what is this');
|
await fileSystem.file('.env').writeAsString('what is this');
|
||||||
|
|
||||||
await dummyCommandRunner.run(<String>[
|
await dummyCommandRunner.run(<String>[
|
||||||
@ -982,7 +978,6 @@ void main() {
|
|||||||
.file(fileSystem.path.join('lib', 'main.dart'))
|
.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('.env').writeAsString('''
|
await fileSystem.file('.env').writeAsString('''
|
||||||
# single line value
|
# single line value
|
||||||
name=piotrfleury
|
name=piotrfleury
|
||||||
@ -1015,7 +1010,6 @@ void main() {
|
|||||||
.file(fileSystem.path.join('lib', 'main.dart'))
|
.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('.env').writeAsString('''
|
await fileSystem.file('.env').writeAsString('''
|
||||||
kInt=1
|
kInt=1
|
||||||
kDouble=1.1
|
kDouble=1.1
|
||||||
@ -1053,7 +1047,6 @@ void main() {
|
|||||||
testUsingContext('when files contain entries with duplicate keys, uses the value from the lattermost file', () async {
|
testUsingContext('when files contain entries with duplicate keys, uses the value from the lattermost file', () async {
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('config1.json').writeAsString(
|
await fileSystem.file('config1.json').writeAsString(
|
||||||
'''
|
'''
|
||||||
{
|
{
|
||||||
@ -1095,7 +1088,6 @@ void main() {
|
|||||||
testUsingContext('throws a ToolExit when the argued path points to a directory', () async {
|
testUsingContext('throws a ToolExit when the argued path points to a directory', () async {
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.directory('config').createSync();
|
fileSystem.directory('config').createSync();
|
||||||
|
|
||||||
await dummyCommandRunner.run(<String>[
|
await dummyCommandRunner.run(<String>[
|
||||||
@ -1115,7 +1107,6 @@ void main() {
|
|||||||
testUsingContext('throws a ToolExit when the given JSON file is malformed', () async {
|
testUsingContext('throws a ToolExit when the given JSON file is malformed', () async {
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
await fileSystem.file('config.json').writeAsString(
|
await fileSystem.file('config.json').writeAsString(
|
||||||
'''
|
'''
|
||||||
{
|
{
|
||||||
@ -1174,7 +1165,6 @@ void main() {
|
|||||||
testUsingContext("tool exits when FLUTTER_APP_FLAVOR is already set in user's environment", () async {
|
testUsingContext("tool exits when FLUTTER_APP_FLAVOR is already set in user's environment", () async {
|
||||||
fileSystem.file('lib/main.dart').createSync(recursive: true);
|
fileSystem.file('lib/main.dart').createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
|
|
||||||
final FakeDevice device = FakeDevice(
|
final FakeDevice device = FakeDevice(
|
||||||
'name',
|
'name',
|
||||||
@ -1204,7 +1194,6 @@ void main() {
|
|||||||
testUsingContext('tool exits when FLUTTER_APP_FLAVOR is set in --dart-define or --dart-define-from-file', () async {
|
testUsingContext('tool exits when FLUTTER_APP_FLAVOR is set in --dart-define or --dart-define-from-file', () async {
|
||||||
fileSystem.file('lib/main.dart').createSync(recursive: true);
|
fileSystem.file('lib/main.dart').createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.file('config.json')..createSync()..writeAsStringSync('{"FLUTTER_APP_FLAVOR": "strawberry"}');
|
fileSystem.file('config.json')..createSync()..writeAsStringSync('{"FLUTTER_APP_FLAVOR": "strawberry"}');
|
||||||
|
|
||||||
final FakeDevice device = FakeDevice(
|
final FakeDevice device = FakeDevice(
|
||||||
|
@ -14,7 +14,7 @@ import '../../src/common.dart';
|
|||||||
|
|
||||||
const String kEngineRoot = '/flutter/engine';
|
const String kEngineRoot = '/flutter/engine';
|
||||||
const String kArbitraryEngineRoot = '/arbitrary/engine';
|
const String kArbitraryEngineRoot = '/arbitrary/engine';
|
||||||
const String kDotPackages = '.packages';
|
const String kPackageConfig = '.dart_tool/package_config.json';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
||||||
@ -27,8 +27,20 @@ void main() {
|
|||||||
.directory('$kArbitraryEngineRoot/src/out/host_debug')
|
.directory('$kArbitraryEngineRoot/src/out/host_debug')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem
|
fileSystem
|
||||||
.file(kDotPackages)
|
.file(kPackageConfig)
|
||||||
.writeAsStringSync('sky_engine:file://$kArbitraryEngineRoot/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/');
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "sky_engine",
|
||||||
|
"rootUri": "file://$kArbitraryEngineRoot/src/out/ios_debug/gen/dart-pkg/sky_engine",
|
||||||
|
"packageUri": "lib/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
''');
|
||||||
fileSystem
|
fileSystem
|
||||||
.file('bin/cache/pkg/sky_engine/lib')
|
.file('bin/cache/pkg/sky_engine/lib')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
@ -54,8 +66,20 @@ void main() {
|
|||||||
// Verify that this also works if the sky_engine path is a symlink to the engine root.
|
// Verify that this also works if the sky_engine path is a symlink to the engine root.
|
||||||
fileSystem.link('/symlink').createSync(kArbitraryEngineRoot);
|
fileSystem.link('/symlink').createSync(kArbitraryEngineRoot);
|
||||||
fileSystem
|
fileSystem
|
||||||
.file(kDotPackages)
|
.file(kPackageConfig)
|
||||||
.writeAsStringSync('sky_engine:file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/');
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "sky_engine",
|
||||||
|
"rootUri": "file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/",
|
||||||
|
"packageUri": "lib/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
''');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug', localHostEngine: 'host_debug'),
|
await localEngineLocator.findEnginePath(localEngine: 'ios_debug', localHostEngine: 'host_debug'),
|
||||||
@ -296,7 +320,9 @@ void main() {
|
|||||||
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
||||||
'is determined by flutter root', () async {
|
'is determined by flutter root', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file(kDotPackages).writeAsStringSync('\n');
|
fileSystem
|
||||||
|
.file(kPackageConfig)
|
||||||
|
.createSync(recursive: true);
|
||||||
fileSystem
|
fileSystem
|
||||||
.directory('$kEngineRoot/src/out/ios_debug')
|
.directory('$kEngineRoot/src/out/ios_debug')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
@ -42,7 +42,10 @@ void main() {
|
|||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('test/foo.dart').createSync(recursive: true);
|
fileSystem.file('test/foo.dart').createSync(recursive: true);
|
||||||
fileSystem.file('.packages').createSync();
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
residentCompiler = FakeResidentCompiler(fileSystem);
|
residentCompiler = FakeResidentCompiler(fileSystem);
|
||||||
logger = LoggingLogger();
|
logger = LoggingLogger();
|
||||||
});
|
});
|
||||||
@ -155,7 +158,22 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
a_plugin: 1.0.0
|
a_plugin: 1.0.0
|
||||||
''');
|
''');
|
||||||
fileSystem.file('.packages').writeAsStringSync('a_plugin:/a_plugin/lib/');
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "a_plugin",
|
||||||
|
"rootUri": "/a_plugin/",
|
||||||
|
"packageUri": "lib/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
''');
|
||||||
fakeDartPlugin.childFile('pubspec.yaml')
|
fakeDartPlugin.childFile('pubspec.yaml')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('''
|
..writeAsStringSync('''
|
||||||
|
@ -37,7 +37,11 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
|
fileSystem
|
||||||
|
.directory('.dart_tool')
|
||||||
|
.childFile('package_config.json')
|
||||||
|
.createSync(recursive: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('WebBuilder sets environment on success', () async {
|
testUsingContext('WebBuilder sets environment on success', () async {
|
||||||
|
@ -909,7 +909,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1049,7 +1049,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1189,7 +1189,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1268,7 +1268,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1315,7 +1315,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1371,7 +1371,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1433,7 +1433,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: dummyCertPath,
|
tlsCertPath: dummyCertPath,
|
||||||
tlsCertKeyPath: dummyCertKeyPath,
|
tlsCertKeyPath: dummyCertKeyPath,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1613,7 +1613,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
urlTunneller: null, // ignore: avoid_redundant_argument_values
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
|
@ -740,7 +740,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -856,7 +856,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -977,7 +977,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1048,7 +1048,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1091,7 +1091,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1143,7 +1143,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1203,7 +1203,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: dummyCertPath,
|
tlsCertPath: dummyCertPath,
|
||||||
tlsCertKeyPath: dummyCertKeyPath,
|
tlsCertKeyPath: dummyCertKeyPath,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
@ -1366,7 +1366,7 @@ void main() {
|
|||||||
port: 0,
|
port: 0,
|
||||||
tlsCertPath: null,
|
tlsCertPath: null,
|
||||||
tlsCertKeyPath: null,
|
tlsCertKeyPath: null,
|
||||||
packagesFilePath: '.packages',
|
packagesFilePath: '.dart_tool/package_config.json',
|
||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
|
@ -200,7 +200,7 @@ void writeGeneratedPluginRegistrant(FileSystem fs) {
|
|||||||
// (taken from commands.shard/hermetic/build_web_test.dart)
|
// (taken from commands.shard/hermetic/build_web_test.dart)
|
||||||
void setupFileSystemForEndToEndTest(FileSystem fileSystem) {
|
void setupFileSystemForEndToEndTest(FileSystem fileSystem) {
|
||||||
final List<String> dependencies = <String>[
|
final List<String> dependencies = <String>[
|
||||||
'.packages',
|
fileSystem.path.join('.dart_tool', 'package_config.json'),
|
||||||
fileSystem.path.join('web', 'index.html'),
|
fileSystem.path.join('web', 'index.html'),
|
||||||
fileSystem.path.join('lib', 'main.dart'),
|
fileSystem.path.join('lib', 'main.dart'),
|
||||||
fileSystem.path.join('packages', 'flutter_tools', 'lib', 'src', 'build_system', 'targets', 'web.dart'),
|
fileSystem.path.join('packages', 'flutter_tools', 'lib', 'src', 'build_system', 'targets', 'web.dart'),
|
||||||
@ -214,11 +214,6 @@ void setupFileSystemForEndToEndTest(FileSystem fileSystem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Project files.
|
// Project files.
|
||||||
fileSystem.file('.packages')
|
|
||||||
.writeAsStringSync('''
|
|
||||||
foo:lib/
|
|
||||||
fizz:bar/lib/
|
|
||||||
''');
|
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
.writeAsStringSync('''
|
.writeAsStringSync('''
|
||||||
name: foo
|
name: foo
|
||||||
|
@ -68,7 +68,6 @@ void main() {
|
|||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.directory('windows').createSync();
|
fileSystem.directory('windows').createSync();
|
||||||
fileSystem.file(fileSystem.path.join('windows', 'CMakeLists.txt')).createSync();
|
fileSystem.file(fileSystem.path.join('windows', 'CMakeLists.txt')).createSync();
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
@ -80,7 +79,6 @@ void main() {
|
|||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
expect(windowsDevice.isSupportedForProject(flutterProject), false);
|
expect(windowsDevice.isSupportedForProject(flutterProject), false);
|
||||||
@ -90,7 +88,6 @@ void main() {
|
|||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fileSystem.file('.packages').createSync();
|
|
||||||
fileSystem.directory('windows').createSync();
|
fileSystem.directory('windows').createSync();
|
||||||
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = setUpFlutterProject(fileSystem.currentDirectory);
|
||||||
|
|
||||||
|
@ -95,9 +95,6 @@ void main() {
|
|||||||
directory
|
directory
|
||||||
.childFile('pubspec.yaml')
|
.childFile('pubspec.yaml')
|
||||||
.writeAsStringSync('name: foo');
|
.writeAsStringSync('name: foo');
|
||||||
directory
|
|
||||||
.childFile('.packages')
|
|
||||||
.writeAsStringSync('\n');
|
|
||||||
directory
|
directory
|
||||||
.childDirectory('lib')
|
.childDirectory('lib')
|
||||||
.childFile('main.dart')
|
.childFile('main.dart')
|
||||||
|
@ -62,7 +62,7 @@ abstract class Project {
|
|||||||
writeFile(fileSystem.path.join(dir.path, 'web', 'index.html'), indexHtml);
|
writeFile(fileSystem.path.join(dir.path, 'web', 'index.html'), indexHtml);
|
||||||
writeFile(fileSystem.path.join(dir.path, 'web', 'flutter.js'), '');
|
writeFile(fileSystem.path.join(dir.path, 'web', 'flutter.js'), '');
|
||||||
writeFile(fileSystem.path.join(dir.path, 'web', 'flutter_service_worker.js'), '');
|
writeFile(fileSystem.path.join(dir.path, 'web', 'flutter_service_worker.js'), '');
|
||||||
writePackages(dir.path);
|
writePackageConfig(dir.path);
|
||||||
await getPackages(dir.path);
|
await getPackages(dir.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,18 @@ void writeBytesFile(String path, List<int> content) {
|
|||||||
..writeAsBytesSync(content, flush: true);
|
..writeAsBytesSync(content, flush: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void writePackages(String folder) {
|
void writePackageConfig(String folder) {
|
||||||
writeFile(fileSystem.path.join(folder, '.packages'), '''
|
writeFile(fileSystem.path.join(folder, '.dart_tool', 'package_config.json'), '''
|
||||||
test:${fileSystem.path.join(fileSystem.currentDirectory.path, 'lib')}/
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "test",
|
||||||
|
"rootUri": "fileSystem.currentDirectory.path"
|
||||||
|
"packageUri": "lib/",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user