Unverified Commit 04182572 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] allow bypassing context for FlutterProject creation, remove fromPath (#76258)

parent c785efad
...@@ -145,6 +145,6 @@ class BuildAarCommand extends BuildSubCommand { ...@@ -145,6 +145,6 @@ class BuildAarCommand extends BuildSubCommand {
if (argResults.rest.isEmpty) { if (argResults.rest.isEmpty) {
return FlutterProject.current(); return FlutterProject.current();
} }
return FlutterProject.fromPath(findProjectRoot(argResults.rest.first)); return FlutterProject.fromDirectory(globals.fs.directory(findProjectRoot(argResults.rest.first)));
} }
} }
...@@ -70,7 +70,7 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -70,7 +70,7 @@ class BuildBundleCommand extends BuildSubCommand {
@override @override
Future<Map<CustomDimensions, String>> get usageValues async { Future<Map<CustomDimensions, String>> get usageValues async {
final String projectDir = globals.fs.file(targetFile).parent.parent.path; final String projectDir = globals.fs.file(targetFile).parent.parent.path;
final FlutterProject flutterProject = FlutterProject.fromPath(projectDir); final FlutterProject flutterProject = FlutterProject.fromDirectory(globals.fs.directory(projectDir));
if (flutterProject == null) { if (flutterProject == null) {
return const <CustomDimensions, String>{}; return const <CustomDimensions, String>{};
} }
......
...@@ -310,7 +310,7 @@ class CreateCommand extends CreateBase { ...@@ -310,7 +310,7 @@ class CreateCommand extends CreateBase {
_printPluginAddPlatformMessage(relativePluginPath); _printPluginAddPlatformMessage(relativePluginPath);
} else { } else {
// Tell the user the next steps. // Tell the user the next steps.
final FlutterProject project = FlutterProject.fromPath(projectDirPath); final FlutterProject project = FlutterProject.fromDirectory(globals.fs.directory(projectDirPath));
final FlutterProject app = project.hasExampleApp ? project.example : project; final FlutterProject app = project.hasExampleApp ? project.example : project;
final String relativeAppPath = globals.fs.path.normalize(globals.fs.path.relative(app.directory.path)); final String relativeAppPath = globals.fs.path.normalize(globals.fs.path.relative(app.directory.path));
final String relativeAppMain = globals.fs.path.join(relativeAppPath, 'lib', 'main.dart'); final String relativeAppMain = globals.fs.path.join(relativeAppPath, 'lib', 'main.dart');
......
...@@ -88,7 +88,7 @@ class PackagesGetCommand extends FlutterCommand { ...@@ -88,7 +88,7 @@ class PackagesGetCommand extends FlutterCommand {
if (target == null) { if (target == null) {
return usageValues; return usageValues;
} }
final FlutterProject rootProject = FlutterProject.fromPath(target); final FlutterProject rootProject = FlutterProject.fromDirectory(globals.fs.directory(target));
// Do not send plugin analytics if pub has not run before. // Do not send plugin analytics if pub has not run before.
final bool hasPlugins = rootProject.flutterPluginsDependenciesFile.existsSync() final bool hasPlugins = rootProject.flutterPluginsDependenciesFile.existsSync()
&& rootProject.packagesFile.existsSync() && rootProject.packagesFile.existsSync()
...@@ -160,7 +160,7 @@ class PackagesGetCommand extends FlutterCommand { ...@@ -160,7 +160,7 @@ class PackagesGetCommand extends FlutterCommand {
'${ workingDirectory ?? "current working directory" }.' '${ workingDirectory ?? "current working directory" }.'
); );
} }
final FlutterProject rootProject = FlutterProject.fromPath(target); final FlutterProject rootProject = FlutterProject.fromDirectory(globals.fs.directory(target));
await _runPubGet(target, rootProject); await _runPubGet(target, rootProject);
await rootProject.regeneratePlatformSpecificTooling(); await rootProject.regeneratePlatformSpecificTooling();
...@@ -311,7 +311,7 @@ class PackagesInteractiveGetCommand extends FlutterCommand { ...@@ -311,7 +311,7 @@ class PackagesInteractiveGetCommand extends FlutterCommand {
throwToolExit('Expected to find project root in ' throwToolExit('Expected to find project root in '
'current working directory.'); 'current working directory.');
} }
final FlutterProject flutterProject = FlutterProject.fromPath(target); final FlutterProject flutterProject = FlutterProject.fromDirectory(globals.fs.directory(target));
if (flutterProject.manifest.generateSyntheticPackage) { if (flutterProject.manifest.generateSyntheticPackage) {
final Environment environment = Environment( final Environment environment = Environment(
......
...@@ -86,9 +86,25 @@ class FlutterProject { ...@@ -86,9 +86,25 @@ class FlutterProject {
/// if `pubspec.yaml` or `example/pubspec.yaml` is invalid. /// if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
static FlutterProject current() => globals.projectFactory.fromDirectory(globals.fs.currentDirectory); static FlutterProject current() => globals.projectFactory.fromDirectory(globals.fs.currentDirectory);
/// Returns a [FlutterProject] view of the given directory or a ToolExit error, /// Create a [FlutterProject] and bypass the project caching.
/// if `pubspec.yaml` or `example/pubspec.yaml` is invalid. @visibleForTesting
static FlutterProject fromPath(String path) => globals.projectFactory.fromDirectory(globals.fs.directory(path)); static FlutterProject fromDirectoryTest(Directory directory, [Logger logger]) {
final FileSystem fileSystem = directory.fileSystem;
logger ??= BufferLogger.test();
final FlutterManifest manifest = FlutterProject._readManifest(
directory.childFile(bundle.defaultManifestPath).path,
logger: logger,
fileSystem: fileSystem,
);
final FlutterManifest exampleManifest = FlutterProject._readManifest(
FlutterProject._exampleDirectory(directory)
.childFile(bundle.defaultManifestPath)
.path,
logger: logger,
fileSystem: fileSystem,
);
return FlutterProject(directory, manifest, exampleManifest);
}
/// The location of this project. /// The location of this project.
final Directory directory; final Directory directory;
......
...@@ -465,7 +465,7 @@ set(BINARY_NAME "fizz_bar") ...@@ -465,7 +465,7 @@ set(BINARY_NAME "fizz_bar")
'''); ''');
fileSystem.file('pubspec.yaml').createSync(); fileSystem.file('pubspec.yaml').createSync();
fileSystem.file('.packages').createSync(); fileSystem.file('.packages').createSync();
final FlutterProject flutterProject = FlutterProject.current(); final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
expect(getCmakeExecutableName(flutterProject.linux), 'fizz_bar'); expect(getCmakeExecutableName(flutterProject.linux), 'fizz_bar');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
......
...@@ -52,9 +52,10 @@ void main() { ...@@ -52,9 +52,10 @@ void main() {
testUsingContext('Refuses to build for web when missing index.html', () async { testUsingContext('Refuses to build for web when missing index.html', () async {
fileSystem.file(fileSystem.path.join('web', 'index.html')).deleteSync(); fileSystem.file(fileSystem.path.join('web', 'index.html')).deleteSync();
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
expect(buildWeb( expect(buildWeb(
FlutterProject.current(), project,
fileSystem.path.join('lib', 'main.dart'), fileSystem.path.join('lib', 'main.dart'),
BuildInfo.debug, BuildInfo.debug,
false, false,
......
...@@ -114,7 +114,7 @@ void main() { ...@@ -114,7 +114,7 @@ void main() {
bool handlerCalled = false; bool handlerCalled = false;
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -219,7 +219,7 @@ void main() { ...@@ -219,7 +219,7 @@ void main() {
int testFnCalled = 0; int testFnCalled = 0;
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -311,7 +311,7 @@ void main() { ...@@ -311,7 +311,7 @@ void main() {
bool handlerCalled = false; bool handlerCalled = false;
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -403,7 +403,7 @@ void main() { ...@@ -403,7 +403,7 @@ void main() {
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -483,7 +483,7 @@ void main() { ...@@ -483,7 +483,7 @@ void main() {
.createSync(recursive: true); .createSync(recursive: true);
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -595,7 +595,7 @@ void main() { ...@@ -595,7 +595,7 @@ void main() {
..writeAsStringSync('{}'); ..writeAsStringSync('{}');
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -681,7 +681,7 @@ void main() { ...@@ -681,7 +681,7 @@ void main() {
bool builtPluginAsAar = false; bool builtPluginAsAar = false;
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -781,7 +781,7 @@ void main() { ...@@ -781,7 +781,7 @@ void main() {
.createSync(recursive: true); .createSync(recursive: true);
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -850,7 +850,7 @@ void main() { ...@@ -850,7 +850,7 @@ void main() {
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)),
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
buildNumber: '1.0', buildNumber: '1.0',
...@@ -919,7 +919,7 @@ void main() { ...@@ -919,7 +919,7 @@ void main() {
await expectLater(() async => await expectLater(() async =>
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)),
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
buildNumber: '1.0', buildNumber: '1.0',
...@@ -989,7 +989,7 @@ void main() { ...@@ -989,7 +989,7 @@ void main() {
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -1067,7 +1067,7 @@ void main() { ...@@ -1067,7 +1067,7 @@ void main() {
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -1145,7 +1145,7 @@ void main() { ...@@ -1145,7 +1145,7 @@ void main() {
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -1223,7 +1223,7 @@ void main() { ...@@ -1223,7 +1223,7 @@ void main() {
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -1281,7 +1281,7 @@ void main() { ...@@ -1281,7 +1281,7 @@ void main() {
await expectLater(() async { await expectLater(() async {
await builder.buildGradleApp( await builder.buildGradleApp(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo( BuildInfo(
BuildMode.release, BuildMode.release,
...@@ -1373,7 +1373,7 @@ void main() { ...@@ -1373,7 +1373,7 @@ void main() {
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)),
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
buildNumber: '2.0', buildNumber: '2.0',
...@@ -1462,7 +1462,7 @@ void main() { ...@@ -1462,7 +1462,7 @@ void main() {
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo(BuildMode.release, null, treeShakeIcons: false)), BuildInfo(BuildMode.release, null, treeShakeIcons: false)),
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
buildNumber: '2.0', buildNumber: '2.0',
...@@ -1551,7 +1551,7 @@ void main() { ...@@ -1551,7 +1551,7 @@ void main() {
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo(BuildMode.release, null, treeShakeIcons: false)), BuildInfo(BuildMode.release, null, treeShakeIcons: false)),
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
buildNumber: '2.0', buildNumber: '2.0',
...@@ -1640,7 +1640,7 @@ void main() { ...@@ -1640,7 +1640,7 @@ void main() {
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo(BuildMode.release, null, treeShakeIcons: false)), BuildInfo(BuildMode.release, null, treeShakeIcons: false)),
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
buildNumber: '2.0', buildNumber: '2.0',
......
...@@ -352,7 +352,7 @@ Command: /home/android/gradlew assembleRelease ...@@ -352,7 +352,7 @@ Command: /home/android/gradlew assembleRelease
testUsingContext('handler - no plugins', () async { testUsingContext('handler - no plugins', () async {
final GradleBuildStatus status = await androidXFailureHandler final GradleBuildStatus status = await androidXFailureHandler
.handler(line: '', project: FlutterProject.current()); .handler(line: '', project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory));
expect(testUsage.events, contains( expect(testUsage.events, contains(
const TestUsageEvent( const TestUsageEvent(
...@@ -378,7 +378,7 @@ Command: /home/android/gradlew assembleRelease ...@@ -378,7 +378,7 @@ Command: /home/android/gradlew assembleRelease
final GradleBuildStatus status = await androidXFailureHandler final GradleBuildStatus status = await androidXFailureHandler
.handler( .handler(
line: '', line: '',
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
usesAndroidX: false, usesAndroidX: false,
); );
...@@ -412,7 +412,7 @@ Command: /home/android/gradlew assembleRelease ...@@ -412,7 +412,7 @@ Command: /home/android/gradlew assembleRelease
final GradleBuildStatus status = await androidXFailureHandler.handler( final GradleBuildStatus status = await androidXFailureHandler.handler(
line: '', line: '',
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
usesAndroidX: true, usesAndroidX: true,
shouldBuildPluginAsAar: true, shouldBuildPluginAsAar: true,
); );
...@@ -440,7 +440,7 @@ Command: /home/android/gradlew assembleRelease ...@@ -440,7 +440,7 @@ Command: /home/android/gradlew assembleRelease
final GradleBuildStatus status = await androidXFailureHandler.handler( final GradleBuildStatus status = await androidXFailureHandler.handler(
line: '', line: '',
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
usesAndroidX: true, usesAndroidX: true,
shouldBuildPluginAsAar: false, shouldBuildPluginAsAar: false,
); );
...@@ -509,7 +509,7 @@ Command: /home/android/gradlew assembleRelease ...@@ -509,7 +509,7 @@ Command: /home/android/gradlew assembleRelease
testUsingContext('handler', () async { testUsingContext('handler', () async {
await licenseNotAcceptedHandler.handler( await licenseNotAcceptedHandler.handler(
line: 'You have not accepted the license agreements of the following SDK components: [foo, bar]', line: 'You have not accepted the license agreements of the following SDK components: [foo, bar]',
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
); );
expect( expect(
...@@ -581,7 +581,7 @@ assembleFooTest ...@@ -581,7 +581,7 @@ assembleFooTest
)); ));
await flavorUndefinedHandler.handler( await flavorUndefinedHandler.handler(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
); );
expect( expect(
...@@ -623,7 +623,7 @@ assembleProfile ...@@ -623,7 +623,7 @@ assembleProfile
)); ));
await flavorUndefinedHandler.handler( await flavorUndefinedHandler.handler(
project: FlutterProject.current(), project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
); );
expect( expect(
......
...@@ -314,7 +314,7 @@ void main() { ...@@ -314,7 +314,7 @@ void main() {
}); });
testUsingContext('aab not found', () { testUsingContext('aab not found', () {
final FlutterProject project = FlutterProject.current(); final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
expect( expect(
() { () {
findBundleFile(project, const BuildInfo(BuildMode.debug, 'foo_bar', treeShakeIcons: false), BufferLogger.test()); findBundleFile(project, const BuildInfo(BuildMode.debug, 'foo_bar', treeShakeIcons: false), BufferLogger.test());
...@@ -404,7 +404,7 @@ void main() { ...@@ -404,7 +404,7 @@ void main() {
group('gradle build', () { group('gradle build', () {
testUsingContext('do not crash if there is no Android SDK', () async { testUsingContext('do not crash if there is no Android SDK', () async {
expect(() { expect(() {
updateLocalProperties(project: FlutterProject.current()); updateLocalProperties(project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory));
}, throwsToolExit( }, throwsToolExit(
message: '$warningMark No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.', message: '$warningMark No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.',
)); ));
...@@ -573,7 +573,7 @@ include ':app' ...@@ -573,7 +573,7 @@ include ':app'
updateLocalProperties( updateLocalProperties(
project: FlutterProject.fromPath('path/to/project'), project: FlutterProject.fromDirectoryTest(globals.fs.directory('path/to/project')),
buildInfo: buildInfo, buildInfo: buildInfo,
requireAndroidSdk: false, requireAndroidSdk: false,
); );
...@@ -966,7 +966,7 @@ plugin2=${plugin2.path} ...@@ -966,7 +966,7 @@ plugin2=${plugin2.path}
)); ));
await builder.buildPluginsAsAar( await builder.buildPluginsAsAar(
FlutterProject.fromPath(androidDirectory.path), FlutterProject.fromDirectoryTest(androidDirectory),
const AndroidBuildInfo(BuildInfo( const AndroidBuildInfo(BuildInfo(
BuildMode.release, BuildMode.release,
'', '',
...@@ -1019,7 +1019,7 @@ plugin1=${plugin1.path} ...@@ -1019,7 +1019,7 @@ plugin1=${plugin1.path}
.createSync(recursive: true); .createSync(recursive: true);
await builder.buildPluginsAsAar( await builder.buildPluginsAsAar(
FlutterProject.fromPath(androidDirectory.path), FlutterProject.fromDirectoryTest(androidDirectory),
const AndroidBuildInfo(BuildInfo.release), const AndroidBuildInfo(BuildInfo.release),
buildDirectory: buildDirectory, buildDirectory: buildDirectory,
); );
......
...@@ -41,6 +41,7 @@ void main() { ...@@ -41,6 +41,7 @@ void main() {
FakeProcessManager fakeProcessManager; FakeProcessManager fakeProcessManager;
MemoryFileSystem fs; MemoryFileSystem fs;
Cache cache; Cache cache;
final Map<Type, Generator> overrides = <Type, Generator>{ final Map<Type, Generator> overrides = <Type, Generator>{
AndroidSdk: () => sdk, AndroidSdk: () => sdk,
ProcessManager: () => fakeProcessManager, ProcessManager: () => fakeProcessManager,
...@@ -57,7 +58,7 @@ void main() { ...@@ -57,7 +58,7 @@ void main() {
); );
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
when(sdk.licensesAvailable).thenReturn(true); when(sdk.licensesAvailable).thenReturn(true);
final FlutterProject project = FlutterProject.current(); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.currentDirectory);
fs.file(project.android.hostAppGradleRoot.childFile( fs.file(project.android.hostAppGradleRoot.childFile(
globals.platform.isWindows ? 'gradlew.bat' : 'gradlew', globals.platform.isWindows ? 'gradlew.bat' : 'gradlew',
).path).createSync(recursive: true); ).path).createSync(recursive: true);
...@@ -96,7 +97,7 @@ void main() { ...@@ -96,7 +97,7 @@ void main() {
testUsingContext('Licenses available, build tools not, apk exists', () async { testUsingContext('Licenses available, build tools not, apk exists', () async {
when(sdk.latestVersion).thenReturn(null); when(sdk.latestVersion).thenReturn(null);
final FlutterProject project = FlutterProject.current(); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.currentDirectory);
final File gradle = project.android.hostAppGradleRoot.childFile( final File gradle = project.android.hostAppGradleRoot.childFile(
globals.platform.isWindows ? 'gradlew.bat' : 'gradlew', globals.platform.isWindows ? 'gradlew.bat' : 'gradlew',
)..createSync(recursive: true); )..createSync(recursive: true);
......
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
}); });
await buildWithAssemble( await buildWithAssemble(
buildMode: BuildMode.debug, buildMode: BuildMode.debug,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: globals.fs.path.join('lib', 'main.dart'), mainPath: globals.fs.path.join('lib', 'main.dart'),
outputDir: 'example', outputDir: 'example',
targetPlatform: TargetPlatform.ios, targetPlatform: TargetPlatform.ios,
...@@ -57,7 +57,7 @@ void main() { ...@@ -57,7 +57,7 @@ void main() {
expect(() => buildWithAssemble( expect(() => buildWithAssemble(
buildMode: BuildMode.debug, buildMode: BuildMode.debug,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: 'lib/main.dart', mainPath: 'lib/main.dart',
outputDir: 'example', outputDir: 'example',
targetPlatform: TargetPlatform.linux_x64, targetPlatform: TargetPlatform.linux_x64,
......
...@@ -175,18 +175,16 @@ void main() { ...@@ -175,18 +175,16 @@ void main() {
verify(mockPortForwarder.dispose()).called(1); verify(mockPortForwarder.dispose()).called(1);
}); });
testUsingContext('default capabilities', () async { testWithoutContext('default capabilities', () async {
final FuchsiaDevice device = FuchsiaDevice('123'); final FuchsiaDevice device = FuchsiaDevice('123');
globals.fs.directory('fuchsia').createSync(recursive: true); final FlutterProject project = FlutterProject.fromDirectoryTest(memoryFileSystem.currentDirectory);
globals.fs.file('pubspec.yaml').createSync(); memoryFileSystem.directory('fuchsia').createSync(recursive: true);
memoryFileSystem.file('pubspec.yaml').createSync();
expect(device.supportsHotReload, true); expect(device.supportsHotReload, true);
expect(device.supportsHotRestart, false); expect(device.supportsHotRestart, false);
expect(device.supportsFlutterExit, false); expect(device.supportsFlutterExit, false);
expect(device.isSupportedForProject(FlutterProject.current()), true); expect(device.isSupportedForProject(project), true);
}, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(),
}); });
test('is ephemeral', () { test('is ephemeral', () {
...@@ -195,25 +193,21 @@ void main() { ...@@ -195,25 +193,21 @@ void main() {
expect(device.ephemeral, true); expect(device.ephemeral, true);
}); });
testUsingContext('supported for project', () async { testWithoutContext('supported for project', () async {
final FuchsiaDevice device = FuchsiaDevice('123'); final FuchsiaDevice device = FuchsiaDevice('123');
globals.fs.directory('fuchsia').createSync(recursive: true); final FlutterProject project = FlutterProject.fromDirectoryTest(memoryFileSystem.currentDirectory);
globals.fs.file('pubspec.yaml').createSync(); memoryFileSystem.directory('fuchsia').createSync(recursive: true);
memoryFileSystem.file('pubspec.yaml').createSync();
expect(device.isSupportedForProject(FlutterProject.current()), true); expect(device.isSupportedForProject(project), true);
}, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(),
}); });
testUsingContext('not supported for project', () async { testWithoutContext('not supported for project', () async {
final FuchsiaDevice device = FuchsiaDevice('123'); final FuchsiaDevice device = FuchsiaDevice('123');
globals.fs.file('pubspec.yaml').createSync(); final FlutterProject project = FlutterProject.fromDirectoryTest(memoryFileSystem.currentDirectory);
memoryFileSystem.file('pubspec.yaml').createSync();
expect(device.isSupportedForProject(FlutterProject.current()), false); expect(device.isSupportedForProject(project), false);
}, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(),
}); });
testUsingContext('targetPlatform does not throw when sshConfig is missing', () async { testUsingContext('targetPlatform does not throw when sshConfig is missing', () async {
...@@ -945,7 +939,7 @@ void main() { ...@@ -945,7 +939,7 @@ void main() {
..writeAsStringSync('{}'); ..writeAsStringSync('{}');
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
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);
app = BuildableFuchsiaApp(project: FlutterProject.current().fuchsia); app = BuildableFuchsiaApp(project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory).fuchsia);
} }
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(BuildInfo(mode, null, treeShakeIcons: false)); final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(BuildInfo(mode, null, treeShakeIcons: false));
......
...@@ -931,7 +931,7 @@ flutter: ...@@ -931,7 +931,7 @@ flutter:
module: {} module: {}
'''); ''');
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
final FlutterProject flutterProject = FlutterProject.current(); final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
final IOSSimulator simulator = IOSSimulator( final IOSSimulator simulator = IOSSimulator(
'test', 'test',
...@@ -949,7 +949,7 @@ flutter: ...@@ -949,7 +949,7 @@ flutter:
globals.fs.file('pubspec.yaml').createSync(); globals.fs.file('pubspec.yaml').createSync();
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
globals.fs.directory('ios').createSync(); globals.fs.directory('ios').createSync();
final FlutterProject flutterProject = FlutterProject.current(); final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
final IOSSimulator simulator = IOSSimulator( final IOSSimulator simulator = IOSSimulator(
'test', 'test',
...@@ -965,7 +965,7 @@ flutter: ...@@ -965,7 +965,7 @@ 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(); globals.fs.file('.packages').createSync();
final FlutterProject flutterProject = FlutterProject.current(); final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
final IOSSimulator simulator = IOSSimulator( final IOSSimulator simulator = IOSSimulator(
'test', 'test',
......
...@@ -668,7 +668,7 @@ Information about project "Runner": ...@@ -668,7 +668,7 @@ Information about project "Runner":
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo.debug; const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
buildInfo: buildInfo, buildInfo: buildInfo,
...@@ -696,7 +696,7 @@ Information about project "Runner": ...@@ -696,7 +696,7 @@ Information about project "Runner":
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_debug_sim_unopt')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_debug_sim_unopt'));
const BuildInfo buildInfo = BuildInfo.debug; const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
buildInfo: buildInfo, buildInfo: buildInfo,
...@@ -723,7 +723,7 @@ Information about project "Runner": ...@@ -723,7 +723,7 @@ Information about project "Runner":
.thenReturn('engine'); .thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, treeShakeIcons: false);
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
buildInfo: buildInfo, buildInfo: buildInfo,
...@@ -750,7 +750,7 @@ Information about project "Runner": ...@@ -750,7 +750,7 @@ Information about project "Runner":
.thenReturn('engine'); .thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo.debug; const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
buildInfo: buildInfo, buildInfo: buildInfo,
...@@ -778,7 +778,7 @@ Information about project "Runner": ...@@ -778,7 +778,7 @@ Information about project "Runner":
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
const BuildInfo buildInfo = BuildInfo.debug; const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
buildInfo: buildInfo, buildInfo: buildInfo,
...@@ -818,7 +818,7 @@ Information about project "Runner": ...@@ -818,7 +818,7 @@ Information about project "Runner":
manifestFile.writeAsStringSync(manifestString); manifestFile.writeAsStringSync(manifestString);
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: FlutterProject.fromPath('path/to/project'), project: FlutterProject.fromDirectoryTest(fs.directory('path/to/project')),
buildInfo: buildInfo, buildInfo: buildInfo,
); );
......
...@@ -194,7 +194,7 @@ void main() { ...@@ -194,7 +194,7 @@ void main() {
'SWIFT_VERSION': '5.0', 'SWIFT_VERSION': '5.0',
}); });
final FlutterProject project = FlutterProject.fromPath('project'); final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.directory('project'));
await cocoaPodsUnderTest.setupPodfile(project.ios); await cocoaPodsUnderTest.setupPodfile(project.ios);
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template'); expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template');
...@@ -214,7 +214,7 @@ void main() { ...@@ -214,7 +214,7 @@ void main() {
testUsingContext('does not recreate Podfile when already present', () async { testUsingContext('does not recreate Podfile when already present', () async {
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile'); projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
final FlutterProject project = FlutterProject.fromPath('project'); final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.directory('project'));
await cocoaPodsUnderTest.setupPodfile(project.ios); await cocoaPodsUnderTest.setupPodfile(project.ios);
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile'); expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile');
...@@ -226,7 +226,7 @@ void main() { ...@@ -226,7 +226,7 @@ void main() {
testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async { testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async {
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(false); when(mockXcodeProjectInterpreter.isInstalled).thenReturn(false);
final FlutterProject project = FlutterProject.fromPath('project'); final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.directory('project'));
await cocoaPodsUnderTest.setupPodfile(project.ios); await cocoaPodsUnderTest.setupPodfile(project.ios);
expect(projectUnderTest.ios.podfile.existsSync(), false); expect(projectUnderTest.ios.podfile.existsSync(), false);
...@@ -245,7 +245,7 @@ void main() { ...@@ -245,7 +245,7 @@ void main() {
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('Existing release config'); ..writeAsStringSync('Existing release config');
final FlutterProject project = FlutterProject.fromPath('project'); final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.directory('project'));
await cocoaPodsUnderTest.setupPodfile(project.ios); await cocoaPodsUnderTest.setupPodfile(project.ios);
final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync(); final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
...@@ -273,7 +273,7 @@ void main() { ...@@ -273,7 +273,7 @@ void main() {
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync(legacyReleaseInclude); ..writeAsStringSync(legacyReleaseInclude);
final FlutterProject project = FlutterProject.fromPath('project'); final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.directory('project'));
await cocoaPodsUnderTest.setupPodfile(project.ios); await cocoaPodsUnderTest.setupPodfile(project.ios);
final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync(); final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
...@@ -305,7 +305,7 @@ void main() { ...@@ -305,7 +305,7 @@ void main() {
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('Existing release config'); ..writeAsStringSync('Existing release config');
final FlutterProject project = FlutterProject.fromPath('project'); final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.directory('project'));
await injectPlugins(project, iosPlatform: true); await injectPlugins(project, iosPlatform: true);
final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync(); final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
......
...@@ -118,7 +118,7 @@ void main() { ...@@ -118,7 +118,7 @@ void main() {
directory.absolute.path, directory.absolute.path,
); );
expect( expect(
FlutterProject.fromPath(directory.path).directory.absolute.path, FlutterProject.fromDirectoryTest(directory).directory.absolute.path,
directory.absolute.path, directory.absolute.path,
); );
expect( expect(
......
...@@ -48,9 +48,10 @@ void main() { ...@@ -48,9 +48,10 @@ void main() {
}); });
testbed = Testbed( testbed = Testbed(
setup: () { setup: () {
final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
residentWebRunner = residentWebRunner = DwdsWebRunnerFactory().createWebRunner( residentWebRunner = residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: project,
debuggingOptions: DebuggingOptions.disabled(BuildInfo.release), debuggingOptions: DebuggingOptions.disabled(BuildInfo.release),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
......
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -203,7 +203,7 @@ void main() { ...@@ -203,7 +203,7 @@ void main() {
)); ));
final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -224,7 +224,7 @@ void main() { ...@@ -224,7 +224,7 @@ void main() {
..writeAsStringSync('\n'); ..writeAsStringSync('\n');
final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -234,7 +234,7 @@ void main() { ...@@ -234,7 +234,7 @@ void main() {
when(mockFlutterDevice.device).thenReturn(mockChromeDevice); when(mockFlutterDevice.device).thenReturn(mockChromeDevice);
final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.profile), debuggingOptions: DebuggingOptions.enabled(BuildInfo.profile),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -341,7 +341,7 @@ void main() { ...@@ -341,7 +341,7 @@ void main() {
.deleteSync(); .deleteSync();
final ResidentWebRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentWebRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: false, stayResident: false,
...@@ -363,7 +363,7 @@ void main() { ...@@ -363,7 +363,7 @@ void main() {
_setupMocks(); _setupMocks();
final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: false, stayResident: false,
...@@ -487,7 +487,7 @@ void main() { ...@@ -487,7 +487,7 @@ void main() {
testUsingContext('Does not run main with --start-paused', () async { testUsingContext('Does not run main with --start-paused', () async {
final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -1459,7 +1459,7 @@ void main() { ...@@ -1459,7 +1459,7 @@ void main() {
fakeStatusLogger.status = mockStatus; fakeStatusLogger.status = mockStatus;
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner( final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -1506,7 +1506,7 @@ void main() { ...@@ -1506,7 +1506,7 @@ void main() {
fakeStatusLogger.status = mockStatus; fakeStatusLogger.status = mockStatus;
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner( final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
...@@ -1635,7 +1635,7 @@ void main() { ...@@ -1635,7 +1635,7 @@ void main() {
ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice) { ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice) {
return DwdsWebRunnerFactory().createWebRunner( return DwdsWebRunnerFactory().createWebRunner(
flutterDevice, flutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: true, stayResident: true,
......
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
testUsingContext('TestCompiler reports a dill file when compile is successful', () async { testUsingContext('TestCompiler reports a dill file when compile is successful', () async {
final FakeTestCompiler testCompiler = FakeTestCompiler( final FakeTestCompiler testCompiler = FakeTestCompiler(
debugBuild, debugBuild,
FlutterProject.current(), FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
residentCompiler, residentCompiler,
); );
when(residentCompiler.recompile( when(residentCompiler.recompile(
...@@ -72,7 +72,7 @@ void main() { ...@@ -72,7 +72,7 @@ void main() {
testUsingContext('TestCompiler reports null when a compile fails', () async { testUsingContext('TestCompiler reports null when a compile fails', () async {
final FakeTestCompiler testCompiler = FakeTestCompiler( final FakeTestCompiler testCompiler = FakeTestCompiler(
debugBuild, debugBuild,
FlutterProject.current(), FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
residentCompiler, residentCompiler,
); );
when(residentCompiler.recompile( when(residentCompiler.recompile(
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
testUsingContext('TestCompiler disposing test compiler shuts down backing compiler', () async { testUsingContext('TestCompiler disposing test compiler shuts down backing compiler', () async {
final FakeTestCompiler testCompiler = FakeTestCompiler( final FakeTestCompiler testCompiler = FakeTestCompiler(
debugBuild, debugBuild,
FlutterProject.current(), FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
residentCompiler, residentCompiler,
); );
testCompiler.compiler = residentCompiler; testCompiler.compiler = residentCompiler;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment