Use the in-tree engine by default when using --local-engine or --local-web-sdk (#161110)

Now that we're in a monorepo, it makes sense to use the in-tree engine
by default when using `--local-engine` or `--local-web-sdk` rather than
looking for a sibling directory like we used to.
This commit is contained in:
Jackson Gardner 2025-01-03 16:42:37 -08:00 committed by GitHub
parent dbf9e32879
commit 2d17299f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 11 deletions

View File

@ -18,12 +18,9 @@ import '../dart/package_map.dart';
/// The flutter tool can be run with the output files of one or more engine builds /// The flutter tool can be run with the output files of one or more engine builds
/// replacing the cached artifacts. Typically this is done by setting the /// replacing the cached artifacts. Typically this is done by setting the
/// `--local-engine` command line flag to the name of the desired engine variant /// `--local-engine` command line flag to the name of the desired engine variant
/// (e.g. "host_debug_unopt"). Provided that the `flutter/` and `engine/` directories /// (e.g. "host_debug_unopt"). The `--local-engine-src-path` can be provided to
/// are located adjacent to one another, the output folder will be located /// give an exact path to the engine subtree. If it is not specified, the `engine`
/// automatically. /// subfolder in this repository is used.
///
/// For scenarios where the engine is not adjacent to flutter, the
/// `--local-engine-src-path` can be provided to give an exact path.
/// ///
/// For more information on local engines, see README.md. /// For more information on local engines, see README.md.
class LocalEngineLocator { class LocalEngineLocator {
@ -77,7 +74,7 @@ class LocalEngineLocator {
// If engineSourcePath is still not set, try to determine it by flutter root. // If engineSourcePath is still not set, try to determine it by flutter root.
engineSourcePath ??= _tryEnginePath( engineSourcePath ??= _tryEnginePath(
_fileSystem.path.join(_fileSystem.directory(_flutterRoot).parent.path, 'engine', 'src'), _fileSystem.path.join(_fileSystem.directory(_flutterRoot).path, 'engine', 'src'),
); );
} }

View File

@ -12,7 +12,7 @@ import 'package:flutter_tools/src/runner/local_engine.dart';
import '../../src/common.dart'; import '../../src/common.dart';
const String kEngineRoot = '/flutter/engine'; const String kEngineRoot = '/flutter/flutter/engine';
const String kArbitraryEngineRoot = '/arbitrary/engine'; const String kArbitraryEngineRoot = '/arbitrary/engine';
const String kPackageConfig = '.dart_tool/package_config.json'; const String kPackageConfig = '.dart_tool/package_config.json';
@ -372,11 +372,11 @@ void main() {
localHostEngine: 'host_debug', localHostEngine: 'host_debug',
), ),
matchesEngineBuildPaths( matchesEngineBuildPaths(
hostEngine: 'flutter/engine/src/out/host_debug', hostEngine: 'flutter/flutter/engine/src/out/host_debug',
targetEngine: 'flutter/engine/src/out/ios_debug', targetEngine: 'flutter/flutter/engine/src/out/ios_debug',
), ),
); );
expect(logger.traceText, contains('Local engine source at flutter/engine/src')); expect(logger.traceText, contains('Local engine source at flutter/flutter/engine/src'));
}); });
testWithoutContext('fails if --local-engine is specified and --local-engine-src-path ' testWithoutContext('fails if --local-engine is specified and --local-engine-src-path '