Refactor BuildInfo to always require packageConfigPath (#150559)

Refactor warming up to #150196
This commit is contained in:
Sigurd Meldgaard 2024-07-02 11:19:31 +02:00 committed by GitHub
parent 95c0ab7a19
commit 21d996929b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
52 changed files with 713 additions and 223 deletions

View File

@ -145,7 +145,11 @@ Future<void> run(List<String> args) async {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packagesPath: globals.fs.path.normalize(globals.fs.path.absolute(argResults[_kOptionPackages] as String)), packageConfigPath: globals.fs.path.normalize(
globals.fs.path.absolute(
argResults[_kOptionPackages] as String,
),
),
), ),
), ),
watcher: collector, watcher: collector,

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:meta/meta.dart';
import 'package:package_config/package_config_types.dart'; import 'package:package_config/package_config_types.dart';
import 'artifacts.dart'; import 'artifacts.dart';
@ -37,7 +39,7 @@ class BuildInfo {
List<String>? dartExperiments, List<String>? dartExperiments,
required this.treeShakeIcons, required this.treeShakeIcons,
this.performanceMeasurementFile, this.performanceMeasurementFile,
this.packagesPath = '.dart_tool/package_config.json', // TODO(zanderso): make this required and remove the default. required this.packageConfigPath,
this.nullSafetyMode = NullSafetyMode.sound, this.nullSafetyMode = NullSafetyMode.sound,
this.codeSizeDirectory, this.codeSizeDirectory,
this.androidGradleDaemon = true, this.androidGradleDaemon = true,
@ -75,7 +77,7 @@ class BuildInfo {
/// ///
/// This is used by package:package_config to locate the actual package_config.json /// This is used by package:package_config to locate the actual package_config.json
/// file. If not provided, defaults to `.dart_tool/package_config.json`. /// file. If not provided, defaults to `.dart_tool/package_config.json`.
final String packagesPath; final String packageConfigPath;
final List<String> fileSystemRoots; final List<String> fileSystemRoots;
final String? fileSystemScheme; final String? fileSystemScheme;
@ -184,10 +186,47 @@ class BuildInfo {
/// If set, web builds will use the locally built CanvasKit instead of using the CDN /// If set, web builds will use the locally built CanvasKit instead of using the CDN
final bool useLocalCanvasKit; final bool useLocalCanvasKit;
static const BuildInfo debug = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, treeShakeIcons: false); /// Can be used when the actual information is not needed.
static const BuildInfo profile = BuildInfo(BuildMode.profile, null, treeShakeIcons: kIconTreeShakerEnabledDefault); static const BuildInfo dummy = BuildInfo(
static const BuildInfo jitRelease = BuildInfo(BuildMode.jitRelease, null, treeShakeIcons: kIconTreeShakerEnabledDefault); BuildMode.debug,
static const BuildInfo release = BuildInfo(BuildMode.release, null, treeShakeIcons: kIconTreeShakerEnabledDefault); null,
trackWidgetCreation: true,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
@visibleForTesting
static const BuildInfo debug = BuildInfo(
BuildMode.debug,
null,
trackWidgetCreation: true,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
@visibleForTesting
static const BuildInfo profile = BuildInfo(
BuildMode.profile,
null,
treeShakeIcons: kIconTreeShakerEnabledDefault,
packageConfigPath: '.dart_tool/package_config.json',
);
@visibleForTesting
static const BuildInfo jitRelease = BuildInfo(
BuildMode.jitRelease,
null,
treeShakeIcons: kIconTreeShakerEnabledDefault,
packageConfigPath: '.dart_tool/package_config.json',
);
@visibleForTesting
static const BuildInfo release = BuildInfo(
BuildMode.release,
null,
treeShakeIcons: kIconTreeShakerEnabledDefault,
packageConfigPath: '.dart_tool/package_config.json',
);
/// Returns whether a debug build is requested. /// Returns whether a debug build is requested.
/// ///
@ -293,7 +332,7 @@ class BuildInfo {
'PERFORMANCE_MEASUREMENT_FILE': performanceMeasurementFile!, 'PERFORMANCE_MEASUREMENT_FILE': performanceMeasurementFile!,
if (bundleSkSLPath != null) if (bundleSkSLPath != null)
'BUNDLE_SKSL_PATH': bundleSkSLPath!, 'BUNDLE_SKSL_PATH': bundleSkSLPath!,
'PACKAGE_CONFIG': packagesPath, 'PACKAGE_CONFIG': packageConfigPath,
if (codeSizeDirectory != null) if (codeSizeDirectory != null)
'CODE_SIZE_DIRECTORY': codeSizeDirectory!, 'CODE_SIZE_DIRECTORY': codeSizeDirectory!,
if (flavor != null) if (flavor != null)

View File

@ -78,6 +78,7 @@ class BuildAarCommand extends BuildSubCommand {
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.androidGenSnapshot,
}; };
@override
late final FlutterProject project = _getProject(); late final FlutterProject project = _getProject();
@override @override
@ -196,7 +197,7 @@ class BuildAarCommand extends BuildSubCommand {
FlutterProject _getProject() { FlutterProject _getProject() {
final List<String> remainingArguments = argResults!.rest; final List<String> remainingArguments = argResults!.rest;
if (remainingArguments.isEmpty) { if (remainingArguments.isEmpty) {
return FlutterProject.current(); return super.project;
} }
final File mainFile = _fileSystem.file(remainingArguments.first); final File mainFile = _fileSystem.file(remainingArguments.first);
final String path; final String path;

View File

@ -137,7 +137,6 @@ class BuildAppBundleCommand extends BuildSubCommand {
if (globals.androidSdk == null) { if (globals.androidSdk == null) {
exitWithNoSdkMessage(); exitWithNoSdkMessage();
} }
final AndroidBuildInfo androidBuildInfo = AndroidBuildInfo(await getBuildInfo(), final AndroidBuildInfo androidBuildInfo = AndroidBuildInfo(await getBuildInfo(),
targetArchs: stringsArg('target-platform').map<AndroidArch>(getAndroidArchForName), targetArchs: stringsArg('target-platform').map<AndroidArch>(getAndroidArchForName),
); );
@ -146,7 +145,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
final List<DeferredComponent>? deferredComponents = FlutterProject.current().manifest.deferredComponents; final List<DeferredComponent>? deferredComponents = FlutterProject.current().manifest.deferredComponents;
if (deferredComponents != null && boolArg('deferred-components') && boolArg('validate-deferred-components') && !boolArg('debug')) { if (deferredComponents != null && boolArg('deferred-components') && boolArg('validate-deferred-components') && !boolArg('debug')) {
final DeferredComponentsPrebuildValidator validator = DeferredComponentsPrebuildValidator( final DeferredComponentsPrebuildValidator validator = DeferredComponentsPrebuildValidator(
FlutterProject.current().directory, project.directory,
globals.logger, globals.logger,
globals.platform, globals.platform,
title: 'Deferred components prebuild validation', title: 'Deferred components prebuild validation',
@ -160,7 +159,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
// Delete intermediates libs dir for components to resolve mismatching // Delete intermediates libs dir for components to resolve mismatching
// abis supported by base and dynamic feature modules. // abis supported by base and dynamic feature modules.
for (final DeferredComponent component in deferredComponents) { for (final DeferredComponent component in deferredComponents) {
final Directory deferredLibsIntermediate = FlutterProject.current().directory final Directory deferredLibsIntermediate = project.directory
.childDirectory('build') .childDirectory('build')
.childDirectory(component.name) .childDirectory(component.name)
.childDirectory('intermediates') .childDirectory('intermediates')
@ -177,7 +176,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
displayNullSafetyMode(androidBuildInfo.buildInfo); displayNullSafetyMode(androidBuildInfo.buildInfo);
globals.terminal.usesTerminalUi = true; globals.terminal.usesTerminalUi = true;
await androidBuilder?.buildAab( await androidBuilder?.buildAab(
project: FlutterProject.current(), project: project,
target: targetFile, target: targetFile,
androidBuildInfo: androidBuildInfo, androidBuildInfo: androidBuildInfo,
validateDeferredComponents: boolArg('validate-deferred-components'), validateDeferredComponents: boolArg('validate-deferred-components'),

View File

@ -20,7 +20,6 @@ import '../cache.dart';
import '../flutter_plugins.dart'; import '../flutter_plugins.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../macos/cocoapod_utils.dart'; import '../macos/cocoapod_utils.dart';
import '../project.dart';
import '../runner/flutter_command.dart' show DevelopmentArtifact, FlutterCommandResult; import '../runner/flutter_command.dart' show DevelopmentArtifact, FlutterCommandResult;
import '../version.dart'; import '../version.dart';
import 'build.dart'; import 'build.dart';
@ -108,9 +107,6 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
@override @override
bool get reportNullSafety => false; bool get reportNullSafety => false;
@protected
late final FlutterProject project = FlutterProject.current();
Future<List<BuildInfo>> getBuildInfos() async { Future<List<BuildInfo>> getBuildInfos() async {
return <BuildInfo>[ return <BuildInfo>[
if (boolArg('debug')) await getBuildInfo(forcedBuildMode: BuildMode.debug), if (boolArg('debug')) await getBuildInfo(forcedBuildMode: BuildMode.debug),

View File

@ -12,7 +12,6 @@ import '../cache.dart';
import '../features.dart'; import '../features.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../linux/build_linux.dart'; import '../linux/build_linux.dart';
import '../project.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult; import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart'; import 'build.dart';
@ -60,7 +59,6 @@ class BuildLinuxCommand extends BuildSubCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final BuildInfo buildInfo = await getBuildInfo(); final BuildInfo buildInfo = await getBuildInfo();
final FlutterProject flutterProject = FlutterProject.current();
final TargetPlatform targetPlatform = final TargetPlatform targetPlatform =
getTargetPlatformForName(stringArg('target-platform')!); getTargetPlatformForName(stringArg('target-platform')!);
final bool needCrossBuild = final bool needCrossBuild =
@ -87,7 +85,7 @@ class BuildLinuxCommand extends BuildSubCommand {
displayNullSafetyMode(buildInfo); displayNullSafetyMode(buildInfo);
final Logger logger = globals.logger; final Logger logger = globals.logger;
await buildLinux( await buildLinux(
flutterProject.linux, project.linux,
buildInfo, buildInfo,
target: targetFile, target: targetFile,
sizeAnalyzer: SizeAnalyzer( sizeAnalyzer: SizeAnalyzer(

View File

@ -9,7 +9,6 @@ import '../cache.dart';
import '../features.dart'; import '../features.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../macos/build_macos.dart'; import '../macos/build_macos.dart';
import '../project.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult; import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart'; import 'build.dart';
@ -51,7 +50,6 @@ class BuildMacosCommand extends BuildSubCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final BuildInfo buildInfo = await getBuildInfo(); final BuildInfo buildInfo = await getBuildInfo();
final FlutterProject flutterProject = FlutterProject.current();
if (!featureFlags.isMacOSEnabled) { if (!featureFlags.isMacOSEnabled) {
throwToolExit('"build macos" is not currently supported. To enable, run "flutter config --enable-macos-desktop".'); throwToolExit('"build macos" is not currently supported. To enable, run "flutter config --enable-macos-desktop".');
} }
@ -60,7 +58,7 @@ class BuildMacosCommand extends BuildSubCommand {
} }
displayNullSafetyMode(buildInfo); displayNullSafetyMode(buildInfo);
await buildMacOS( await buildMacOS(
flutterProject: flutterProject, flutterProject: project,
buildInfo: buildInfo, buildInfo: buildInfo,
targetOverride: targetFile, targetOverride: targetFile,
verboseLogging: globals.logger.isVerbose, verboseLogging: globals.logger.isVerbose,

View File

@ -10,6 +10,7 @@ import '../base/io.dart';
import '../base/process.dart'; import '../base/process.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../cache.dart'; import '../cache.dart';
import '../dart/package_map.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../project.dart'; import '../project.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult; import '../runner/flutter_command.dart' show FlutterCommandResult;
@ -45,13 +46,6 @@ class BuildPreviewCommand extends BuildSubCommand {
final ProcessUtils processUtils; final ProcessUtils processUtils;
final Artifacts artifacts; final Artifacts artifacts;
static const BuildInfo buildInfo = BuildInfo(
BuildMode.debug,
null, // no flavor
// users may add icons later
treeShakeIcons: false,
);
@override @override
void requiresPubspecYaml() {} void requiresPubspecYaml() {}
@ -65,6 +59,19 @@ class BuildPreviewCommand extends BuildSubCommand {
final Directory targetDir = fs.systemTempDirectory.createTempSync('flutter-build-preview'); final Directory targetDir = fs.systemTempDirectory.createTempSync('flutter-build-preview');
try { try {
final FlutterProject flutterProject = await _createProject(targetDir); final FlutterProject flutterProject = await _createProject(targetDir);
final BuildInfo buildInfo = BuildInfo(
BuildMode.debug,
null, // no flavor
// users may add icons later
packageConfigPath: flutterProject.packageConfigFile.path,
packageConfig: await loadPackageConfigWithLogging(
flutterProject.packageConfigFile,
logger: logger,
),
treeShakeIcons: false,
);
// TODO(loic-sharma): Support windows-arm64 preview device, https://github.com/flutter/flutter/issues/139949. // TODO(loic-sharma): Support windows-arm64 preview device, https://github.com/flutter/flutter/issues/139949.
await buildWindows( await buildWindows(
flutterProject.windows, flutterProject.windows,

View File

@ -8,7 +8,6 @@ import '../base/utils.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../features.dart'; import '../features.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../project.dart';
import '../runner/flutter_command.dart' import '../runner/flutter_command.dart'
show DevelopmentArtifact, FlutterCommandResult, FlutterOptions; show DevelopmentArtifact, FlutterCommandResult, FlutterOptions;
import '../web/compile.dart'; import '../web/compile.dart';
@ -184,7 +183,6 @@ class BuildWebCommand extends BuildSubCommand {
)]; )];
} }
final FlutterProject flutterProject = FlutterProject.current();
final String target = stringArg('target')!; final String target = stringArg('target')!;
final BuildInfo buildInfo = await getBuildInfo(); final BuildInfo buildInfo = await getBuildInfo();
if (buildInfo.isDebug) { if (buildInfo.isDebug) {
@ -197,7 +195,7 @@ class BuildWebCommand extends BuildSubCommand {
'--base-href should start and end with /', '--base-href should start and end with /',
); );
} }
if (!flutterProject.web.existsSync()) { if (!project.web.existsSync()) {
throwToolExit('Missing index.html.'); throwToolExit('Missing index.html.');
} }
if (!_fileSystem.currentDirectory if (!_fileSystem.currentDirectory
@ -227,7 +225,7 @@ class BuildWebCommand extends BuildSubCommand {
analytics: globals.analytics, analytics: globals.analytics,
); );
await webBuilder.buildWeb( await webBuilder.buildWeb(
flutterProject, project,
target, target,
buildInfo, buildInfo,
ServiceWorkerStrategy.fromCliName(stringArg('pwa-strategy')), ServiceWorkerStrategy.fromCliName(stringArg('pwa-strategy')),

View File

@ -11,7 +11,6 @@ import '../build_info.dart';
import '../cache.dart'; import '../cache.dart';
import '../features.dart'; import '../features.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../project.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult; import '../runner/flutter_command.dart' show FlutterCommandResult;
import '../windows/build_windows.dart'; import '../windows/build_windows.dart';
import '../windows/visual_studio.dart'; import '../windows/visual_studio.dart';
@ -49,7 +48,6 @@ class BuildWindowsCommand extends BuildSubCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final FlutterProject flutterProject = FlutterProject.current();
final BuildInfo buildInfo = await getBuildInfo(); final BuildInfo buildInfo = await getBuildInfo();
if (!featureFlags.isWindowsEnabled) { if (!featureFlags.isWindowsEnabled) {
throwToolExit('"build windows" is not currently supported. To enable, run "flutter config --enable-windows-desktop".'); throwToolExit('"build windows" is not currently supported. To enable, run "flutter config --enable-windows-desktop".');
@ -64,7 +62,7 @@ class BuildWindowsCommand extends BuildSubCommand {
displayNullSafetyMode(buildInfo); displayNullSafetyMode(buildInfo);
await buildWindows( await buildWindows(
flutterProject.windows, project.windows,
buildInfo, buildInfo,
targetPlatform, targetPlatform,
target: targetFile, target: targetFile,

View File

@ -1190,7 +1190,7 @@ class DeviceDomain extends Domain {
debuggingOptions: DebuggingOptions.fromJson( debuggingOptions: DebuggingOptions.fromJson(
castStringKeyedMap(args['debuggingOptions'])!, castStringKeyedMap(args['debuggingOptions'])!,
// We are using prebuilts, build info does not matter here. // We are using prebuilts, build info does not matter here.
BuildInfo.debug, BuildInfo.dummy,
), ),
mainPath: _getStringArg(args, 'mainPath'), mainPath: _getStringArg(args, 'mainPath'),
route: _getStringArg(args, 'route'), route: _getStringArg(args, 'route'),

View File

@ -593,7 +593,7 @@ class RunCommand extends RunCommandBase {
runTargetName: deviceType, runTargetName: deviceType,
runTargetOsVersion: deviceOsVersion, runTargetOsVersion: deviceOsVersion,
runModeName: modeName, runModeName: modeName,
runProjectModule: FlutterProject.current().isModule, runProjectModule: project.isModule,
runProjectHostLanguage: hostLanguage.join(','), runProjectHostLanguage: hostLanguage.join(','),
runAndroidEmbeddingVersion: androidEmbeddingVersion, runAndroidEmbeddingVersion: androidEmbeddingVersion,
runEnableImpeller: enableImpeller.asBool, runEnableImpeller: enableImpeller.asBool,
@ -753,9 +753,9 @@ class RunCommand extends RunCommandBase {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final BuildInfo buildInfo = await getBuildInfo();
// Enable hot mode by default if `--no-hot` was not passed and we are in // Enable hot mode by default if `--no-hot` was not passed and we are in
// debug mode. // debug mode.
final BuildInfo buildInfo = await getBuildInfo();
final bool hotMode = shouldUseHotMode(buildInfo); final bool hotMode = shouldUseHotMode(buildInfo);
final String? applicationBinaryPath = stringArg(FlutterOptions.kUseApplicationBinary); final String? applicationBinaryPath = stringArg(FlutterOptions.kUseApplicationBinary);
@ -817,7 +817,6 @@ class RunCommand extends RunCommandBase {
stringsArg(FlutterOptions.kEnableExperiment).isNotEmpty) { stringsArg(FlutterOptions.kEnableExperiment).isNotEmpty) {
expFlags = stringsArg(FlutterOptions.kEnableExperiment); expFlags = stringsArg(FlutterOptions.kEnableExperiment);
} }
final FlutterProject flutterProject = FlutterProject.current();
final List<FlutterDevice> flutterDevices = <FlutterDevice>[ final List<FlutterDevice> flutterDevices = <FlutterDevice>[
for (final Device device in devices!) for (final Device device in devices!)
await FlutterDevice.create( await FlutterDevice.create(
@ -833,7 +832,7 @@ class RunCommand extends RunCommandBase {
final ResidentRunner runner = await createRunner( final ResidentRunner runner = await createRunner(
applicationBinaryPath: applicationBinaryPath, applicationBinaryPath: applicationBinaryPath,
flutterDevices: flutterDevices, flutterDevices: flutterDevices,
flutterProject: flutterProject, flutterProject: project,
hotMode: hotMode, hotMode: hotMode,
); );

View File

@ -505,8 +505,8 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
collector = CoverageCollector( collector = CoverageCollector(
verbose: !machine, verbose: !machine,
libraryNames: packagesToInclude, libraryNames: packagesToInclude,
packagesPath: buildInfo.packagesPath, packagesPath: buildInfo.packageConfigPath,
resolver: await CoverageCollector.getResolver(buildInfo.packagesPath), resolver: await CoverageCollector.getResolver(buildInfo.packageConfigPath),
testTimeRecorder: testTimeRecorder, testTimeRecorder: testTimeRecorder,
branchCoverage: boolArg('branch-coverage'), branchCoverage: boolArg('branch-coverage'),
); );

View File

@ -21,15 +21,17 @@ class FuchsiaKernelCompiler {
Future<void> build({ Future<void> build({
required FuchsiaProject fuchsiaProject, required FuchsiaProject fuchsiaProject,
required String target, // E.g., lib/main.dart required String target, // E.g., lib/main.dart
BuildInfo buildInfo = BuildInfo.debug, BuildInfo buildInfo = BuildInfo.dummy,
}) async { }) async {
// TODO(zanderso): Use filesystem root and scheme information from buildInfo. // TODO(zanderso): Use filesystem root and scheme information from buildInfo.
const String multiRootScheme = 'main-root'; const String multiRootScheme = 'main-root';
final String packagesFile = fuchsiaProject.project.packagesFile.path;
final String outDir = getFuchsiaBuildDirectory(); final String outDir = getFuchsiaBuildDirectory();
final String appName = fuchsiaProject.project.manifest.appName; final String appName = fuchsiaProject.project.manifest.appName;
final String fsRoot = fuchsiaProject.project.directory.path; final String fsRoot = fuchsiaProject.project.directory.path;
final String relativePackagesFile = globals.fs.path.relative(packagesFile, from: fsRoot); final String relativePackageConfigPath = globals.fs.path.relative(
buildInfo.packageConfigPath,
from: fsRoot,
);
final String manifestPath = globals.fs.path.join(outDir, '$appName.dilpmanifest'); final String manifestPath = globals.fs.path.join(outDir, '$appName.dilpmanifest');
final String? kernelCompiler = globals.artifacts?.getArtifactPath( final String? kernelCompiler = globals.artifacts?.getArtifactPath(
Artifact.fuchsiaKernelCompiler, Artifact.fuchsiaKernelCompiler,
@ -58,7 +60,7 @@ class FuchsiaKernelCompiler {
'--filesystem-root', '--filesystem-root',
fsRoot, fsRoot,
'--packages', '--packages',
'$multiRootScheme:///$relativePackagesFile', '$multiRootScheme:///$relativePackageConfigPath',
'--output', '--output',
globals.fs.path.join(outDir, '$appName.dil'), globals.fs.path.join(outDir, '$appName.dil'),
'--component-name', '--component-name',

View File

@ -559,7 +559,7 @@ Please provide a valid TCP port (an integer between 0 and 65535, inclusive).
if (rebuildBundle) { if (rebuildBundle) {
_logger.printTrace('Updating assets'); _logger.printTrace('Updating assets');
final int result = await assetBundle.build( final int result = await assetBundle.build(
packagesPath: debuggingOptions.buildInfo.packagesPath, packagesPath: debuggingOptions.buildInfo.packageConfigPath,
targetPlatform: TargetPlatform.web_javascript, targetPlatform: TargetPlatform.web_javascript,
); );
if (result != 0) { if (result != 0) {

View File

@ -64,7 +64,7 @@ class FlutterDevice {
fileSystemScheme: buildInfo.fileSystemScheme, fileSystemScheme: buildInfo.fileSystemScheme,
targetModel: targetModel, targetModel: targetModel,
dartDefines: buildInfo.dartDefines, dartDefines: buildInfo.dartDefines,
packagesPath: buildInfo.packagesPath, packagesPath: buildInfo.packageConfigPath,
frontendServerStarterPath: buildInfo.frontendServerStarterPath, frontendServerStarterPath: buildInfo.frontendServerStarterPath,
extraFrontEndOptions: buildInfo.extraFrontEndOptions, extraFrontEndOptions: buildInfo.extraFrontEndOptions,
artifacts: globals.artifacts!, artifacts: globals.artifacts!,
@ -164,7 +164,7 @@ class FlutterDevice {
dartDefines: buildInfo.dartDefines, dartDefines: buildInfo.dartDefines,
librariesSpec: globals.fs.file(globals.artifacts! librariesSpec: globals.fs.file(globals.artifacts!
.getHostArtifact(HostArtifact.flutterWebLibrariesJson)).uri.toString(), .getHostArtifact(HostArtifact.flutterWebLibrariesJson)).uri.toString(),
packagesPath: buildInfo.packagesPath, packagesPath: buildInfo.packageConfigPath,
artifacts: globals.artifacts!, artifacts: globals.artifacts!,
processManager: globals.processManager, processManager: globals.processManager,
logger: globals.logger, logger: globals.logger,
@ -197,7 +197,7 @@ class FlutterDevice {
extraFrontEndOptions: extraFrontEndOptions, extraFrontEndOptions: extraFrontEndOptions,
), ),
assumeInitializeFromDillUpToDate: buildInfo.assumeInitializeFromDillUpToDate, assumeInitializeFromDillUpToDate: buildInfo.assumeInitializeFromDillUpToDate,
packagesPath: buildInfo.packagesPath, packagesPath: buildInfo.packageConfigPath,
artifacts: globals.artifacts!, artifacts: globals.artifacts!,
processManager: globals.processManager, processManager: globals.processManager,
logger: globals.logger, logger: globals.logger,
@ -1103,7 +1103,7 @@ abstract class ResidentRunner extends ResidentHandlers {
this.machine = false, this.machine = false,
ResidentDevtoolsHandlerFactory devtoolsHandler = createDefaultHandler, ResidentDevtoolsHandlerFactory devtoolsHandler = createDefaultHandler,
}) : mainPath = globals.fs.file(target).absolute.path, }) : mainPath = globals.fs.file(target).absolute.path,
packagesFilePath = debuggingOptions.buildInfo.packagesPath, packagesFilePath = debuggingOptions.buildInfo.packageConfigPath,
projectRootPath = projectRootPath ?? globals.fs.currentDirectory.path, projectRootPath = projectRootPath ?? globals.fs.currentDirectory.path,
_dillOutputPath = dillOutputPath, _dillOutputPath = dillOutputPath,
artifactDirectory = dillOutputPath == null artifactDirectory = dillOutputPath == null

View File

@ -1163,13 +1163,18 @@ abstract class FlutterCommand extends Command<void> {
); );
} }
/// Returns a [FlutterProject] view of the current directory or a ToolExit error,
/// if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
FlutterProject get project => FlutterProject.current();
/// Compute the [BuildInfo] for the current flutter command. /// Compute the [BuildInfo] for the current flutter command.
///
/// Commands that build multiple build modes can pass in a [forcedBuildMode] /// Commands that build multiple build modes can pass in a [forcedBuildMode]
/// to be used instead of parsing flags. /// to be used instead of parsing flags.
/// ///
/// Throws a [ToolExit] if the current set of options is not compatible with /// Throws a [ToolExit] if the current set of options is not compatible with
/// each other. /// each other.
Future<BuildInfo> getBuildInfo({ BuildMode? forcedBuildMode, File? forcedTargetFile }) async { Future<BuildInfo> getBuildInfo({BuildMode? forcedBuildMode, File? forcedTargetFile}) async {
final bool trackWidgetCreation = argParser.options.containsKey('track-widget-creation') && final bool trackWidgetCreation = argParser.options.containsKey('track-widget-creation') &&
boolArg('track-widget-creation'); boolArg('track-widget-creation');
@ -1177,10 +1182,12 @@ abstract class FlutterCommand extends Command<void> {
? stringArg('build-number') ? stringArg('build-number')
: null; : null;
final File packagesFile = globals.fs.file( final File packageConfigFile = globals.fs.file(packagesPath ?? project.packageConfigFile.path);
packagesPath ?? globals.fs.path.absolute('.dart_tool', 'package_config.json'));
final PackageConfig packageConfig = await loadPackageConfigWithLogging( final PackageConfig packageConfig = await loadPackageConfigWithLogging(
packagesFile, logger: globals.logger, throwOnError: false); packageConfigFile,
logger: globals.logger,
throwOnError: false,
);
final List<String> experiments = final List<String> experiments =
argParser.options.containsKey(FlutterOptions.kEnableExperiment) argParser.options.containsKey(FlutterOptions.kEnableExperiment)
@ -1281,12 +1288,14 @@ abstract class FlutterCommand extends Command<void> {
final Map<String, Object?> defineConfigJsonMap = extractDartDefineConfigJsonMap(); final Map<String, Object?> defineConfigJsonMap = extractDartDefineConfigJsonMap();
final List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap); final List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap);
final bool useCdn = !argParser.options.containsKey(FlutterOptions.kWebResourcesCdnFlag) final bool useCdn = !argParser.options.containsKey(FlutterOptions.kWebResourcesCdnFlag)
|| boolArg(FlutterOptions.kWebResourcesCdnFlag); || boolArg(FlutterOptions.kWebResourcesCdnFlag);
final bool useLocalWebSdk = argParser.options.containsKey(FlutterGlobalOptions.kLocalWebSDKOption) final bool useLocalWebSdk = argParser.options.containsKey(FlutterGlobalOptions.kLocalWebSDKOption)
&& stringArg(FlutterGlobalOptions.kLocalWebSDKOption, global: true) != null; && stringArg(FlutterGlobalOptions.kLocalWebSDKOption, global: true) != null;
final bool useLocalCanvasKit = !useCdn || useLocalWebSdk; final bool useLocalCanvasKit = !useCdn || useLocalWebSdk;
final String? defaultFlavor = FlutterProject.current().manifest.defaultFlavor;
final String? defaultFlavor = project.manifest.defaultFlavor;
final String? cliFlavor = argParser.options.containsKey('flavor') ? stringArg('flavor') : null; final String? cliFlavor = argParser.options.containsKey('flavor') ? stringArg('flavor') : null;
final String? flavor = cliFlavor ?? defaultFlavor; final String? flavor = cliFlavor ?? defaultFlavor;
if (flavor != null) { if (flavor != null) {
@ -1326,7 +1335,7 @@ abstract class FlutterCommand extends Command<void> {
bundleSkSLPath: bundleSkSLPath, bundleSkSLPath: bundleSkSLPath,
dartExperiments: experiments, dartExperiments: experiments,
performanceMeasurementFile: performanceMeasurementFile, performanceMeasurementFile: performanceMeasurementFile,
packagesPath: packagesPath ?? globals.fs.path.absolute('.dart_tool', 'package_config.json'), packageConfigPath: packagesPath ?? packageConfigFile.path,
nullSafetyMode: nullSafetyMode, nullSafetyMode: nullSafetyMode,
codeSizeDirectory: codeSizeDirectory, codeSizeDirectory: codeSizeDirectory,
androidGradleDaemon: androidGradleDaemon, androidGradleDaemon: androidGradleDaemon,

View File

@ -121,7 +121,7 @@ class FlutterTesterTestDevice extends TestDevice {
'--non-interactive', '--non-interactive',
'--use-test-fonts', '--use-test-fonts',
'--disable-asset-fonts', '--disable-asset-fonts',
'--packages=${debuggingOptions.buildInfo.packagesPath}', '--packages=${debuggingOptions.buildInfo.packageConfigPath}',
if (testAssetDirectory != null) if (testAssetDirectory != null)
'--flutter-assets-dir=$testAssetDirectory', '--flutter-assets-dir=$testAssetDirectory',
if (debuggingOptions.nullAssertions) if (debuggingOptions.nullAssertions)

View File

@ -801,7 +801,7 @@ class SpawnPlugin extends PlatformPlugin {
'--non-interactive', '--non-interactive',
'--use-test-fonts', '--use-test-fonts',
'--disable-asset-fonts', '--disable-asset-fonts',
'--packages=${debuggingOptions.buildInfo.packagesPath}', '--packages=${debuggingOptions.buildInfo.packageConfigPath}',
if (testAssetDirectory != null) if (testAssetDirectory != null)
'--flutter-assets-dir=$testAssetDirectory', '--flutter-assets-dir=$testAssetDirectory',
if (debuggingOptions.nullAssertions) if (debuggingOptions.nullAssertions)

View File

@ -122,7 +122,7 @@ class TestCompiler {
trackWidgetCreation: buildInfo.trackWidgetCreation, trackWidgetCreation: buildInfo.trackWidgetCreation,
initializeFromDill: testFilePath, initializeFromDill: testFilePath,
dartDefines: buildInfo.dartDefines, dartDefines: buildInfo.dartDefines,
packagesPath: buildInfo.packagesPath, packagesPath: buildInfo.packageConfigPath,
frontendServerStarterPath: buildInfo.frontendServerStarterPath, frontendServerStarterPath: buildInfo.frontendServerStarterPath,
extraFrontEndOptions: buildInfo.extraFrontEndOptions, extraFrontEndOptions: buildInfo.extraFrontEndOptions,
platform: globals.platform, platform: globals.platform,

View File

@ -174,7 +174,7 @@ class WebTestCompiler {
platformDill: _fileSystem.file(platformDillPath).absolute.uri.toString(), platformDill: _fileSystem.file(platformDillPath).absolute.uri.toString(),
dartDefines: dartDefines, dartDefines: dartDefines,
librariesSpec: _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).uri.toString(), librariesSpec: _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).uri.toString(),
packagesPath: buildInfo.packagesPath, packagesPath: buildInfo.packageConfigPath,
artifacts: _artifacts, artifacts: _artifacts,
processManager: _processManager, processManager: _processManager,
logger: _logger, logger: _logger,

View File

@ -166,7 +166,7 @@ class FlutterTesterDevice extends Device {
'--non-interactive', '--non-interactive',
if (debuggingOptions.enableDartProfiling) if (debuggingOptions.enableDartProfiling)
'--enable-dart-profiling', '--enable-dart-profiling',
'--packages=${debuggingOptions.buildInfo.packagesPath}', '--packages=${debuggingOptions.buildInfo.packageConfigPath}',
'--flutter-assets-dir=${assetDirectory.path}', '--flutter-assets-dir=${assetDirectory.path}',
if (debuggingOptions.startPaused) if (debuggingOptions.startPaused)
'--start-paused', '--start-paused',

View File

@ -585,7 +585,7 @@ class IosProject extends XcodeBasedProject {
if (globals.cache.isOlderThanToolsStamp(generatedXcodePropertiesFile)) { if (globals.cache.isOlderThanToolsStamp(generatedXcodePropertiesFile)) {
await xcode.updateGeneratedXcodeProperties( await xcode.updateGeneratedXcodeProperties(
project: parent, project: parent,
buildInfo: BuildInfo.debug, buildInfo: BuildInfo.dummy,
targetOverride: bundle.defaultMainPath, targetOverride: bundle.defaultMainPath,
); );
} }
@ -757,7 +757,7 @@ class MacOSProject extends XcodeBasedProject {
if (globals.cache.isOlderThanToolsStamp(generatedXcodePropertiesFile)) { if (globals.cache.isOlderThanToolsStamp(generatedXcodePropertiesFile)) {
await xcode.updateGeneratedXcodeProperties( await xcode.updateGeneratedXcodeProperties(
project: parent, project: parent,
buildInfo: BuildInfo.debug, buildInfo: BuildInfo.dummy,
useMacOSConfig: true, useMacOSConfig: true,
); );
} }

View File

@ -84,7 +84,7 @@ void main() {
fileSystem.directory('/test').createSync(); fileSystem.directory('/test').createSync();
final FlutterWebPlatform webPlatform = await FlutterWebPlatform.start( final FlutterWebPlatform webPlatform = await FlutterWebPlatform.start(
'ProjectRoot', 'ProjectRoot',
buildInfo: const BuildInfo(BuildMode.debug, '', treeShakeIcons: false), buildInfo: BuildInfo.debug,
webMemoryFS: WebMemoryFS(), webMemoryFS: WebMemoryFS(),
fileSystem: fileSystem, fileSystem: fileSystem,
buildDirectory: fileSystem.directory('build'), buildDirectory: fileSystem.directory('build'),
@ -131,6 +131,7 @@ void main() {
buildInfo: const BuildInfo( buildInfo: const BuildInfo(
BuildMode.debug, BuildMode.debug,
'', '',
packageConfigPath: '.dart_tool/package_config.json',
treeShakeIcons: false, treeShakeIcons: false,
extraFrontEndOptions: <String>['--dartdevc-module-format=ddc'], extraFrontEndOptions: <String>['--dartdevc-module-format=ddc'],
), ),

View File

@ -1475,8 +1475,8 @@ class TestRunCommandForUsageValues extends RunCommand {
} }
@override @override
Future<BuildInfo> getBuildInfo({ BuildMode? forcedBuildMode, File? forcedTargetFile }) async { Future<BuildInfo> getBuildInfo({FlutterProject? project, BuildMode? forcedBuildMode, File? forcedTargetFile}) async {
return const BuildInfo(BuildMode.debug, null, treeShakeIcons: false); return const BuildInfo(BuildMode.debug, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
} }
} }

View File

@ -119,6 +119,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -241,6 +242,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -319,6 +321,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -430,6 +433,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -539,6 +543,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -627,6 +632,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -750,6 +756,7 @@ void main() {
null, null,
treeShakeIcons: false, treeShakeIcons: false,
codeSizeDirectory: 'foo', codeSizeDirectory: 'foo',
packageConfigPath: '.dart_tool/package_config.json',
), ),
targetArchs: <AndroidArch>[AndroidArch.arm64_v8a], targetArchs: <AndroidArch>[AndroidArch.arm64_v8a],
), ),
@ -828,6 +835,7 @@ void main() {
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -897,7 +905,11 @@ android {
processManager: processManager, processManager: processManager,
processUtils: ProcessUtils(processManager: processManager, logger: logger), processUtils: ProcessUtils(processManager: processManager, logger: logger),
userMessages: UserMessages(), userMessages: UserMessages(),
buildInfo: const BuildInfo(BuildMode.debug, null, treeShakeIcons: false), buildInfo: const BuildInfo(
BuildMode.debug, null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
); );
expect(androidApk?.id, 'com.example.foo'); expect(androidApk?.id, 'com.example.foo');
@ -1071,7 +1083,14 @@ Gradle Crashed
fileSystem.directory('build/outputs/repo').createSync(recursive: true); fileSystem.directory('build/outputs/repo').createSync(recursive: true);
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(
BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
@ -1150,7 +1169,14 @@ Gradle Crashed
fileSystem.directory('build/outputs/repo').createSync(recursive: true); fileSystem.directory('build/outputs/repo').createSync(recursive: true);
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(
BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
@ -1211,7 +1237,14 @@ Gradle Crashed
await expectLater(() async => await expectLater(() async =>
builder.buildGradleAar( builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(
BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
@ -1294,6 +1327,7 @@ Gradle Crashed
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -1379,6 +1413,7 @@ Gradle Crashed
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -1464,6 +1499,7 @@ Gradle Crashed
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -1550,6 +1586,7 @@ Gradle Crashed
BuildMode.release, BuildMode.release,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -1616,6 +1653,7 @@ Gradle Crashed
null, null,
treeShakeIcons: false, treeShakeIcons: false,
androidGradleDaemon: false, androidGradleDaemon: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
), ),
target: 'lib/main.dart', target: 'lib/main.dart',
@ -1702,7 +1740,14 @@ Gradle Crashed
fileSystem.directory('build/outputs/repo').createSync(recursive: true); fileSystem.directory('build/outputs/repo').createSync(recursive: true);
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null, treeShakeIcons: false)), androidBuildInfo: const AndroidBuildInfo(
BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
@ -1792,7 +1837,13 @@ Gradle Crashed
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo(BuildMode.release, null, treeShakeIcons: false)), BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
@ -1882,7 +1933,13 @@ Gradle Crashed
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo(BuildMode.release, null, treeShakeIcons: false)), BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',
@ -1972,7 +2029,13 @@ Gradle Crashed
await builder.buildGradleAar( await builder.buildGradleAar(
androidBuildInfo: const AndroidBuildInfo( androidBuildInfo: const AndroidBuildInfo(
BuildInfo(BuildMode.release, null, treeShakeIcons: false)), BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)
),
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
outputDirectory: fileSystem.directory('build/'), outputDirectory: fileSystem.directory('build/'),
target: '', target: '',

View File

@ -30,7 +30,13 @@ void main() {
expect(() => validateBuild( expect(() => validateBuild(
const AndroidBuildInfo( const AndroidBuildInfo(
// Invalid number // Invalid number
BuildInfo(BuildMode.debug, '', treeShakeIcons: false, buildNumber: 'a'), BuildInfo(
BuildMode.debug,
'',
treeShakeIcons: false,
buildNumber: 'a',
packageConfigPath: '.dart_tool/package_config.json',
),
targetArchs: <AndroidArch>[AndroidArch.x86], targetArchs: <AndroidArch>[AndroidArch.x86],
), ),
), throwsToolExit(message: 'buildNumber: a was not a valid integer value.')); ), throwsToolExit(message: 'buildNumber: a was not a valid integer value.'));
@ -38,7 +44,13 @@ void main() {
expect(() => validateBuild( expect(() => validateBuild(
const AndroidBuildInfo( const AndroidBuildInfo(
// Negative number // Negative number
BuildInfo(BuildMode.debug, '', treeShakeIcons: false, buildNumber: '-1'), BuildInfo(
BuildMode.debug,
'',
treeShakeIcons: false,
buildNumber: '-1',
packageConfigPath: '.dart_tool/package_config.json',
),
targetArchs: <AndroidArch>[AndroidArch.x86], targetArchs: <AndroidArch>[AndroidArch.x86],
), ),
), throwsToolExit(message: 'buildNumber: -1 must be a positive integer value.')); ), throwsToolExit(message: 'buildNumber: -1 must be a positive integer value.'));
@ -46,7 +58,13 @@ void main() {
expect(() => validateBuild( expect(() => validateBuild(
const AndroidBuildInfo( const AndroidBuildInfo(
// bigger than maximum supported play store value // bigger than maximum supported play store value
BuildInfo(BuildMode.debug, '', treeShakeIcons: false, buildNumber: '2100000001'), BuildInfo(
BuildMode.debug,
'',
treeShakeIcons: false,
buildNumber: '2100000001',
packageConfigPath: '.dart_tool/package_config.json',
),
targetArchs: <AndroidArch>[AndroidArch.x86], targetArchs: <AndroidArch>[AndroidArch.x86],
), ),
), throwsToolExit(message: 'buildNumber: 2100000001 is greater than the maximum ' ), throwsToolExit(message: 'buildNumber: 2100000001 is greater than the maximum '
@ -56,7 +74,13 @@ void main() {
testWithoutContext('validateBuild does not throw on positive number', () { testWithoutContext('validateBuild does not throw on positive number', () {
expect(() => validateBuild( expect(() => validateBuild(
const AndroidBuildInfo( const AndroidBuildInfo(
BuildInfo(BuildMode.debug, '', treeShakeIcons: false, buildNumber: '2'), BuildInfo(
BuildMode.debug,
'',
treeShakeIcons: false,
buildNumber: '2',
packageConfigPath: '.dart_tool/package_config.json',
),
targetArchs: <AndroidArch>[AndroidArch.x86], targetArchs: <AndroidArch>[AndroidArch.x86],
), ),
), returnsNormally); ), returnsNormally);

View File

@ -30,7 +30,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooBarRelease', 'app-foo-bar-release.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooBarRelease', 'app-foo-bar-release.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'fooBar', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'fooBar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -44,7 +49,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'foo_bar', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'foo_bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -58,7 +68,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -72,7 +87,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooRelease', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooRelease', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'foo', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'foo',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -86,7 +106,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooaRelease', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooaRelease', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'fooA', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'fooA',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -100,7 +125,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('release', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('release', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, null, treeShakeIcons: false), const BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -114,7 +144,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooBarDebug', 'app-foo-bar-debug.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooBarDebug', 'app-foo-bar-debug.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'fooBar', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'fooBar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -128,7 +163,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barDebug', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barDebug', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'foo_bar', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'foo_bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -142,7 +182,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barDebug', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barDebug', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -156,7 +201,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooDebug', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooDebug', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'foo', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'foo',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -170,7 +220,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooaDebug', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooaDebug', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'fooA', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'fooA',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -198,7 +253,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooBarProfile', 'app-foo-bar-profile.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooBarProfile', 'app-foo-bar-profile.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, 'fooBar', treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
'fooBar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -212,7 +272,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barProfile', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barProfile', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, 'foo_bar', treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
'foo_bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -226,7 +291,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barProfile', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barProfile', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, 'foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
'foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -239,12 +309,17 @@ void main() {
testWithoutContext("Finds app bundle when flavor doesn't contain underscores in profile mode", () { testWithoutContext("Finds app bundle when flavor doesn't contain underscores in profile mode", () {
final FlutterProject project = generateFakeAppBundle('fooProfile', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooProfile', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, 'foo', treeShakeIcons: false), const BuildInfo(
BufferLogger.test(), BuildMode.profile,
TestUsage(), 'foo',
fakeAnalytics, treeShakeIcons: false,
); packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(),
TestUsage(),
fakeAnalytics,
);
expect(bundle, isNotNull); expect(bundle, isNotNull);
expect(bundle.path, '/build/app/outputs/bundle/fooProfile/app.aab'); expect(bundle.path, '/build/app/outputs/bundle/fooProfile/app.aab');
@ -254,7 +329,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('fooaProfile', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('fooaProfile', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, 'fooA', treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
'fooA',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -268,7 +348,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('profile', 'app.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('profile', 'app.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, null, treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -282,7 +367,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('release', 'app-release.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('release', 'app-release.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, null, treeShakeIcons: false), const BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -296,7 +386,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('profile', 'app-profile.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('profile', 'app-profile.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, null, treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -324,7 +419,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app-foo_bar-release.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app-foo_bar-release.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'foo_bar', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'foo_bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -338,7 +438,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app-foo_bar-release.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barRelease', 'app-foo_bar-release.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -352,10 +457,15 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barProfile', 'app-foo_bar-profile.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barProfile', 'app-foo_bar-profile.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.profile, 'foo_bar', treeShakeIcons: false), const BuildInfo(
BuildMode.profile,
'foo_bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
); );
expect(bundle, isNotNull); expect(bundle, isNotNull);
@ -366,7 +476,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_barDebug', 'app-foo_bar-debug.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_barDebug', 'app-foo_bar-debug.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -381,7 +496,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_BarRelease', 'app-foo_Bar-release.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_BarRelease', 'app-foo_Bar-release.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.release, 'Foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.release,
'Foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -396,7 +516,12 @@ void main() {
final FlutterProject project = generateFakeAppBundle('foo_BarDebug', 'app-foo_Bar-debug.aab', fileSystem); final FlutterProject project = generateFakeAppBundle('foo_BarDebug', 'app-foo_Bar-debug.aab', fileSystem);
final File bundle = findBundleFile( final File bundle = findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'Foo_Bar', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'Foo_Bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
TestUsage(), TestUsage(),
fakeAnalytics, fakeAnalytics,
@ -413,7 +538,12 @@ void main() {
() { () {
findBundleFile( findBundleFile(
project, project,
const BuildInfo(BuildMode.debug, 'foo_bar', treeShakeIcons: false), const BuildInfo(
BuildMode.debug,
'foo_bar',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
BufferLogger.test(), BufferLogger.test(),
testUsage, testUsage,
fakeAnalytics, fakeAnalytics,
@ -422,9 +552,7 @@ void main() {
throwsToolExit( throwsToolExit(
message: message:
"Gradle build failed to produce an .aab file. It's likely that this file " "Gradle build failed to produce an .aab file. It's likely that this file "
"was generated under ${project.android.buildDirectory.path}, but the tool couldn't find it." "was generated under ${project.android.buildDirectory.path}, but the tool couldn't find it."));
)
);
expect(testUsage.events, contains( expect(testUsage.events, contains(
TestUsageEvent( TestUsageEvent(
'build', 'build',

View File

@ -88,11 +88,21 @@ void main() {
group('gradle tasks', () { group('gradle tasks', () {
testWithoutContext('assemble release', () { testWithoutContext('assemble release', () {
expect( expect(
getAssembleTaskFor(const BuildInfo(BuildMode.release, null, treeShakeIcons: false)), getAssembleTaskFor(const BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
equals('assembleRelease'), equals('assembleRelease'),
); );
expect( expect(
getAssembleTaskFor(const BuildInfo(BuildMode.release, 'flavorFoo', treeShakeIcons: false)), getAssembleTaskFor(const BuildInfo(
BuildMode.release,
'flavorFoo',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
equals('assembleFlavorFooRelease'), equals('assembleFlavorFooRelease'),
); );
}); });
@ -103,18 +113,33 @@ void main() {
equals('assembleDebug'), equals('assembleDebug'),
); );
expect( expect(
getAssembleTaskFor(const BuildInfo(BuildMode.debug, 'flavorFoo', treeShakeIcons: false)), getAssembleTaskFor(const BuildInfo(
BuildMode.debug,
'flavorFoo',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
equals('assembleFlavorFooDebug'), equals('assembleFlavorFooDebug'),
); );
}); });
testWithoutContext('assemble profile', () { testWithoutContext('assemble profile', () {
expect( expect(
getAssembleTaskFor(const BuildInfo(BuildMode.profile, null, treeShakeIcons: false)), getAssembleTaskFor(const BuildInfo(
BuildMode.profile,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
equals('assembleProfile'), equals('assembleProfile'),
); );
expect( expect(
getAssembleTaskFor(const BuildInfo(BuildMode.profile, 'flavorFoo', treeShakeIcons: false)), getAssembleTaskFor(const BuildInfo(
BuildMode.profile,
'flavorFoo',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
equals('assembleFlavorFooProfile'), equals('assembleFlavorFooProfile'),
); );
}); });
@ -123,21 +148,36 @@ void main() {
group('listApkPaths', () { group('listApkPaths', () {
testWithoutContext('Finds APK without flavor in debug', () { testWithoutContext('Finds APK without flavor in debug', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.debug, '', treeShakeIcons: false)), const AndroidBuildInfo(BuildInfo(
BuildMode.debug,
'',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
); );
expect(apks, <String>['app-debug.apk']); expect(apks, <String>['app-debug.apk']);
}); });
testWithoutContext('Finds APK with flavor in debug', () { testWithoutContext('Finds APK with flavor in debug', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.debug, 'flavor1', treeShakeIcons: false)), const AndroidBuildInfo(BuildInfo(
BuildMode.debug,
'flavor1',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
); );
expect(apks, <String>['app-flavor1-debug.apk']); expect(apks, <String>['app-flavor1-debug.apk']);
}); });
testWithoutContext('Finds APK without flavor in release', () { testWithoutContext('Finds APK without flavor in release', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.release, '', treeShakeIcons: false)), const AndroidBuildInfo(BuildInfo(
BuildMode.release,
'',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
); );
expect(apks, <String>['app-release.apk']); expect(apks, <String>['app-release.apk']);
@ -145,7 +185,12 @@ void main() {
testWithoutContext('Finds APK with flavor in release mode', () { testWithoutContext('Finds APK with flavor in release mode', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.release, 'flavor1', treeShakeIcons: false)), const AndroidBuildInfo(BuildInfo(
BuildMode.release,
'flavor1',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
); );
expect(apks, <String>['app-flavor1-release.apk']); expect(apks, <String>['app-flavor1-release.apk']);
@ -153,7 +198,8 @@ void main() {
testWithoutContext('Finds APK with flavor in release mode', () { testWithoutContext('Finds APK with flavor in release mode', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.release, 'flavorA', treeShakeIcons: false)), const AndroidBuildInfo(BuildInfo(BuildMode.release, 'flavorA', treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',)),
); );
expect(apks, <String>['app-flavora-release.apk']); expect(apks, <String>['app-flavora-release.apk']);
@ -161,15 +207,26 @@ void main() {
testWithoutContext('Finds APK with flavor in release mode - AGP v3', () { testWithoutContext('Finds APK with flavor in release mode - AGP v3', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.release, 'flavor1', treeShakeIcons: false)), const AndroidBuildInfo(BuildInfo(
BuildMode.release,
'flavor1',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
); );
expect(apks, <String>['app-flavor1-release.apk']); expect(apks, <String>['app-flavor1-release.apk']);
}); });
testWithoutContext('Finds APK with split-per-abi', () { testWithoutContext('Finds APK with split-per-abi', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.release, 'flavor1', treeShakeIcons: false), splitPerAbi: true), const AndroidBuildInfo(
BuildInfo(
BuildMode.release,
'flavor1',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
splitPerAbi: true),
); );
expect(apks, unorderedEquals(<String>[ expect(apks, unorderedEquals(<String>[
@ -181,7 +238,14 @@ void main() {
testWithoutContext('Finds APK with split-per-abi when flavor contains uppercase letters', () { testWithoutContext('Finds APK with split-per-abi when flavor contains uppercase letters', () {
final Iterable<String> apks = listApkPaths( final Iterable<String> apks = listApkPaths(
const AndroidBuildInfo(BuildInfo(BuildMode.release, 'flavorA', treeShakeIcons: false), splitPerAbi: true), const AndroidBuildInfo(
BuildInfo(
BuildMode.release,
'flavorA',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
splitPerAbi: true),
); );
expect(apks, unorderedEquals(<String>[ expect(apks, unorderedEquals(<String>[
@ -262,7 +326,12 @@ dependencies:
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -280,7 +349,12 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -297,7 +371,13 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
buildName: '1.0.2',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -315,7 +395,13 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
buildNumber: '3',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -333,7 +419,14 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
buildName: '1.0.2',
buildNumber: '3',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -351,7 +444,14 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
buildName: '1.0.2',
buildNumber: '3',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -368,7 +468,14 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
buildName: '1.0.2',
buildNumber: '3',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -387,17 +494,36 @@ flutter:
'''; ''';
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: const BuildInfo(BuildMode.release, null, treeShakeIcons: false), buildInfo: const BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
); );
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: const BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false), buildInfo: const BuildInfo(
BuildMode.release,
null,
buildName: '1.0.2',
buildNumber: '3',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
expectedBuildName: '1.0.2', expectedBuildName: '1.0.2',
expectedBuildNumber: '3', expectedBuildNumber: '3',
); );
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: const BuildInfo(BuildMode.release, null, buildName: '1.0.3', buildNumber: '4', treeShakeIcons: false), buildInfo: const BuildInfo(
BuildMode.release,
null,
buildName: '1.0.3',
buildNumber: '4',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
expectedBuildName: '1.0.3', expectedBuildName: '1.0.3',
expectedBuildNumber: '4', expectedBuildNumber: '4',
); );
@ -410,7 +536,12 @@ flutter:
// Values get unset. // Values get unset.
await checkBuildVersion( await checkBuildVersion(
manifest: manifest, manifest: manifest,
buildInfo: const BuildInfo(BuildMode.release, null, treeShakeIcons: false), buildInfo: const BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
); );
}); });
}); });

View File

@ -113,11 +113,16 @@ void main() {
project.android, project.android,
androidSdk: sdk, androidSdk: sdk,
processManager: fakeProcessManager, processManager: fakeProcessManager,
userMessages: UserMessages(), userMessages: UserMessages(),
processUtils: ProcessUtils(processManager: fakeProcessManager, logger: logger), processUtils: ProcessUtils(processManager: fakeProcessManager, logger: logger),
logger: logger, logger: logger,
fileSystem: fs, fileSystem: fs,
buildInfo: const BuildInfo(BuildMode.debug, null, treeShakeIcons: false), buildInfo: const BuildInfo(
BuildMode.debug,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
); );
expect(androidApk, isNotNull); expect(androidApk, isNotNull);
}, overrides: overrides); }, overrides: overrides);

View File

@ -179,7 +179,7 @@ void main() {
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'], extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'], extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
bundleSkSLPath: 'foo/bar/baz.sksl.json', bundleSkSLPath: 'foo/bar/baz.sksl.json',
packagesPath: 'foo/.dart_tool/package_config.json', packageConfigPath: 'foo/.dart_tool/package_config.json',
codeSizeDirectory: 'foo/code-size', codeSizeDirectory: 'foo/code-size',
fileSystemRoots: <String>['test5', 'test6'], fileSystemRoots: <String>['test5', 'test6'],
fileSystemScheme: 'scheme', fileSystemScheme: 'scheme',
@ -217,7 +217,7 @@ void main() {
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'], extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'], extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
bundleSkSLPath: 'foo/bar/baz.sksl.json', bundleSkSLPath: 'foo/bar/baz.sksl.json',
packagesPath: 'foo/.dart_tool/package_config.json', packageConfigPath: 'foo/.dart_tool/package_config.json',
codeSizeDirectory: 'foo/code-size', codeSizeDirectory: 'foo/code-size',
// These values are ignored by toEnvironmentConfig // These values are ignored by toEnvironmentConfig
androidProjectArgs: <String>['foo=bar', 'fizz=bazz'], androidProjectArgs: <String>['foo=bar', 'fizz=bazz'],
@ -250,7 +250,7 @@ void main() {
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'], extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'], extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
bundleSkSLPath: 'foo/bar/baz.sksl.json', bundleSkSLPath: 'foo/bar/baz.sksl.json',
packagesPath: 'foo/.dart_tool/package_config.json', packageConfigPath: 'foo/.dart_tool/package_config.json',
codeSizeDirectory: 'foo/code-size', codeSizeDirectory: 'foo/code-size',
androidProjectArgs: <String>['foo=bar', 'fizz=bazz'] androidProjectArgs: <String>['foo=bar', 'fizz=bazz']
); );

View File

@ -175,6 +175,7 @@ void main() {
fileSystemScheme: 'test7', fileSystemScheme: 'test7',
dartDefines: <String>['test8', 'test9'], dartDefines: <String>['test8', 'test9'],
treeShakeIcons: true, treeShakeIcons: true,
packageConfigPath: '.dart_tool/package_config.json',
), ),
project: project, project: project,
mainPath: mainPath, mainPath: mainPath,

View File

@ -49,7 +49,12 @@ void main() {
testWithoutContext('generates config', () async { testWithoutContext('generates config', () async {
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory); final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project); final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
writeGeneratedCmakeConfig( writeGeneratedCmakeConfig(
@ -90,7 +95,12 @@ void main() {
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory); final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project); final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
final Map<String, String> environment = <String, String>{ final Map<String, String> environment = <String, String>{
'TEST': r'hello\world', 'TEST': r'hello\world',
@ -137,7 +147,12 @@ void main() {
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory); final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project); final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(
BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
);
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
writeGeneratedCmakeConfig( writeGeneratedCmakeConfig(
@ -171,6 +186,7 @@ void main() {
null, null,
buildName: '1.2.3', buildName: '1.2.3',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -205,6 +221,7 @@ void main() {
null, null,
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -240,6 +257,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -278,6 +296,7 @@ void main() {
null, null,
buildName: '1.2.3', buildName: '1.2.3',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -316,6 +335,7 @@ void main() {
null, null,
buildNumber: '5', buildNumber: '5',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -355,6 +375,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -389,6 +410,7 @@ void main() {
null, null,
buildName: 'hello.world', buildName: 'hello.world',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -426,6 +448,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: 'foo_bar', buildNumber: 'foo_bar',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -463,6 +486,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: 'hello', buildNumber: 'hello',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -500,6 +524,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4.5', buildNumber: '4.5',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -537,6 +562,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: 'hello', buildNumber: 'hello',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};
@ -578,6 +604,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4.5', buildNumber: '4.5',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final Map<String, String> environment = <String, String>{}; final Map<String, String> environment = <String, String>{};

View File

@ -104,6 +104,7 @@ void main() {
'', '',
nullSafetyMode: NullSafetyMode.unsound, nullSafetyMode: NullSafetyMode.unsound,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
final BufferLogger logger = BufferLogger.test(); final BufferLogger logger = BufferLogger.test();

View File

@ -266,6 +266,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
hostVmServicePort: 1234, hostVmServicePort: 1234,
dartEntrypointArgs: dartEntrypointArgs, dartEntrypointArgs: dartEntrypointArgs,

View File

@ -137,8 +137,12 @@ void main() {
.fuchsia); .fuchsia);
} }
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled( final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(BuildInfo(
BuildInfo(mode, null, treeShakeIcons: false)); mode,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
));
return device.startApp( return device.startApp(
app!, app!,
prebuiltApplication: prebuilt, prebuiltApplication: prebuilt,
@ -189,8 +193,12 @@ void main() {
final File far = globals.fs.file('app_name-0.far')..createSync(); final File far = globals.fs.file('app_name-0.far')..createSync();
final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far)!; final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far)!;
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled( final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(const BuildInfo(
const BuildInfo(BuildMode.release, null, treeShakeIcons: false)); BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
));
final LaunchResult launchResult = await device.startApp(app, final LaunchResult launchResult = await device.startApp(app,
prebuiltApplication: true, debuggingOptions: debuggingOptions); prebuiltApplication: true, debuggingOptions: debuggingOptions);
expect(launchResult.started, isFalse); expect(launchResult.started, isFalse);
@ -215,8 +223,12 @@ void main() {
final File far = globals.fs.file('app_name-0.far')..createSync(); final File far = globals.fs.file('app_name-0.far')..createSync();
final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far)!; final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far)!;
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled( final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(const BuildInfo(
const BuildInfo(BuildMode.release, null, treeShakeIcons: false)); BuildMode.release,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
));
final LaunchResult launchResult = await device.startApp(app, final LaunchResult launchResult = await device.startApp(app,
prebuiltApplication: true, debuggingOptions: debuggingOptions); prebuiltApplication: true, debuggingOptions: debuggingOptions);
expect(launchResult.started, isTrue); expect(launchResult.started, isTrue);

View File

@ -36,14 +36,15 @@ void main() {
test('provide correct flags for custom dart define', () { test('provide correct flags for custom dart define', () {
expect( expect(
FuchsiaKernelCompiler.getBuildInfoFlags( FuchsiaKernelCompiler.getBuildInfoFlags(
buildInfo: const BuildInfo( buildInfo: const BuildInfo(
BuildMode.debug, BuildMode.debug,
null, null,
treeShakeIcons: true, treeShakeIcons: true,
dartDefines: <String>['abc=efg'], dartDefines: <String>['abc=efg'],
), packageConfigPath: '.dart_tool/package_config.json',
manifestPath: ''), ),
manifestPath: ''),
allOf(<Matcher>[ allOf(<Matcher>[
contains('-Dabc=efg'), contains('-Dabc=efg'),
])); ]));

View File

@ -518,6 +518,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
platformArgs: <String, Object>{}, platformArgs: <String, Object>{},
); );
@ -592,6 +593,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
platformArgs: <String, Object>{}, platformArgs: <String, Object>{},
); );
@ -659,6 +661,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
platformArgs: <String, Object>{}, platformArgs: <String, Object>{},
); );
@ -710,6 +713,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
platformArgs: <String, Object>{}, platformArgs: <String, Object>{},
); );
@ -748,6 +752,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
platformArgs: <String, Object>{}, platformArgs: <String, Object>{},
); );
@ -797,6 +802,7 @@ void main() {
buildName: '1.2.3', buildName: '1.2.3',
buildNumber: '4', buildNumber: '4',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
platformArgs: <String, Object>{}, platformArgs: <String, Object>{},
), throwsToolExit()); ), throwsToolExit());

View File

@ -1097,7 +1097,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
applicationPackage: mockDir, applicationPackage: mockDir,
); );
const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false); const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
final DebuggingOptions mockOptions = DebuggingOptions.disabled(mockInfo); final DebuggingOptions mockOptions = DebuggingOptions.disabled(mockInfo);
await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions); await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions);
@ -1125,7 +1125,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
applicationPackage: mockDir, applicationPackage: mockDir,
); );
const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false); const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
final DebuggingOptions mockOptions = DebuggingOptions.disabled(mockInfo); final DebuggingOptions mockOptions = DebuggingOptions.disabled(mockInfo);
final LaunchResult result = await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions); final LaunchResult result = await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions);
@ -1157,7 +1157,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
applicationPackage: mockDir, applicationPackage: mockDir,
); );
const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false); const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
final DebuggingOptions mockOptions = DebuggingOptions.enabled( final DebuggingOptions mockOptions = DebuggingOptions.enabled(
mockInfo, mockInfo,
enableSoftwareRendering: true, enableSoftwareRendering: true,
@ -1229,7 +1229,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
applicationPackage: mockDir, applicationPackage: mockDir,
); );
const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false); const BuildInfo mockInfo = BuildInfo(BuildMode.debug, 'flavor', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
final DebuggingOptions mockOptions = DebuggingOptions.enabled(mockInfo, enableSoftwareRendering: true); final DebuggingOptions mockOptions = DebuggingOptions.enabled(mockInfo, enableSoftwareRendering: true);
await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions, route: '/animation'); await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions, route: '/animation');

View File

@ -634,15 +634,15 @@ Information about project "Runner":
}); });
testWithoutContext('expected scheme for flavored build is the title-cased flavor', () { testWithoutContext('expected scheme for flavored build is the title-cased flavor', () {
expect(XcodeProjectInfo.expectedSchemeFor(const BuildInfo(BuildMode.debug, 'hello', treeShakeIcons: false)), 'Hello'); expect(XcodeProjectInfo.expectedSchemeFor(const BuildInfo(BuildMode.debug, 'hello', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), 'Hello');
expect(XcodeProjectInfo.expectedSchemeFor(const BuildInfo(BuildMode.profile, 'HELLO', treeShakeIcons: false)), 'HELLO'); expect(XcodeProjectInfo.expectedSchemeFor(const BuildInfo(BuildMode.profile, 'HELLO', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), 'HELLO');
expect(XcodeProjectInfo.expectedSchemeFor(const BuildInfo(BuildMode.release, 'Hello', treeShakeIcons: false)), 'Hello'); expect(XcodeProjectInfo.expectedSchemeFor(const BuildInfo(BuildMode.release, 'Hello', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), 'Hello');
}); });
testWithoutContext('expected build configuration for flavored build is Mode-Flavor', () { testWithoutContext('expected build configuration for flavored build is Mode-Flavor', () {
expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.debug, 'hello', treeShakeIcons: false), 'Hello'), 'Debug-Hello'); expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.debug, 'hello', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Hello'), 'Debug-Hello');
expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.profile, 'HELLO', treeShakeIcons: false), 'Hello'), 'Profile-Hello'); expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.profile, 'HELLO', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Hello'), 'Profile-Hello');
expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.release, 'Hello', treeShakeIcons: false), 'Hello'), 'Release-Hello'); expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.release, 'Hello', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Hello'), 'Release-Hello');
}); });
testWithoutContext('scheme for default project is Runner', () { testWithoutContext('scheme for default project is Runner', () {
@ -651,7 +651,7 @@ Information about project "Runner":
expect(info.schemeFor(BuildInfo.debug), 'Runner'); expect(info.schemeFor(BuildInfo.debug), 'Runner');
expect(info.schemeFor(BuildInfo.profile), 'Runner'); expect(info.schemeFor(BuildInfo.profile), 'Runner');
expect(info.schemeFor(BuildInfo.release), 'Runner'); expect(info.schemeFor(BuildInfo.release), 'Runner');
expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'unknown', treeShakeIcons: false)), isNull); expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'unknown', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), isNull);
}); });
testWithoutContext('build configuration for default project is matched against BuildMode', () { testWithoutContext('build configuration for default project is matched against BuildMode', () {
@ -670,11 +670,11 @@ Information about project "Runner":
logger, logger,
); );
expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false)), 'Free'); expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), 'Free');
expect(info.schemeFor(const BuildInfo(BuildMode.profile, 'Free', treeShakeIcons: false)), 'Free'); expect(info.schemeFor(const BuildInfo(BuildMode.profile, 'Free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), 'Free');
expect(info.schemeFor(const BuildInfo(BuildMode.release, 'paid', treeShakeIcons: false)), 'Paid'); expect(info.schemeFor(const BuildInfo(BuildMode.release, 'paid', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), 'Paid');
expect(info.schemeFor(BuildInfo.debug), isNull); expect(info.schemeFor(BuildInfo.debug), isNull);
expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'unknown', treeShakeIcons: false)), isNull); expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'unknown', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json')), isNull);
}); });
testWithoutContext('reports default scheme error and exit', () { testWithoutContext('reports default scheme error and exit', () {
@ -717,10 +717,10 @@ Information about project "Runner":
logger, logger,
); );
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false), 'Free'), 'debug (free)'); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Free'), 'debug (free)');
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.debug, 'Paid', treeShakeIcons: false), 'Paid'), 'Debug paid'); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.debug, 'Paid', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Paid'), 'Debug paid');
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.profile, 'FREE', treeShakeIcons: false), 'Free'), 'profile - Free'); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.profile, 'FREE', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Free'), 'profile - Free');
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.release, 'paid', treeShakeIcons: false), 'Paid'), 'Release-Paid'); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.release, 'paid', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Paid'), 'Release-Paid');
}); });
testWithoutContext('build configuration for project with inconsistent naming is null', () { testWithoutContext('build configuration for project with inconsistent naming is null', () {
@ -730,9 +730,9 @@ Information about project "Runner":
<String>['Free', 'Paid'], <String>['Free', 'Paid'],
logger, logger,
); );
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.debug, 'Free', treeShakeIcons: false), 'Free'), null); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.debug, 'Free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Free'), null);
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.profile, 'Free', treeShakeIcons: false), 'Free'), null); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.profile, 'Free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Free'), null);
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.release, 'Paid', treeShakeIcons: false), 'Paid'), null); expect(info.buildConfigurationFor(const BuildInfo(BuildMode.release, 'Paid', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'), 'Paid'), null);
}); });
group('environmentVariablesAsXcodeBuildSettings', () { group('environmentVariablesAsXcodeBuildSettings', () {
late FakePlatform platform; late FakePlatform platform;
@ -1048,7 +1048,7 @@ Build settings for action build and target plugin2:
}); });
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async { testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project')); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
@ -1162,7 +1162,7 @@ dependencies:
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1180,7 +1180,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1198,7 +1198,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1216,7 +1216,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1234,7 +1234,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildNumber: '3', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1252,7 +1252,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1270,7 +1270,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1287,7 +1287,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, buildName: '1.0.2', buildNumber: '3', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,
@ -1304,7 +1304,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
'''; ''';
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await checkBuildVersion( await checkBuildVersion(
manifestString: manifest, manifestString: manifest,
buildInfo: buildInfo, buildInfo: buildInfo,

View File

@ -69,6 +69,7 @@ void main() {
'', '',
treeShakeIcons: false, treeShakeIcons: false,
trackWidgetCreation: true, trackWidgetCreation: true,
packageConfigPath: '.dart_tool/package_config.json'
)), )),
target: 'main.dart', target: 'main.dart',
devtoolsHandler: createNoOpHandler, devtoolsHandler: createNoOpHandler,

View File

@ -161,11 +161,11 @@ group('PrebuiltMacOSApp', () {
final MacOSProject project = FlutterProject.fromDirectory(globals.fs.currentDirectory).macos; final MacOSProject project = FlutterProject.fromDirectory(globals.fs.currentDirectory).macos;
final BuildableMacOSApp macosApp = MacOSApp.fromMacOSProject(project) as BuildableMacOSApp; final BuildableMacOSApp macosApp = MacOSApp.fromMacOSProject(project) as BuildableMacOSApp;
const BuildInfo vanillaApp = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo vanillaApp = BuildInfo(BuildMode.debug, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
String? applicationBundle = macosApp.bundleDirectory(vanillaApp); String? applicationBundle = macosApp.bundleDirectory(vanillaApp);
expect(applicationBundle, 'Debug'); expect(applicationBundle, 'Debug');
const BuildInfo flavoredApp = BuildInfo(BuildMode.release, 'flavor', treeShakeIcons: false); const BuildInfo flavoredApp = BuildInfo(BuildMode.release, 'flavor', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
applicationBundle = macosApp.bundleDirectory(flavoredApp); applicationBundle = macosApp.bundleDirectory(flavoredApp);
expect(applicationBundle, 'Release-flavor'); expect(applicationBundle, 'Release-flavor');

View File

@ -1109,7 +1109,7 @@ plugins {
IosProject.kProductBundleIdKey: 'io.flutter.someProject', IosProject.kProductBundleIdKey: 'io.flutter.someProject',
}; };
xcodeProjectInterpreter.xcodeProjectInfo = XcodeProjectInfo(<String>[], <String>[], <String>['Free'], logger); xcodeProjectInterpreter.xcodeProjectInfo = XcodeProjectInfo(<String>[], <String>[], <String>['Free'], logger);
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
expect(await project.ios.productBundleIdentifier(buildInfo), 'io.flutter.someProject'); expect(await project.ios.productBundleIdentifier(buildInfo), 'io.flutter.someProject');
}); });
@ -1118,7 +1118,7 @@ plugins {
final FlutterProject project = await someProject(); final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync(); project.ios.xcodeProject.createSync();
xcodeProjectInterpreter.xcodeProjectInfo = XcodeProjectInfo(<String>[], <String>[], <String>['Runner'], logger); xcodeProjectInterpreter.xcodeProjectInfo = XcodeProjectInfo(<String>[], <String>[], <String>['Runner'], logger);
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, 'free', treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json');
await expectToolExitLater( await expectToolExitLater(
project.ios.productBundleIdentifier(buildInfo), project.ios.productBundleIdentifier(buildInfo),

View File

@ -437,6 +437,7 @@ void main() {
BuildMode.debug, '', treeShakeIcons: false, extraFrontEndOptions: <String>[ BuildMode.debug, '', treeShakeIcons: false, extraFrontEndOptions: <String>[
'--enable-experiment=non-nullable', '--enable-experiment=non-nullable',
], ],
packageConfigPath: '.dart_tool/package_config.json'
)), )),
devtoolsHandler: createNoOpHandler, devtoolsHandler: createNoOpHandler,
analytics: fakeAnalytics, analytics: fakeAnalytics,
@ -1592,6 +1593,7 @@ flutter:
BuildMode.debug, BuildMode.debug,
null, null,
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
) )
), ),
target: 'main.dart', target: 'main.dart',
@ -1622,6 +1624,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
dartDefines: <String>['a', 'b'], dartDefines: <String>['a', 'b'],
packageConfigPath: '.dart_tool/package_config.json',
) )
), ),
target: 'main.dart', target: 'main.dart',
@ -1652,7 +1655,8 @@ flutter:
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
extraFrontEndOptions: <String>['--enable-experiment=non-nullable'] extraFrontEndOptions: <String>['--enable-experiment=non-nullable'],
packageConfigPath: '.dart_tool/package_config.json',
) )
), ),
target: 'main.dart', target: 'main.dart',
@ -1731,6 +1735,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
trackWidgetCreation: true, trackWidgetCreation: true,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
target: 'main.dart', target: 'main.dart',
devtoolsHandler: createNoOpHandler, devtoolsHandler: createNoOpHandler,
@ -1820,6 +1825,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
nullSafetyMode: NullSafetyMode.unsound, nullSafetyMode: NullSafetyMode.unsound,
packageConfigPath: '.dart_tool/package_config.json',
), ),
target: null, target: null,
platform: FakePlatform(), platform: FakePlatform(),
@ -1851,6 +1857,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
extraFrontEndOptions: <String>['--enable-experiment=non-nullable'], extraFrontEndOptions: <String>['--enable-experiment=non-nullable'],
packageConfigPath: '.dart_tool/package_config.json',
), ),
target: null, target: null,
platform: FakePlatform(), platform: FakePlatform(),
@ -1883,6 +1890,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
extraFrontEndOptions: <String>[], extraFrontEndOptions: <String>[],
packageConfigPath: '.dart_tool/package_config.json',
), ),
target: null, platform: FakePlatform(), target: null, platform: FakePlatform(),
)).generator as DefaultResidentCompiler?; )).generator as DefaultResidentCompiler?;
@ -1907,6 +1915,7 @@ flutter:
treeShakeIcons: false, treeShakeIcons: false,
extraFrontEndOptions: <String>[], extraFrontEndOptions: <String>[],
initializeFromDill: '/foo/bar.dill', initializeFromDill: '/foo/bar.dill',
packageConfigPath: '.dart_tool/package_config.json',
), ),
target: null, platform: FakePlatform(), target: null, platform: FakePlatform(),
)).generator as DefaultResidentCompiler?; )).generator as DefaultResidentCompiler?;
@ -1931,6 +1940,7 @@ flutter:
treeShakeIcons: false, treeShakeIcons: false,
extraFrontEndOptions: <String>[], extraFrontEndOptions: <String>[],
assumeInitializeFromDillUpToDate: true, assumeInitializeFromDillUpToDate: true,
packageConfigPath: '.dart_tool/package_config.json'
), ),
target: null, platform: FakePlatform(), target: null, platform: FakePlatform(),
)).generator as DefaultResidentCompiler?; )).generator as DefaultResidentCompiler?;
@ -1953,6 +1963,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
frontendServerStarterPath: '/foo/bar/frontend_server_starter.dart', frontendServerStarterPath: '/foo/bar/frontend_server_starter.dart',
packageConfigPath: '.dart_tool/package_config.json'
), ),
target: null, platform: FakePlatform(), target: null, platform: FakePlatform(),
)).generator as DefaultResidentCompiler?; )).generator as DefaultResidentCompiler?;
@ -2368,6 +2379,7 @@ flutter:
'', '',
treeShakeIcons: false, treeShakeIcons: false,
trackWidgetCreation: true, trackWidgetCreation: true,
packageConfigPath: '.dart_tool/package_config.json',
)), )),
target: 'main.dart', target: 'main.dart',
devtoolsHandler: createNoOpHandler, devtoolsHandler: createNoOpHandler,

View File

@ -272,7 +272,7 @@ void main() {
testUsingContext('WebRunner copies compiled app.dill to cache during startup', testUsingContext('WebRunner copies compiled app.dill to cache during startup',
() async { () async {
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled( final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
const BuildInfo(BuildMode.debug, null, treeShakeIcons: false), const BuildInfo(BuildMode.debug, null, treeShakeIcons: false, packageConfigPath: '.dart_tool/package_config.json'),
); );
final ResidentRunner residentWebRunner = final ResidentRunner residentWebRunner =
setUpResidentRunner(flutterDevice, debuggingOptions: debuggingOptions); setUpResidentRunner(flutterDevice, debuggingOptions: debuggingOptions);

View File

@ -643,7 +643,7 @@ void main() {
testUsingContext('use packagesPath to generate BuildInfo', () async { testUsingContext('use packagesPath to generate BuildInfo', () async {
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo'); final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo');
final BuildInfo buildInfo = await flutterCommand.getBuildInfo(forcedBuildMode: BuildMode.debug); final BuildInfo buildInfo = await flutterCommand.getBuildInfo(forcedBuildMode: BuildMode.debug);
expect(buildInfo.packagesPath, 'foo'); expect(buildInfo.packageConfigPath, 'foo');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => processManager, ProcessManager: () => processManager,

View File

@ -1361,12 +1361,15 @@ TerminalHandler setUpTerminalHandler(List<FakeVmServiceRequest> requests, {
final ProcessInfo processInfo = ProcessInfo.test(MemoryFileSystem.test()); final ProcessInfo processInfo = ProcessInfo.test(MemoryFileSystem.test());
final FlutterDevice device = FlutterDevice( final FlutterDevice device = FlutterDevice(
FakeDevice()..supportsScreenshot = supportsScreenshot, FakeDevice()..supportsScreenshot = supportsScreenshot,
buildInfo: BuildInfo(buildMode, '', treeShakeIcons: false), buildInfo: BuildInfo(
buildMode,
'',
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
),
generator: FakeResidentCompiler(), generator: FakeResidentCompiler(),
developmentShaderCompiler: const FakeShaderCompiler(), developmentShaderCompiler: const FakeShaderCompiler(),
targetPlatform: web targetPlatform: web ? TargetPlatform.web_javascript : TargetPlatform.android_arm,
? TargetPlatform.web_javascript
: TargetPlatform.android_arm,
); );
device.vmService = FakeVmServiceHost(requests: requests).vmService; device.vmService = FakeVmServiceHost(requests: requests).vmService;
final FakeResidentRunner residentRunner = FakeResidentRunner(device, testLogger, localFileSystem) final FakeResidentRunner residentRunner = FakeResidentRunner(device, testLogger, localFileSystem)

View File

@ -29,7 +29,8 @@ final BuildInfo debugBuild = BuildInfo(
treeShakeIcons: false, treeShakeIcons: false,
packageConfig: PackageConfig(<Package>[ packageConfig: PackageConfig(<Package>[
Package('test_api', Uri.parse('file:///test_api/')), Package('test_api', Uri.parse('file:///test_api/')),
]) ]),
packageConfigPath: '.dart_tool/package_config.json',
); );
void main() { void main() {

View File

@ -83,6 +83,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
); );
await compiler.initialize( await compiler.initialize(

View File

@ -159,11 +159,16 @@ Hello!
''', ''',
)); ));
final LaunchResult result = await device.startApp(app, final LaunchResult result = await device.startApp(
app,
mainPath: mainPath, mainPath: mainPath,
debuggingOptions: DebuggingOptions.enabled(const BuildInfo(BuildMode.debug, null, treeShakeIcons: false)), debuggingOptions: DebuggingOptions.enabled(const BuildInfo(
BuildMode.debug,
null,
treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
)),
); );
expect(result.started, isTrue); expect(result.started, isTrue);
expect(result.vmServiceUri, vmServiceUri); expect(result.vmServiceUri, vmServiceUri);
expect(logLines.last, 'Hello!'); expect(logLines.last, 'Hello!');

View File

@ -921,6 +921,7 @@ void main() {
'', '',
treeShakeIcons: false, treeShakeIcons: false,
nullSafetyMode: NullSafetyMode.unsound, nullSafetyMode: NullSafetyMode.unsound,
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
@ -1059,6 +1060,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
@ -1198,6 +1200,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: true, enableDwds: true,
enableDds: false, enableDds: false,
@ -1319,11 +1322,14 @@ void main() {
useSseForInjectedClient: true, useSseForInjectedClient: true,
nullAssertions: true, nullAssertions: true,
nativeNullAssertions: true, nativeNullAssertions: true,
buildInfo: const BuildInfo(BuildMode.debug, '', buildInfo: const BuildInfo(
treeShakeIcons: false, BuildMode.debug, '',
dartDefines: <String>[ treeShakeIcons: false,
'FLUTTER_WEB_USE_SKIA=true', dartDefines: <String>[
]), 'FLUTTER_WEB_USE_SKIA=true',
],
packageConfigPath: '.dart_tool/package_config.json',
),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
entrypoint: Uri.base, entrypoint: Uri.base,
@ -1372,11 +1378,14 @@ void main() {
useSseForInjectedClient: true, useSseForInjectedClient: true,
nullAssertions: true, nullAssertions: true,
nativeNullAssertions: true, nativeNullAssertions: true,
buildInfo: const BuildInfo(BuildMode.debug, '', buildInfo: const BuildInfo(
treeShakeIcons: false, BuildMode.debug, '',
dartDefines: <String>[ treeShakeIcons: false,
'FLUTTER_WEB_AUTO_DETECT=true', dartDefines: <String>[
]), 'FLUTTER_WEB_AUTO_DETECT=true',
],
packageConfigPath: '.dart_tool/package_config.json',
),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
entrypoint: Uri.base, entrypoint: Uri.base,
@ -1475,6 +1484,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
false, false,
false, false,
@ -1508,6 +1518,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
false, false,
false, false,

View File

@ -752,6 +752,7 @@ void main() {
'', '',
treeShakeIcons: false, treeShakeIcons: false,
nullSafetyMode: NullSafetyMode.unsound, nullSafetyMode: NullSafetyMode.unsound,
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
@ -866,6 +867,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
@ -986,6 +988,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: true, enableDwds: true,
enableDds: false, enableDds: false,
@ -1101,7 +1104,8 @@ void main() {
treeShakeIcons: false, treeShakeIcons: false,
dartDefines: <String>[ dartDefines: <String>[
'FLUTTER_WEB_USE_SKIA=true', 'FLUTTER_WEB_USE_SKIA=true',
] ],
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
@ -1152,7 +1156,8 @@ void main() {
treeShakeIcons: false, treeShakeIcons: false,
dartDefines: <String>[ dartDefines: <String>[
'FLUTTER_WEB_AUTO_DETECT=true', 'FLUTTER_WEB_AUTO_DETECT=true',
] ],
packageConfigPath: '.dart_tool/package_config.json',
), ),
enableDwds: false, enableDwds: false,
enableDds: false, enableDds: false,
@ -1248,6 +1253,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
false, false,
false, false,
@ -1282,6 +1288,7 @@ void main() {
BuildMode.debug, BuildMode.debug,
'', '',
treeShakeIcons: false, treeShakeIcons: false,
packageConfigPath: '.dart_tool/package_config.json',
), ),
false, false,
false, false,