Define and use flutterBin consistently across integration.shard. (#159007)

Towards https://github.com/flutter/flutter/issues/158875.

This should be a NOP, and just reduce the amount of copy-pasted code
across tests.
This commit is contained in:
Matan Lurey 2024-11-18 11:00:04 -08:00 committed by GitHub
parent 74384004ce
commit 03c13af0b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 11 additions and 176 deletions

View File

@ -20,7 +20,6 @@ const String runDevToolsMessage = 'dart devtools ';
void main() { void main() {
testWithoutContext('--analyze-size flag produces expected output on hello_world for Android', () async { testWithoutContext('--analyze-size flag produces expected output on hello_world for Android', () async {
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'build', 'build',
@ -53,7 +52,6 @@ void main() {
testWithoutContext('--analyze-size flag produces expected output on hello_world for iOS', () async { testWithoutContext('--analyze-size flag produces expected output on hello_world for iOS', () async {
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.'); final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.');
final Directory codeSizeDir = tempDir.childDirectory('code size dir')..createSync(); final Directory codeSizeDir = tempDir.childDirectory('code size dir')..createSync();
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
@ -91,7 +89,6 @@ void main() {
testWithoutContext('--analyze-size flag produces expected output on hello_world for macOS', () async { testWithoutContext('--analyze-size flag produces expected output on hello_world for macOS', () async {
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.'); final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.');
final Directory codeSizeDir = tempDir.childDirectory('code size dir')..createSync(); final Directory codeSizeDir = tempDir.childDirectory('code size dir')..createSync();
@ -143,7 +140,6 @@ void main() {
}, skip: !platform.isMacOS); // [intended] this is a macos only test. }, skip: !platform.isMacOS); // [intended] this is a macos only test.
testWithoutContext('--analyze-size is only supported in release mode', () async { testWithoutContext('--analyze-size is only supported in release mode', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'build', 'build',
@ -163,7 +159,6 @@ void main() {
}); });
testWithoutContext('--analyze-size is not supported in combination with --split-debug-info', () async { testWithoutContext('--analyze-size is not supported in combination with --split-debug-info', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final List<String> command = <String>[ final List<String> command = <String>[
flutterBin, flutterBin,
'build', 'build',
@ -188,7 +183,6 @@ void main() {
}); });
testWithoutContext('--analyze-size allows overriding the directory for code size files', () async { testWithoutContext('--analyze-size allows overriding the directory for code size files', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.'); final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.');
final List<String> command = <String>[ final List<String> command = <String>[

View File

@ -24,7 +24,6 @@ void main() {
}); });
testWithoutContext('build succeeds with api 33 features', () async { testWithoutContext('build succeeds with api 33 features', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
ProcessResult result = await processManager.run(<String>[ ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',

View File

@ -22,8 +22,6 @@ void main() {
testWithoutContext( testWithoutContext(
'gradle task succeeds when adding plugins with gradle daemon enabled', 'gradle task succeeds when adding plugins with gradle daemon enabled',
() async { () async {
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final Directory appDir = tempDir.childDirectory('testapp'); final Directory appDir = tempDir.childDirectory('testapp');
final Directory androidDir = appDir.childDirectory('android'); final Directory androidDir = appDir.childDirectory('android');

View File

@ -28,8 +28,6 @@ void main() {
testWithoutContext( testWithoutContext(
'gradle prints warning when Flutter\'s Gradle plugins are applied using deprecated "apply plugin" way', () async { 'gradle prints warning when Flutter\'s Gradle plugins are applied using deprecated "apply plugin" way', () async {
// Create a new flutter project. // Create a new flutter project.
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
ProcessResult result = await processManager.run(<String>[ ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',

View File

@ -29,11 +29,6 @@ void main() {
final Project project = DeferredComponentsProject( final Project project = DeferredComponentsProject(
MissingFlutterSourcePathDeferredComponentsConfig(), MissingFlutterSourcePathDeferredComponentsConfig(),
); );
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final Directory exampleAppDir = tempDir.childDirectory('example'); final Directory exampleAppDir = tempDir.childDirectory('example');
await project.setUpIn(exampleAppDir); await project.setUpIn(exampleAppDir);

View File

@ -24,8 +24,6 @@ void main() {
testWithoutContext( testWithoutContext(
'gradle task exists named javaVersion that prints jdk version', () async { 'gradle task exists named javaVersion that prints jdk version', () async {
// Create a new flutter project. // Create a new flutter project.
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
ProcessResult result = await processManager.run(<String>[ ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',

View File

@ -28,12 +28,6 @@ void main() {
}); });
test('should build Android app with commented-out ".flutter-plugins" in settings.gradle', () async { test('should build Android app with commented-out ".flutter-plugins" in settings.gradle', () async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
// Create Android app project instead of plugin // Create Android app project instead of plugin
processManager.runSync(<String>[ processManager.runSync(<String>[
flutterBin, flutterBin,

View File

@ -278,8 +278,6 @@ void main() {
testWithoutContext( testWithoutContext(
'gradle task outputs<mode>AppLinkSettings works when a project has app links', () async { 'gradle task outputs<mode>AppLinkSettings works when a project has app links', () async {
// Create a new flutter project. // Create a new flutter project.
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
ProcessResult result = await processManager.run(<String>[ ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',
@ -345,8 +343,6 @@ void main() {
testWithoutContext( testWithoutContext(
'gradle task outputs<mode>AppLinkSettings works when a project does not have app link and the flutter_deeplinking_enabled flag', () async { 'gradle task outputs<mode>AppLinkSettings works when a project does not have app link and the flutter_deeplinking_enabled flag', () async {
// Create a new flutter project. // Create a new flutter project.
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
ProcessResult result = await processManager.run(<String>[ ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',

View File

@ -31,8 +31,6 @@ void main() {
testWithoutContext( testWithoutContext(
'gradle task exists named printBuildVariants that prints build variants', () async { 'gradle task exists named printBuildVariants that prints build variants', () async {
// Create a new flutter project. // Create a new flutter project.
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
ProcessResult result = await processManager.run(<String>[ ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',

View File

@ -24,12 +24,6 @@ void main() {
}); });
test('error logged when plugin Android compileSdk version higher than project', () async { test('error logged when plugin Android compileSdk version higher than project', () async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
// Create dummy plugin // Create dummy plugin
processManager.runSync(<String>[ processManager.runSync(<String>[
flutterBin, flutterBin,

View File

@ -32,12 +32,6 @@ void main() {
required String template, required String template,
required Directory tempDir, required Directory tempDir,
}) async { }) async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final String testName = '${template}_test'; final String testName = '${template}_test';
ProcessResult result = processManager.runSync(<String>[ ProcessResult result = processManager.runSync(<String>[

View File

@ -23,12 +23,6 @@ void main() {
}); });
test('error logged when plugin Android ndkVersion higher than project', () async { test('error logged when plugin Android ndkVersion higher than project', () async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
// Create dummy plugin // Create dummy plugin
processManager.runSync(<String>[ processManager.runSync(<String>[
flutterBin, flutterBin,

View File

@ -26,11 +26,6 @@ void main() {
}); });
test('plugins use individualized build directories based on their name.', () async { test('plugins use individualized build directories based on their name.', () async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
// create flutter module project // create flutter module project
ProcessResult result = processManager.runSync(<String>[ ProcessResult result = processManager.runSync(<String>[
flutterBin, flutterBin,

View File

@ -37,12 +37,6 @@ void main() {
required Project project, required Project project,
required bool createAndroidPluginFolder, required bool createAndroidPluginFolder,
}) async { }) async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
// Create dummy plugin that supports iOS and optionally Android. // Create dummy plugin that supports iOS and optionally Android.
processManager.runSync(<String>[ processManager.runSync(<String>[
flutterBin, flutterBin,

View File

@ -67,11 +67,6 @@ Future<void> main() async {
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('abc'); ..writeAsStringSync('abc');
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final ProcessResult result = await processManager.run( final ProcessResult result = await processManager.run(
<String>[ <String>[
flutterBin, flutterBin,

View File

@ -17,7 +17,6 @@ void main() {
'integration_tests', 'integration_tests',
'flutter_gallery', 'flutter_gallery',
); );
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
await processManager.run(<String>[ await processManager.run(<String>[
flutterBin, flutterBin,

View File

@ -17,7 +17,6 @@ void main() {
'integration_tests', 'integration_tests',
'flutter_gallery', 'flutter_gallery',
); );
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
await processManager.run(<String>[ await processManager.run(<String>[
flutterBin, flutterBin,

View File

@ -18,7 +18,6 @@ void main() {
late Directory tempDir; late Directory tempDir;
final FileSystem fs = LocalFileSystemBlockingSetCurrentDirectory(); final FileSystem fs = LocalFileSystemBlockingSetCurrentDirectory();
final String flutterBin = fs.path.join(getFlutterRoot(), 'bin', 'flutter');
final File previewBin = fs final File previewBin = fs
.directory(getFlutterRoot()) .directory(getFlutterRoot())
.childDirectory('bin') .childDirectory('bin')

View File

@ -16,7 +16,6 @@ import 'test_utils.dart';
void main() { void main() {
testWithoutContext('All development tools and deprecated commands are hidden and help text is not verbose', () async { testWithoutContext('All development tools and deprecated commands are hidden and help text is not verbose', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'-h', '-h',
@ -34,7 +33,6 @@ void main() {
}); });
testWithoutContext('Flutter help is shown with -? command line argument', () async { testWithoutContext('Flutter help is shown with -? command line argument', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'-?', '-?',
@ -48,7 +46,6 @@ void main() {
}); });
testWithoutContext('flutter doctor is not verbose', () async { testWithoutContext('flutter doctor is not verbose', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'doctor', 'doctor',
@ -60,7 +57,6 @@ void main() {
}); });
testWithoutContext('flutter doctor -vv super verbose', () async { testWithoutContext('flutter doctor -vv super verbose', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'doctor', 'doctor',
@ -72,7 +68,6 @@ void main() {
}); });
testWithoutContext('flutter config --list contains all features', () async { testWithoutContext('flutter config --list contains all features', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'config', 'config',
@ -99,7 +94,6 @@ void main() {
.childDirectory('lib') .childDirectory('lib')
.childFile('main.dart') .childFile('main.dart')
.createSync(recursive: true); .createSync(recursive: true);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'run', 'run',
@ -115,7 +109,6 @@ void main() {
}); });
testWithoutContext('flutter attach --machine uses AppRunLogger', () async { testWithoutContext('flutter attach --machine uses AppRunLogger', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'attach', 'attach',
@ -127,7 +120,6 @@ void main() {
}); });
testWithoutContext('flutter --version --machine outputs JSON with flutterRoot', () async { testWithoutContext('flutter --version --machine outputs JSON with flutterRoot', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'--version', '--version',
@ -145,7 +137,6 @@ void main() {
testWithoutContext('A tool exit is thrown for an invalid debug-url in flutter attach', () async { testWithoutContext('A tool exit is thrown for an invalid debug-url in flutter attach', () async {
// This test is almost exactly like the next one; update them together please. // This test is almost exactly like the next one; update them together please.
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
@ -164,7 +155,6 @@ void main() {
testWithoutContext('--debug-uri is an alias for --debug-url', () async { testWithoutContext('--debug-uri is an alias for --debug-url', () async {
// This text is exactly the same as the previous one but with a "l" turned to an "i". // This text is exactly the same as the previous one but with a "l" turned to an "i".
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
@ -186,8 +176,6 @@ void main() {
}); });
testWithoutContext('will load bootstrap script before starting', () async { testWithoutContext('will load bootstrap script before starting', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final File bootstrap = fileSystem.file(fileSystem.path.join( final File bootstrap = fileSystem.file(fileSystem.path.join(
getFlutterRoot(), getFlutterRoot(),
'bin', 'bin',
@ -208,7 +196,6 @@ void main() {
}); });
testWithoutContext('Providing sksl bundle with missing file with tool exit', () async { testWithoutContext('Providing sksl bundle with missing file with tool exit', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
@ -224,7 +211,6 @@ void main() {
}); });
testWithoutContext('flutter attach does not support --release', () async { testWithoutContext('flutter attach does not support --release', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
@ -238,7 +224,6 @@ void main() {
}); });
testWithoutContext('flutter can report crashes', () async { testWithoutContext('flutter can report crashes', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
'update-packages', 'update-packages',
@ -255,7 +240,6 @@ void main() {
}); });
testWithoutContext('flutter supports trailing args', () async { testWithoutContext('flutter supports trailing args', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,

View File

@ -31,8 +31,6 @@ void main() {
final BasicProject project = BasicProject(); final BasicProject project = BasicProject();
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
const ProcessManager processManager = LocalProcessManager(); const ProcessManager processManager = LocalProcessManager();
daemonProcess = await processManager.start( daemonProcess = await processManager.start(
<String>[flutterBin, ...getLocalEngineArguments(), '--show-test-device', 'daemon'], <String>[flutterBin, ...getLocalEngineArguments(), '--show-test-device', 'daemon'],

View File

@ -30,7 +30,6 @@ void main() {
testWithoutContext('simple build appbundle android-arm64 target succeeds', () async { testWithoutContext('simple build appbundle android-arm64 target succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),
@ -64,7 +63,6 @@ void main() {
testWithoutContext('simple build appbundle all targets succeeds', () async { testWithoutContext('simple build appbundle all targets succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),
@ -109,7 +107,6 @@ void main() {
testWithoutContext('simple build appbundle no-deferred-components succeeds', () async { testWithoutContext('simple build appbundle no-deferred-components succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),
@ -153,7 +150,6 @@ void main() {
testWithoutContext('simple build appbundle mismatched golden no-validate-deferred-components succeeds', () async { testWithoutContext('simple build appbundle mismatched golden no-validate-deferred-components succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(MismatchedGoldenDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(MismatchedGoldenDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),
@ -199,7 +195,6 @@ void main() {
testWithoutContext('simple build appbundle missing android dynamic feature module fails', () async { testWithoutContext('simple build appbundle missing android dynamic feature module fails', () async {
final DeferredComponentsProject project = DeferredComponentsProject(NoAndroidDynamicFeatureModuleDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(NoAndroidDynamicFeatureModuleDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),
@ -221,7 +216,6 @@ void main() {
testWithoutContext('simple build appbundle missing golden fails', () async { testWithoutContext('simple build appbundle missing golden fails', () async {
final DeferredComponentsProject project = DeferredComponentsProject(NoGoldenDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(NoGoldenDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),
@ -243,7 +237,6 @@ void main() {
testWithoutContext('simple build appbundle mismatched golden fails', () async { testWithoutContext('simple build appbundle mismatched golden fails', () async {
final DeferredComponentsProject project = DeferredComponentsProject(MismatchedGoldenDeferredComponentsConfig()); final DeferredComponentsProject project = DeferredComponentsProject(MismatchedGoldenDeferredComponentsConfig());
await project.setUpIn(tempDir); await project.setUpIn(tempDir);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),

View File

@ -15,7 +15,6 @@ import 'test_utils.dart';
void main() { void main() {
test('android project using deprecated settings.gradle will still build', () async { test('android project using deprecated settings.gradle will still build', () async {
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'dev', 'integration_tests', 'gradle_deprecated_settings'); final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'dev', 'integration_tests', 'gradle_deprecated_settings');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final File settingsDotGradleFile = fileSystem.file( final File settingsDotGradleFile = fileSystem.file(
fileSystem.path.join(workingDirectory, 'android', 'settings.gradle')); fileSystem.path.join(workingDirectory, 'android', 'settings.gradle'));

View File

@ -30,7 +30,6 @@ void main() {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
const String matcher = 'The Flutter DevTools debugger and profiler on'; const String matcher = 'The Flutter DevTools debugger and profiler on';
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final Process process = await processManager.start(<String>[ final Process process = await processManager.start(<String>[
flutterBin, flutterBin,
'run', 'run',

View File

@ -23,7 +23,6 @@ final BufferLogger logger = BufferLogger.test(
outputPreferences: OutputPreferences.test(wrapText: true), outputPreferences: OutputPreferences.test(wrapText: true),
); );
final ProcessUtils processUtils = ProcessUtils(processManager: processManager, logger: logger); final ProcessUtils processUtils = ProcessUtils(processManager: processManager, logger: logger);
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'flutter.bat' : 'flutter');
/// A test for flutter upgrade & downgrade that checks out a parallel flutter repo. /// A test for flutter upgrade & downgrade that checks out a parallel flutter repo.
void main() { void main() {

View File

@ -16,16 +16,10 @@ import 'test_utils.dart';
// project in the test. // project in the test.
void main() { void main() {
late Directory tempDir; late Directory tempDir;
late String flutterBin;
late Directory exampleAppDir; late Directory exampleAppDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('flutter_plugin_test.'); tempDir = createResolvedTempDirectorySync('flutter_plugin_test.');
flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
exampleAppDir = tempDir.childDirectory('aaa').childDirectory('example'); exampleAppDir = tempDir.childDirectory('aaa').childDirectory('example');
processManager.runSync(<String>[ processManager.runSync(<String>[

View File

@ -11,16 +11,10 @@ import 'test_utils.dart';
// Test that verbosity it propagated to Gradle tasks correctly. // Test that verbosity it propagated to Gradle tasks correctly.
void main() { void main() {
late Directory tempDir; late Directory tempDir;
late String flutterBin;
late Directory exampleAppDir; late Directory exampleAppDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('flutter_build_test.'); tempDir = createResolvedTempDirectorySync('flutter_build_test.');
flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
exampleAppDir = tempDir.childDirectory('aaa').childDirectory('example'); exampleAppDir = tempDir.childDirectory('aaa').childDirectory('example');
processManager.runSync(<String>[ processManager.runSync(<String>[

View File

@ -12,16 +12,10 @@ import 'test_utils.dart';
// Test that configOnly creates the gradlew file and does not assemble and app. // Test that configOnly creates the gradlew file and does not assemble and app.
void main() { void main() {
late Directory tempDir; late Directory tempDir;
late String flutterBin;
late Directory exampleAppDir; late Directory exampleAppDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('flutter_build_test.'); tempDir = createResolvedTempDirectorySync('flutter_build_test.');
flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
exampleAppDir = tempDir.childDirectory('bbb').childDirectory('example'); exampleAppDir = tempDir.childDirectory('bbb').childDirectory('example');
processManager.runSync( processManager.runSync(

View File

@ -12,16 +12,10 @@ import 'test_utils.dart';
void main() { void main() {
late Directory tempDir; late Directory tempDir;
late String flutterBin;
late Directory exampleAppDir; late Directory exampleAppDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('flutter_web_wasm_test.'); tempDir = createResolvedTempDirectorySync('flutter_web_wasm_test.');
flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
exampleAppDir = tempDir.childDirectory('test_app'); exampleAppDir = tempDir.childDirectory('test_app');
processManager.runSync(<String>[ processManager.runSync(<String>[

View File

@ -15,18 +15,12 @@ import 'test_utils.dart';
void main() { void main() {
late Directory tempDir; late Directory tempDir;
late Directory projectRoot; late Directory projectRoot;
late String flutterBin;
late Directory releaseDir; late Directory releaseDir;
late File exeFile; late File exeFile;
group('flutter build windows command', () { group('flutter build windows command', () {
setUpAll(() { setUpAll(() {
tempDir = createResolvedTempDirectorySync('build_windows_test.'); tempDir = createResolvedTempDirectorySync('build_windows_test.');
flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
ProcessResult result = processManager.runSync(<String>[flutterBin, 'config', ProcessResult result = processManager.runSync(<String>[flutterBin, 'config',
'--enable-windows-desktop', '--enable-windows-desktop',
]); ]);

View File

@ -15,7 +15,6 @@ import 'test_utils.dart';
void main() { void main() {
late Directory tempDir; late Directory tempDir;
late Directory projectRoot; late Directory projectRoot;
late String flutterBin;
final List<String> targetPlatforms = <String>[ final List<String> targetPlatforms = <String>[
'apk', 'apk',
'web', 'web',
@ -27,11 +26,6 @@ void main() {
setUpAll(() { setUpAll(() {
tempDir = createResolvedTempDirectorySync('build_compilation_error_test.'); tempDir = createResolvedTempDirectorySync('build_compilation_error_test.');
flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
processManager.runSync(<String>[flutterBin, 'config', processManager.runSync(<String>[flutterBin, 'config',
'--enable-macos-desktop', '--enable-macos-desktop',
'--enable-windows-desktop', '--enable-windows-desktop',

View File

@ -30,9 +30,6 @@ void main() {
'.flutter-plugins-dependencies correctly denotes project dev dependencies on all default platforms', '.flutter-plugins-dependencies correctly denotes project dev dependencies on all default platforms',
() async { () async {
// Create Flutter project. // Create Flutter project.
final String flutterBin =
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
await processManager.run(<String>[ await processManager.run(<String>[
flutterBin, flutterBin,
'create', 'create',

View File

@ -32,7 +32,6 @@ void main() {
// like https://github.com/flutter/flutter/issues/21418 which were skipped // like https://github.com/flutter/flutter/issues/21418 which were skipped
// over because other integration tests run using flutter-tester which short-cuts // over because other integration tests run using flutter-tester which short-cuts
// some of the checks for devices. // some of the checks for devices.
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
const ProcessManager processManager = LocalProcessManager(); const ProcessManager processManager = LocalProcessManager();
final ProcessResult proc = await processManager.run( final ProcessResult proc = await processManager.run(

View File

@ -31,12 +31,6 @@ void main() {
}); });
testWithoutContext('flutter run in non-machine mode reports an early error in an application', () async { testWithoutContext('flutter run in non-machine mode reports an early error in an application', () async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final StringBuffer stdout = StringBuffer(); final StringBuffer stdout = StringBuffer();
final Process process = await processManager.start(<String>[ final Process process = await processManager.start(<String>[

View File

@ -21,12 +21,6 @@ void main() {
}); });
testWithoutContext('Flutter app that depends on a non-Android plugin can still build for Android', () { testWithoutContext('Flutter app that depends on a non-Android plugin can still build for Android', () {
final String flutterRoot = getFlutterRoot();
final String flutterBin = fileSystem.path.join(
flutterRoot,
'bin',
'flutter',
);
processManager.runSync(<String>[ processManager.runSync(<String>[
flutterBin, flutterBin,
...getLocalEngineArguments(), ...getLocalEngineArguments(),

View File

@ -13,7 +13,7 @@ import 'package:file/file.dart';
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../test_utils.dart' show platform; import '../test_utils.dart' show flutterBin, platform;
import '../transition_test_utils.dart'; import '../transition_test_utils.dart';
import 'native_assets_test_utils.dart'; import 'native_assets_test_utils.dart';

View File

@ -24,7 +24,7 @@ import 'package:flutter_tools/src/base/os.dart';
import 'package:native_assets_cli/code_assets_builder.dart'; import 'package:native_assets_cli/code_assets_builder.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../test_utils.dart' show fileSystem, platform; import '../test_utils.dart' show fileSystem, flutterBin, platform;
import '../transition_test_utils.dart'; import '../transition_test_utils.dart';
import 'native_assets_test_utils.dart'; import 'native_assets_test_utils.dart';

View File

@ -10,7 +10,7 @@ import 'package:file_testing/file_testing.dart';
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../test_utils.dart' show ProcessResultMatcher, fileSystem; import '../test_utils.dart' show ProcessResultMatcher, fileSystem, flutterBin;
import '../transition_test_utils.dart'; import '../transition_test_utils.dart';
Future<Directory> createTestProject(String packageName, Directory tempDirectory) async { Future<Directory> createTestProject(String packageName, Directory tempDirectory) async {

View File

@ -15,7 +15,6 @@ import 'package:yaml/yaml.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../test_utils.dart'; import '../test_utils.dart';
import '../transition_test_utils.dart';
import 'native_assets_test_utils.dart'; import 'native_assets_test_utils.dart';
/// Regression test as part of https://github.com/flutter/flutter/pull/150742. /// Regression test as part of https://github.com/flutter/flutter/pull/150742.

View File

@ -54,7 +54,6 @@ void main() {
}); });
testWithoutContext('flutter run --vm-service-port', () async { testWithoutContext('flutter run --vm-service-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int port = await getFreePort(); final int port = await getFreePort();
// If only --vm-service-port is provided, --vm-service-port will be used by DDS // If only --vm-service-port is provided, --vm-service-port will be used by DDS
// and the VM service will bind to a random port. // and the VM service will bind to a random port.
@ -72,7 +71,6 @@ void main() {
}); });
testWithoutContext('flutter run --dds-port --vm-service-port', () async { testWithoutContext('flutter run --dds-port --vm-service-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int vmServicePort = await getFreePort(); final int vmServicePort = await getFreePort();
int ddsPort = await getFreePort(); int ddsPort = await getFreePort();
while (ddsPort == vmServicePort) { while (ddsPort == vmServicePort) {
@ -95,7 +93,6 @@ void main() {
}); });
testWithoutContext('flutter run --dds-port', () async { testWithoutContext('flutter run --dds-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int ddsPort = await getFreePort(); final int ddsPort = await getFreePort();
// If only --dds-port is provided, --dds-port will be used by DDS and the VM service // If only --dds-port is provided, --dds-port will be used by DDS and the VM service
// will bind to a random port. // will bind to a random port.

View File

@ -10,12 +10,6 @@ import 'swift_package_manager_utils.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final List<String> platforms = <String>['ios', 'macos']; final List<String> platforms = <String>['ios', 'macos'];
for (final String platformName in platforms) { for (final String platformName in platforms) {
final List<String> iosLanguages = <String>[ final List<String> iosLanguages = <String>[

View File

@ -10,12 +10,6 @@ import 'swift_package_manager_utils.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final List<String> platforms = <String>['ios', 'macos']; final List<String> platforms = <String>['ios', 'macos'];
for (final String platformName in platforms) { for (final String platformName in platforms) {
final List<String> iosLanguages = <String>[ final List<String> iosLanguages = <String>[

View File

@ -13,12 +13,6 @@ import 'swift_package_manager_utils.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final List<String> platforms = <String>['ios', 'macos']; final List<String> platforms = <String>['ios', 'macos'];
for (final String platformName in platforms) { for (final String platformName in platforms) {
final List<String> iosLanguages = <String>[ final List<String> iosLanguages = <String>[

View File

@ -92,7 +92,6 @@ abstract class FlutterTestDriver {
bool withDebugger = false, bool withDebugger = false,
bool verbose = false, bool verbose = false,
}) async { }) async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
if (withDebugger) { if (withDebugger) {
arguments.add('--start-paused'); arguments.add('--start-paused');
} }

View File

@ -17,7 +17,6 @@ final String automatedTestsDirectory = fileSystem.path.join('..', '..', 'dev', '
final String missingDependencyDirectory = fileSystem.path.join('..', '..', 'dev', 'missing_dependency_tests'); final String missingDependencyDirectory = fileSystem.path.join('..', '..', 'dev', 'missing_dependency_tests');
final String flutterTestDirectory = fileSystem.path.join(automatedTestsDirectory, 'flutter_test'); final String flutterTestDirectory = fileSystem.path.join(automatedTestsDirectory, 'flutter_test');
final String integrationTestDirectory = fileSystem.path.join(automatedTestsDirectory, 'integration_test'); final String integrationTestDirectory = fileSystem.path.join(automatedTestsDirectory, 'integration_test');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'flutter.bat' : 'flutter');
// Running Integration Tests in the Flutter Tester will still exercise the same // Running Integration Tests in the Flutter Tester will still exercise the same
// flows specific to Integration Tests. // flows specific to Integration Tests.

View File

@ -15,6 +15,13 @@ import 'test_driver.dart';
/// The [FileSystem] for the integration test environment. /// The [FileSystem] for the integration test environment.
const FileSystem fileSystem = LocalFileSystem(); const FileSystem fileSystem = LocalFileSystem();
/// The (real) `flutter` binary (i.e. `{ROOT}/bin/flutter`) to execute in tests.
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
platform.isWindows ? 'flutter.bat' : 'flutter',
);
/// The [Platform] for the integration test environment. /// The [Platform] for the integration test environment.
const Platform platform = LocalPlatform(); const Platform platform = LocalPlatform();

View File

@ -11,11 +11,10 @@ import 'package:meta/meta.dart';
import 'package:process/process.dart'; import 'package:process/process.dart';
import '../src/common.dart'; import '../src/common.dart';
import 'test_utils.dart' show fileSystem; import 'test_utils.dart' show flutterBin;
const ProcessManager processManager = LocalProcessManager(); const ProcessManager processManager = LocalProcessManager();
final String flutterRoot = getFlutterRoot(); final String flutterRoot = getFlutterRoot();
final String flutterBin = fileSystem.path.join(flutterRoot, 'bin', 'flutter');
void debugPrint(String message) { void debugPrint(String message) {
// This is called to intentionally print debugging output when a test is // This is called to intentionally print debugging output when a test is