diff --git a/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart b/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart index 0ea62417e5..ea84906dc9 100644 --- a/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart +++ b/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart @@ -102,7 +102,9 @@ Future _testBuildIosFramework(Directory projectDir, { bool isModule = fals options: [ 'ios-framework', '--verbose', - '--output=$outputDirectoryName' + '--output=$outputDirectoryName', + '--obfuscate', + '--split-debug-info=symbols', ], ); }); @@ -189,6 +191,20 @@ Future _testBuildIosFramework(Directory projectDir, { bool isModule = fals 'vm_snapshot_data', )); + section('Check obfuscation symbols'); + + checkFileExists(path.join( + projectDir.path, + 'symbols', + 'app.ios-arm64.symbols', + )); + + checkFileExists(path.join( + projectDir.path, + 'symbols', + 'app.ios-armv7.symbols', + )); + section('Check debug build has no Dart AOT'); final String aotSymbols = await _dylibSymbols(debugAppFrameworkPath); diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart index 904cae2e7c..bd92397feb 100644 --- a/packages/flutter_tools/lib/src/build_info.dart +++ b/packages/flutter_tools/lib/src/build_info.dart @@ -24,7 +24,7 @@ class BuildInfo { this.trackWidgetCreation = false, List? extraFrontEndOptions, List? extraGenSnapshotOptions, - this.fileSystemRoots, + List? fileSystemRoots, this.fileSystemScheme, this.buildNumber, this.buildName, @@ -42,6 +42,7 @@ class BuildInfo { this.packageConfig = PackageConfig.empty, }) : extraFrontEndOptions = extraFrontEndOptions ?? const [], extraGenSnapshotOptions = extraGenSnapshotOptions ?? const [], + fileSystemRoots = fileSystemRoots ?? const [], dartDefines = dartDefines ?? const [], dartExperiments = dartExperiments ?? const []; @@ -69,7 +70,7 @@ class BuildInfo { /// file. If not provided, defaults to `.packages`. final String packagesPath; - final List? fileSystemRoots; + final List fileSystemRoots; final String? fileSystemScheme; /// Whether the build should track widget creation locations. @@ -185,6 +186,40 @@ class BuildInfo { /// so the lower cased flavor name is used to compute the output file name String? get lowerCasedFlavor => flavor?.toLowerCase(); + /// Convert to a structured string encoded structure appropriate for usage + /// in build system [Environment.defines]. + /// + /// Fields that are `null` are excluded from this configuration. + Map toBuildSystemEnvironment() { + // packagesPath and performanceMeasurementFile are not passed into + // the Environment map. + return { + kBuildMode: getNameForBuildMode(mode), + if (dartDefines.isNotEmpty) + kDartDefines: encodeDartDefines(dartDefines), + if (dartObfuscation != null) + kDartObfuscation: dartObfuscation.toString(), + if (extraFrontEndOptions.isNotEmpty) + kExtraFrontEndOptions: extraFrontEndOptions.join(','), + if (extraGenSnapshotOptions.isNotEmpty) + kExtraGenSnapshotOptions: extraGenSnapshotOptions.join(','), + if (splitDebugInfoPath != null) + kSplitDebugInfo: splitDebugInfoPath!, + if (trackWidgetCreation != null) + kTrackWidgetCreation: trackWidgetCreation.toString(), + if (treeShakeIcons != null) + kIconTreeShakerFlag: treeShakeIcons.toString(), + if (bundleSkSLPath != null) + kBundleSkSLPath: bundleSkSLPath!, + if (codeSizeDirectory != null) + kCodeSizeDirectory: codeSizeDirectory!, + if (fileSystemRoots.isNotEmpty) + kFileSystemRoots: fileSystemRoots.join(','), + if (fileSystemScheme != null) + kFileSystemScheme: fileSystemScheme!, + }; + } + /// Convert to a structured string encoded structure appropriate for usage as /// environment variables or to embed in other scripts. /// @@ -774,6 +809,87 @@ String getFuchsiaBuildDirectory() { /// These values are URI-encoded and then combined into a comma-separated string. const String kDartDefines = 'DartDefines'; +/// The define to pass a [BuildMode]. +const String kBuildMode = 'BuildMode'; + +/// The define to pass whether we compile 64-bit android-arm code. +const String kTargetPlatform = 'TargetPlatform'; + +/// The define to control what target file is used. +const String kTargetFile = 'TargetFile'; + +/// The define to control whether the AOT snapshot is built with bitcode. +const String kBitcodeFlag = 'EnableBitcode'; + +/// Whether to enable or disable track widget creation. +const String kTrackWidgetCreation = 'TrackWidgetCreation'; + +/// Additional configuration passed to the dart front end. +/// +/// This is expected to be a comma separated list of strings. +const String kExtraFrontEndOptions = 'ExtraFrontEndOptions'; + +/// Additional configuration passed to gen_snapshot. +/// +/// This is expected to be a comma separated list of strings. +const String kExtraGenSnapshotOptions = 'ExtraGenSnapshotOptions'; + +/// Whether the build should run gen_snapshot as a split aot build for deferred +/// components. +const String kDeferredComponents = 'DeferredComponents'; + +/// Whether to strip source code information out of release builds and where to save it. +const String kSplitDebugInfo = 'SplitDebugInfo'; + +/// Alternative scheme for file URIs. +/// +/// May be used along with [kFileSystemRoots] to support a multi-root +/// filesystem. +const String kFileSystemScheme = 'FileSystemScheme'; + +/// Additional filesystem roots. +/// +/// If provided, must be used along with [kFileSystemScheme]. +const String kFileSystemRoots = 'FileSystemRoots'; + +/// The define to control what iOS architectures are built for. +/// +/// This is expected to be a space-delimited list of architectures. If not +/// provided, defaults to arm64. +/// +/// The other supported value is armv7, the 32-bit iOS architecture. +const String kIosArchs = 'IosArchs'; + +/// The define to control what macOS architectures are built for. +/// +/// This is expected to be a space-delimited list of architectures. If not +/// provided, defautls to x86_64. +/// +/// Supported values are x86_64 and arm64. +const String kDarwinArchs = 'DarwinArchs'; + +/// Path to the SDK root to be used as the isysroot. +const String kSdkRoot = 'SdkRoot'; + +/// Whether to enable Dart obfuscation and where to save the symbol map. +const String kDartObfuscation = 'DartObfuscation'; + +/// An output directory where one or more code-size measurements may be written. +const String kCodeSizeDirectory = 'CodeSizeDirectory'; + +/// SHA identifier of the Apple developer code signing identity. +/// +/// Same as EXPANDED_CODE_SIGN_IDENTITY Xcode build setting. +/// Also discoverable via `security find-identity -p codesigning`. +const String kCodesignIdentity = 'CodesignIdentity'; + +/// The build define controlling whether icon fonts should be stripped down to +/// only the glyphs used by the application. +const String kIconTreeShakerFlag = 'TreeShakeIcons'; + +/// The input key for an SkSL bundle path. +const String kBundleSkSLPath = 'BundleSkSLPath'; + final Converter _defineEncoder = utf8.encoder.fuse(base64.encoder); final Converter _defineDecoder = base64.decoder.fuse(utf8.decoder); diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart index 404b5edad6..5a984b6db3 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart @@ -18,9 +18,6 @@ import '../depfile.dart'; import 'common.dart'; import 'icon_tree_shaker.dart'; -/// The input key for an SkSL bundle path. -const String kBundleSkSLPath = 'BundleSkSLPath'; - /// A helper function to copy an asset bundle into an [environment]'s output /// directory. /// diff --git a/packages/flutter_tools/lib/src/build_system/targets/common.dart b/packages/flutter_tools/lib/src/build_system/targets/common.dart index f302131b87..abd8fe9417 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/common.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/common.dart @@ -21,80 +21,6 @@ import 'dart_plugin_registrant.dart'; import 'icon_tree_shaker.dart'; import 'localizations.dart'; -/// The define to pass a [BuildMode]. -const String kBuildMode = 'BuildMode'; - -/// The define to pass whether we compile 64-bit android-arm code. -const String kTargetPlatform = 'TargetPlatform'; - -/// The define to control what target file is used. -const String kTargetFile = 'TargetFile'; - -/// The define to control whether the AOT snapshot is built with bitcode. -const String kBitcodeFlag = 'EnableBitcode'; - -/// Whether to enable or disable track widget creation. -const String kTrackWidgetCreation = 'TrackWidgetCreation'; - -/// Additional configuration passed to the dart front end. -/// -/// This is expected to be a comma separated list of strings. -const String kExtraFrontEndOptions = 'ExtraFrontEndOptions'; - -/// Additional configuration passed to gen_snapshot. -/// -/// This is expected to be a comma separated list of strings. -const String kExtraGenSnapshotOptions = 'ExtraGenSnapshotOptions'; - -/// Whether the build should run gen_snapshot as a split aot build for deferred -/// components. -const String kDeferredComponents = 'DeferredComponents'; - -/// Whether to strip source code information out of release builds and where to save it. -const String kSplitDebugInfo = 'SplitDebugInfo'; - -/// Alternative scheme for file URIs. -/// -/// May be used along with [kFileSystemRoots] to support a multi-root -/// filesystem. -const String kFileSystemScheme = 'FileSystemScheme'; - -/// Additional filesystem roots. -/// -/// If provided, must be used along with [kFileSystemScheme]. -const String kFileSystemRoots = 'FileSystemRoots'; - -/// The define to control what iOS architectures are built for. -/// -/// This is expected to be a space-delimited list of architectures. If not -/// provided, defaults to arm64. -/// -/// The other supported value is armv7, the 32-bit iOS architecture. -const String kIosArchs = 'IosArchs'; - -/// The define to control what macOS architectures are built for. -/// -/// This is expected to be a space-delimited list of architectures. If not -/// provided, defautls to x86_64. -/// -/// Supported values are x86_64 and arm64. -const String kDarwinArchs = 'DarwinArchs'; - -/// Path to the SDK root to be used as the isysroot. -const String kSdkRoot = 'SdkRoot'; - -/// Whether to enable Dart obfuscation and where to save the symbol map. -const String kDartObfuscation = 'DartObfuscation'; - -/// An output directory where one or more code-size measurements may be written. -const String kCodeSizeDirectory = 'CodeSizeDirectory'; - -/// SHA identifier of the Apple developer code signing identity. -/// -/// Same as EXPANDED_CODE_SIGN_IDENTITY Xcode build setting. -/// Also discoverable via `security find-identity -p codesigning`. -const String kCodesignIdentity = 'CodesignIdentity'; - /// Copies the pre-built flutter bundle. // This is a one-off rule for implementing build bundle in terms of assemble. class CopyFlutterBundle extends Target { diff --git a/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart b/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart index b532154195..f502f49704 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart @@ -13,7 +13,6 @@ import '../../dart/package_map.dart'; import '../../flutter_plugins.dart'; import '../../project.dart'; import '../build_system.dart'; -import 'common.dart'; /// Generates a new `./dart_tool/flutter_build/generated_main.dart` /// based on the current dependency map in `pubspec.lock`. diff --git a/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart b/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart index 2d56bb064e..c836e68545 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart @@ -13,14 +13,10 @@ import '../../base/common.dart'; import '../../base/file_system.dart'; import '../../base/io.dart'; import '../../base/logger.dart'; +import '../../build_info.dart'; import '../../convert.dart'; import '../../devfs.dart'; import '../build_system.dart'; -import 'common.dart'; - -/// The build define controlling whether icon fonts should be stripped down to -/// only the glyphs used by the application. -const String kIconTreeShakerFlag = 'TreeShakeIcons'; List> _getList(dynamic object, String errorMessage) { if (object is List) { diff --git a/packages/flutter_tools/lib/src/build_system/targets/web.dart b/packages/flutter_tools/lib/src/build_system/targets/web.dart index f713bdd1bf..4c155af771 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/web.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/web.dart @@ -22,7 +22,6 @@ import '../../project.dart'; import '../build_system.dart'; import '../depfile.dart'; import 'assets.dart'; -import 'common.dart'; import 'localizations.dart'; /// Whether the application has web plugins. diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart index 73aed9f362..cfc366c6e7 100644 --- a/packages/flutter_tools/lib/src/bundle.dart +++ b/packages/flutter_tools/lib/src/bundle.dart @@ -18,7 +18,6 @@ import 'build_info.dart'; import 'build_system/build_system.dart'; import 'build_system/depfile.dart'; import 'build_system/targets/common.dart'; -import 'build_system/targets/icon_tree_shaker.dart'; import 'cache.dart'; import 'convert.dart'; import 'devfs.dart'; @@ -110,27 +109,11 @@ class BundleBuilder { ? null : globals.flutterVersion.engineRevision, defines: { - // used by by the CopyFlutterBundle target - kBuildMode: getNameForBuildMode(buildInfo.mode), - // used by the KernelSnapshot target kTargetPlatform: getNameForTargetPlatform(platform), kTargetFile: mainPath, - kTrackWidgetCreation: buildInfo.trackWidgetCreation.toString(), - if (buildInfo.extraFrontEndOptions.isNotEmpty) - kExtraFrontEndOptions: buildInfo.extraFrontEndOptions.join(','), - if (buildInfo.extraGenSnapshotOptions.isNotEmpty) - kExtraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions.join(','), - if (buildInfo.fileSystemRoots != null && buildInfo.fileSystemRoots.isNotEmpty) - kFileSystemRoots: buildInfo.fileSystemRoots?.join(','), - kFileSystemScheme: buildInfo.fileSystemScheme, - if (buildInfo.dartDefines.isNotEmpty) - kDartDefines: encodeDartDefines(buildInfo.dartDefines), - - // used by the CopyFlutterBundle target too, inside the copyAssets - // call after the snapshot was built - kIconTreeShakerFlag: buildInfo.treeShakeIcons.toString(), - kDeferredComponents: 'false' + kDeferredComponents: 'false', + ...buildInfo.toBuildSystemEnvironment(), }, artifacts: globals.artifacts, fileSystem: globals.fs, diff --git a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart index 12698864ba..69e0663aa1 100644 --- a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart +++ b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart @@ -15,8 +15,6 @@ import '../base/process.dart'; import '../base/utils.dart'; import '../build_info.dart'; import '../build_system/build_system.dart'; -import '../build_system/targets/common.dart'; -import '../build_system/targets/icon_tree_shaker.dart'; import '../build_system/targets/ios.dart'; import '../cache.dart'; import '../flutter_plugins.dart'; @@ -362,20 +360,13 @@ end flutterRootDir: globals.fs.directory(Cache.flutterRoot), defines: { kTargetFile: targetFile, - kBuildMode: getNameForBuildMode(buildInfo.mode), kTargetPlatform: getNameForTargetPlatform(TargetPlatform.ios), - kIconTreeShakerFlag: buildInfo.treeShakeIcons.toString(), - kDartDefines: encodeDartDefines(buildInfo.dartDefines), kBitcodeFlag: 'true', - if (buildInfo?.extraGenSnapshotOptions?.isNotEmpty ?? false) - kExtraGenSnapshotOptions: - buildInfo.extraGenSnapshotOptions.join(','), - if (buildInfo?.extraFrontEndOptions?.isNotEmpty ?? false) - kExtraFrontEndOptions: buildInfo.extraFrontEndOptions.join(','), kIosArchs: defaultIOSArchsForEnvironment(sdkType) .map(getNameForDarwinArch) .join(' '), kSdkRoot: await globals.xcode.sdkLocation(sdkType), + ...buildInfo.toBuildSystemEnvironment(), }, artifacts: globals.artifacts, fileSystem: globals.fs, diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index f2c7997fc6..fb8f43d03b 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -18,7 +18,6 @@ import '../base/user_messages.dart'; import '../base/utils.dart'; import '../build_info.dart'; import '../build_system/build_system.dart'; -import '../build_system/targets/common.dart' show kExtraFrontEndOptions, kExtraGenSnapshotOptions; // for deprecated option name aliases only import '../bundle.dart' as bundle; import '../cache.dart'; import '../dart/generate_synthetic_packages.dart'; diff --git a/packages/flutter_tools/lib/src/web/compile.dart b/packages/flutter_tools/lib/src/web/compile.dart index 0a5ecf4c80..5c7362410e 100644 --- a/packages/flutter_tools/lib/src/web/compile.dart +++ b/packages/flutter_tools/lib/src/web/compile.dart @@ -10,8 +10,6 @@ import '../base/file_system.dart'; import '../base/logger.dart'; import '../build_info.dart'; import '../build_system/build_system.dart'; -import '../build_system/targets/common.dart'; -import '../build_system/targets/icon_tree_shaker.dart'; import '../build_system/targets/web.dart'; import '../cache.dart'; import '../flutter_plugins.dart'; @@ -48,18 +46,14 @@ Future buildWeb( .childDirectory('.dart_tool') .childDirectory('flutter_build'), defines: { - kBuildMode: getNameForBuildMode(buildInfo.mode), kTargetFile: target, kHasWebPlugins: hasWebPlugins.toString(), - kDartDefines: encodeDartDefines(buildInfo.dartDefines), kCspMode: csp.toString(), - kIconTreeShakerFlag: buildInfo.treeShakeIcons.toString(), kSourceMapsEnabled: sourceMaps.toString(), kNativeNullAssertions: nativeNullAssertions.toString(), if (serviceWorkerStrategy != null) kServiceWorkerStrategy: serviceWorkerStrategy, - if (buildInfo.extraFrontEndOptions?.isNotEmpty ?? false) - kExtraFrontEndOptions: buildInfo.extraFrontEndOptions.join(','), + ...buildInfo.toBuildSystemEnvironment(), }, artifacts: globals.artifacts, fileSystem: globals.fs, diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart index cfddb0da72..a426f064d4 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart @@ -98,7 +98,7 @@ void main() { final BuildCommand buildCommand = BuildCommand(); final CommandRunner runner = createTestCommandRunner(buildCommand); setupFileSystemForEndToEndTest(fileSystem); - await runner.run(['build', 'web', '--no-pub']); + await runner.run(['build', 'web', '--no-pub', '--dart-define=foo=a']); expect(fileSystem.file(fileSystem.path.join('lib', 'generated_plugin_registrant.dart')).existsSync(), true); }, overrides: { @@ -106,7 +106,21 @@ void main() { FileSystem: () => fileSystem, FeatureFlags: () => TestFeatureFlags(isWebEnabled: true), ProcessManager: () => FakeProcessManager.any(), - BuildSystem: () => TestBuildSystem.all(BuildResult(success: true)), + BuildSystem: () => TestBuildSystem.all(BuildResult(success: true), (Target target, Environment environment) { + expect(environment.defines, { + 'TargetFile': 'lib/main.dart', + 'HasWebPlugins': 'true', + 'cspMode': 'false', + 'SourceMaps': 'false', + 'NativeNullAssertions': 'true', + 'ServiceWorkerStrategy': 'offline-first', + 'BuildMode': 'release', + 'DartDefines': 'Zm9vPWE=,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==', + 'DartObfuscation': 'false', + 'TrackWidgetCreation': 'false', + 'TreeShakeIcons': 'false', + }); + }), }); testUsingContext('hidden if feature flag is not enabled', () async { diff --git a/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart b/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart index 8ad037fc9f..8d731848d1 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart @@ -9,8 +9,6 @@ import 'package:file/memory.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; -import 'package:flutter_tools/src/build_system/targets/icon_tree_shaker.dart'; import 'package:flutter_tools/src/bundle.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/build_bundle.dart'; @@ -214,7 +212,8 @@ void main() { kTrackWidgetCreation: 'true', kFileSystemScheme: 'org-dartlang-root', kIconTreeShakerFlag: 'false', - kDeferredComponents: 'false' + kDeferredComponents: 'false', + kDartObfuscation: 'false', }); }), FileSystem: () => MemoryFileSystem.test(), @@ -244,7 +243,8 @@ void main() { kFileSystemScheme: 'org-dartlang-root', kDartDefines: 'Zm9vPWJhcg==', kIconTreeShakerFlag: 'false', - kDeferredComponents: 'false' + kDeferredComponents: 'false', + kDartObfuscation: 'false', }); }), FileSystem: () => MemoryFileSystem.test(), @@ -273,7 +273,8 @@ void main() { kTrackWidgetCreation: 'true', kFileSystemScheme: 'org-dartlang-root2', kIconTreeShakerFlag: 'false', - kDeferredComponents: 'false' + kDeferredComponents: 'false', + kDartObfuscation: 'false', }); }), FileSystem: () => MemoryFileSystem.test(), @@ -303,7 +304,8 @@ void main() { kFileSystemScheme: 'org-dartlang-root', kFileSystemRoots: 'test1,test2', kIconTreeShakerFlag: 'false', - kDeferredComponents: 'false' + kDeferredComponents: 'false', + kDartObfuscation: 'false', }); }), FileSystem: () => MemoryFileSystem.test(), @@ -333,7 +335,8 @@ void main() { kFileSystemScheme: 'org-dartlang-root', kExtraFrontEndOptions: '--testflag,--testflag2', kIconTreeShakerFlag: 'false', - kDeferredComponents: 'false' + kDeferredComponents: 'false', + kDartObfuscation: 'false', }); }), FileSystem: () => MemoryFileSystem.test(), @@ -363,7 +366,8 @@ void main() { kFileSystemScheme: 'org-dartlang-root', kExtraGenSnapshotOptions: '--testflag,--testflag2', kIconTreeShakerFlag: 'false', - kDeferredComponents: 'false' + kDeferredComponents: 'false', + kDartObfuscation: 'false', }); }), FileSystem: () => MemoryFileSystem.test(), diff --git a/packages/flutter_tools/test/general.shard/android/deferred_components_gen_snapshot_validator_test.dart b/packages/flutter_tools/test/general.shard/android/deferred_components_gen_snapshot_validator_test.dart index a240f24122..6e6231c729 100644 --- a/packages/flutter_tools/test/general.shard/android/deferred_components_gen_snapshot_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/android/deferred_components_gen_snapshot_validator_test.dart @@ -11,8 +11,8 @@ import 'package:flutter_tools/src/base/deferred_component.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; +import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/globals.dart' as globals; import '../../src/common.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_info_test.dart b/packages/flutter_tools/test/general.shard/build_info_test.dart index aff87f9e27..4e3ed538d6 100644 --- a/packages/flutter_tools/test/general.shard/build_info_test.dart +++ b/packages/flutter_tools/test/general.shard/build_info_test.dart @@ -95,6 +95,38 @@ void main() { expect(() => getIOSArchForName('bogus'), throwsException); }); + testWithoutContext('toBuildSystemEnvironment encoding of standard values', () { + const BuildInfo buildInfo = BuildInfo(BuildMode.debug, '', + treeShakeIcons: true, + trackWidgetCreation: true, + dartDefines: ['foo=2', 'bar=2'], + dartObfuscation: true, + splitDebugInfoPath: 'foo/', + extraFrontEndOptions: ['--enable-experiment=non-nullable', 'bar'], + extraGenSnapshotOptions: ['--enable-experiment=non-nullable', 'fizz'], + bundleSkSLPath: 'foo/bar/baz.sksl.json', + packagesPath: 'foo/.packages', + codeSizeDirectory: 'foo/code-size', + fileSystemRoots: ['test5', 'test6'], + fileSystemScheme: 'scheme', + ); + + expect(buildInfo.toBuildSystemEnvironment(), { + 'BuildMode': 'debug', + 'DartDefines': 'Zm9vPTI=,YmFyPTI=', + 'DartObfuscation': 'true', + 'ExtraFrontEndOptions': '--enable-experiment=non-nullable,bar', + 'ExtraGenSnapshotOptions': '--enable-experiment=non-nullable,fizz', + 'SplitDebugInfo': 'foo/', + 'TrackWidgetCreation': 'true', + 'TreeShakeIcons': 'true', + 'BundleSkSLPath': 'foo/bar/baz.sksl.json', + 'CodeSizeDirectory': 'foo/code-size', + 'FileSystemRoots': 'test5,test6', + 'FileSystemScheme': 'scheme', + }); + }); + testWithoutContext('toEnvironmentConfig encoding of standard values', () { const BuildInfo buildInfo = BuildInfo(BuildMode.debug, '', treeShakeIcons: true, diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart index a5a032cd76..c2fd17a0dc 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart @@ -15,8 +15,6 @@ import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; import 'package:flutter_tools/src/build_system/targets/android.dart'; -import 'package:flutter_tools/src/build_system/targets/assets.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/convert.dart'; import '../../../src/common.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart index 1b73ec101a..cc848304fc 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart @@ -7,8 +7,8 @@ import 'package:file/memory.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; +import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/dart_plugin_registrant.dart'; import 'package:flutter_tools/src/project.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart index c0284220ac..dbb2dd8bdc 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart @@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/targets/android.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/deferred_components.dart'; import '../../../src/common.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart index 2bada9b3b6..baabbb4940 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart @@ -13,8 +13,8 @@ import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/terminal.dart'; +import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/icon_tree_shaker.dart'; import 'package:flutter_tools/src/devfs.dart'; import 'package:meta/meta.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart index d3e1c238e8..dd69acfa5a 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart @@ -12,8 +12,6 @@ import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/assets.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/ios.dart'; import 'package:flutter_tools/src/convert.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart index 84a922ac30..b9471ea58a 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/assets.dart'; import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/linux.dart'; import 'package:flutter_tools/src/convert.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart index c6f51e8ada..8a73da9c51 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart @@ -11,8 +11,6 @@ import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/assets.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/macos.dart'; import 'package:flutter_tools/src/convert.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart index a0fdf01c4e..aaf1d78525 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/web.dart'; import 'package:flutter_tools/src/globals_null_migrated.dart' as globals; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart index 57e65f692b..7469e2aa77 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart @@ -13,7 +13,6 @@ import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; -import 'package:flutter_tools/src/build_system/targets/assets.dart'; import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/windows.dart'; import 'package:flutter_tools/src/convert.dart'; diff --git a/packages/flutter_tools/test/general.shard/bundle_builder_test.dart b/packages/flutter_tools/test/general.shard/bundle_builder_test.dart index f23c276b87..b73e1a93d7 100644 --- a/packages/flutter_tools/test/general.shard/bundle_builder_test.dart +++ b/packages/flutter_tools/test/general.shard/bundle_builder_test.dart @@ -8,8 +8,6 @@ import 'package:file/memory.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/common.dart'; -import 'package:flutter_tools/src/build_system/targets/icon_tree_shaker.dart'; import 'package:flutter_tools/src/bundle.dart'; import 'package:flutter_tools/src/globals_null_migrated.dart' as globals; import 'package:flutter_tools/src/project.dart';