Standardize build system environment defines derived from build info (#81879)
This commit is contained in:
parent
dd33283a57
commit
783e1dd22c
@ -102,7 +102,9 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
options: <String>[
|
||||
'ios-framework',
|
||||
'--verbose',
|
||||
'--output=$outputDirectoryName'
|
||||
'--output=$outputDirectoryName',
|
||||
'--obfuscate',
|
||||
'--split-debug-info=symbols',
|
||||
],
|
||||
);
|
||||
});
|
||||
@ -189,6 +191,20 @@ Future<void> _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);
|
||||
|
@ -24,7 +24,7 @@ class BuildInfo {
|
||||
this.trackWidgetCreation = false,
|
||||
List<String>? extraFrontEndOptions,
|
||||
List<String>? extraGenSnapshotOptions,
|
||||
this.fileSystemRoots,
|
||||
List<String>? fileSystemRoots,
|
||||
this.fileSystemScheme,
|
||||
this.buildNumber,
|
||||
this.buildName,
|
||||
@ -42,6 +42,7 @@ class BuildInfo {
|
||||
this.packageConfig = PackageConfig.empty,
|
||||
}) : extraFrontEndOptions = extraFrontEndOptions ?? const <String>[],
|
||||
extraGenSnapshotOptions = extraGenSnapshotOptions ?? const <String>[],
|
||||
fileSystemRoots = fileSystemRoots ?? const <String>[],
|
||||
dartDefines = dartDefines ?? const <String>[],
|
||||
dartExperiments = dartExperiments ?? const <String>[];
|
||||
|
||||
@ -69,7 +70,7 @@ class BuildInfo {
|
||||
/// file. If not provided, defaults to `.packages`.
|
||||
final String packagesPath;
|
||||
|
||||
final List<String>? fileSystemRoots;
|
||||
final List<String> 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<String, String> toBuildSystemEnvironment() {
|
||||
// packagesPath and performanceMeasurementFile are not passed into
|
||||
// the Environment map.
|
||||
return <String, String>{
|
||||
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<String, String> _defineEncoder = utf8.encoder.fuse(base64.encoder);
|
||||
final Converter<String, String> _defineDecoder = base64.decoder.fuse(utf8.decoder);
|
||||
|
||||
|
@ -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.
|
||||
///
|
||||
|
@ -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 {
|
||||
|
@ -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`.
|
||||
|
@ -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<Map<String, dynamic>> _getList(dynamic object, String errorMessage) {
|
||||
if (object is List<dynamic>) {
|
||||
|
@ -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.
|
||||
|
@ -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: <String, String>{
|
||||
// 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,
|
||||
|
@ -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: <String, String>{
|
||||
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,
|
||||
|
@ -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';
|
||||
|
@ -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<void> buildWeb(
|
||||
.childDirectory('.dart_tool')
|
||||
.childDirectory('flutter_build'),
|
||||
defines: <String, String>{
|
||||
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,
|
||||
|
@ -98,7 +98,7 @@ void main() {
|
||||
final BuildCommand buildCommand = BuildCommand();
|
||||
final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
|
||||
setupFileSystemForEndToEndTest(fileSystem);
|
||||
await runner.run(<String>['build', 'web', '--no-pub']);
|
||||
await runner.run(<String>['build', 'web', '--no-pub', '--dart-define=foo=a']);
|
||||
|
||||
expect(fileSystem.file(fileSystem.path.join('lib', 'generated_plugin_registrant.dart')).existsSync(), true);
|
||||
}, overrides: <Type, Generator>{
|
||||
@ -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, <String, String>{
|
||||
'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 {
|
||||
|
@ -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(),
|
||||
|
@ -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';
|
||||
|
@ -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: <String>['foo=2', 'bar=2'],
|
||||
dartObfuscation: true,
|
||||
splitDebugInfoPath: 'foo/',
|
||||
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
|
||||
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
|
||||
bundleSkSLPath: 'foo/bar/baz.sksl.json',
|
||||
packagesPath: 'foo/.packages',
|
||||
codeSizeDirectory: 'foo/code-size',
|
||||
fileSystemRoots: <String>['test5', 'test6'],
|
||||
fileSystemScheme: 'scheme',
|
||||
);
|
||||
|
||||
expect(buildInfo.toBuildSystemEnvironment(), <String, String>{
|
||||
'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,
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user