Commit 83e0ca24 authored by asiva's avatar asiva Committed by Siva

Fuse --strong into --preview-dart-2 option.

parent 4814303b
......@@ -261,11 +261,6 @@ class FlutterPlugin implements Plugin<Project> {
previewDart2Value = project.property('preview-dart-2')
}
Boolean strongModeValue = false
if (project.hasProperty('strong')) {
strongModeValue = project.property('strong')
}
String extraFrontEndOptionsValue = null
if (project.hasProperty('extra-front-end-options')) {
extraFrontEndOptionsValue = project.property('extra-front-end-options')
......@@ -304,7 +299,6 @@ class FlutterPlugin implements Plugin<Project> {
localEngineSrcPath this.localEngineSrcPath
targetPath target
previewDart2 previewDart2Value
strongMode strongModeValue
preferSharedLibrary preferSharedLibraryValue
targetPlatform targetPlatformValue
sourceDir project.file(project.flutter.source)
......@@ -320,7 +314,6 @@ class FlutterPlugin implements Plugin<Project> {
localEngineSrcPath this.localEngineSrcPath
targetPath target
previewDart2 previewDart2Value
strongMode strongModeValue
preferSharedLibrary preferSharedLibraryValue
targetPlatform targetPlatformValue
sourceDir project.file(project.flutter.source)
......@@ -357,8 +350,6 @@ abstract class BaseFlutterTask extends DefaultTask {
@Optional @Input
Boolean previewDart2
@Optional @Input
Boolean strongMode
@Optional @Input
Boolean preferSharedLibrary
@Optional @Input
String targetPlatform
......@@ -401,9 +392,6 @@ abstract class BaseFlutterTask extends DefaultTask {
if (previewDart2) {
args "--preview-dart-2"
}
if (strongMode) {
args "--strong"
}
if (extraFrontEndOptions != null) {
args "--extra-front-end-options", "${extraFrontEndOptions}"
}
......@@ -433,9 +421,6 @@ abstract class BaseFlutterTask extends DefaultTask {
if (previewDart2) {
args "--preview-dart-2"
}
if (strongMode) {
args "--strong"
}
args "--output-file", "${intermediateDir}/app.flx"
if (buildMode != "debug") {
......
......@@ -291,12 +291,11 @@ Future<Null> _buildGradleProjectV2(String gradle, BuildInfo buildInfo, String ta
}
if (buildInfo.previewDart2) {
command.add('-Ppreview-dart-2=true');
if (buildInfo.strongMode)
command.add('-Pstrong=true');
if (buildInfo.extraFrontEndOptions != null)
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
if (buildInfo.extraGenSnapshotOptions != null)
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}');
if (buildInfo.extraFrontEndOptions != null)
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
if (buildInfo.extraGenSnapshotOptions != null)
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}');
}
if (buildInfo.preferSharedLibrary && androidSdk.ndkCompiler != null) {
command.add('-Pprefer-shared-library=true');
......
......@@ -21,7 +21,6 @@ enum Artifact {
vmSnapshotData,
isolateSnapshotData,
platformKernelDill,
platformKernelStrongDill,
platformLibrariesJson,
flutterPatchedSdkPath,
frontendServerSnapshotForEngineDartSdk,
......@@ -47,8 +46,6 @@ String _artifactToFileName(Artifact artifact) {
case Artifact.isolateSnapshotData:
return 'isolate_snapshot.bin';
case Artifact.platformKernelDill:
return 'platform.dill';
case Artifact.platformKernelStrongDill:
return 'platform_strong.dill';
case Artifact.platformLibrariesJson:
return 'libraries.json';
......@@ -172,7 +169,6 @@ class CachedArtifacts extends Artifacts {
final String platformDirName = getNameForTargetPlatform(platform);
return fs.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact));
case Artifact.platformKernelDill:
case Artifact.platformKernelStrongDill:
return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact));
case Artifact.platformLibrariesJson:
return fs.path.join(_getFlutterPatchedSdkPath(), 'lib', _artifactToFileName(artifact));
......@@ -243,7 +239,6 @@ class LocalEngineArtifacts extends Artifacts {
case Artifact.vmSnapshotData:
return fs.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact));
case Artifact.platformKernelDill:
case Artifact.platformKernelStrongDill:
return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact));
case Artifact.platformLibrariesJson:
return fs.path.join(_getFlutterPatchedSdkPath(), 'lib', _artifactToFileName(artifact));
......
......@@ -12,7 +12,6 @@ import 'globals.dart';
class BuildInfo {
const BuildInfo(this.mode, this.flavor,
{this.previewDart2,
this.strongMode,
this.extraFrontEndOptions,
this.extraGenSnapshotOptions,
this.preferSharedLibrary,
......@@ -30,9 +29,6 @@ class BuildInfo {
// Whether build should be done using Dart2 Frontend parser.
final bool previewDart2;
// Whether build should use strong mode semantics.
final bool strongMode;
/// Extra command-line options for front-end.
final String extraFrontEndOptions;
......@@ -72,7 +68,6 @@ class BuildInfo {
BuildInfo withTargetPlatform(TargetPlatform targetPlatform) =>
new BuildInfo(mode, flavor,
previewDart2: previewDart2,
strongMode: strongMode,
extraFrontEndOptions: extraFrontEndOptions,
extraGenSnapshotOptions: extraGenSnapshotOptions,
preferSharedLibrary: preferSharedLibrary,
......
......@@ -40,7 +40,6 @@ class BuildAotCommand extends BuildSubCommand {
..addFlag('interpreter')
..addFlag('quiet', defaultsTo: false)
..addFlag('preview-dart-2', negatable: false, hide: !verboseHelp)
..addFlag('strong', negatable: false, hide: !verboseHelp)
..addOption(FlutterOptions.kExtraFrontEndOptions,
allowMultiple: true,
splitCommas: true,
......@@ -82,7 +81,6 @@ class BuildAotCommand extends BuildSubCommand {
outputPath: argResults['output-dir'],
interpreter: argResults['interpreter'],
previewDart2: argResults['preview-dart-2'],
strongMode: argResults['strong'],
extraFrontEndOptions: argResults[FlutterOptions.kExtraFrontEndOptions],
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
preferSharedLibrary: argResults['prefer-shared-library'],
......@@ -114,7 +112,6 @@ Future<String> buildAotSnapshot(
String outputPath,
bool interpreter: false,
bool previewDart2: false,
bool strongMode: false,
List<String> extraFrontEndOptions,
List<String> extraGenSnapshotOptions,
bool preferSharedLibrary: false,
......@@ -128,7 +125,6 @@ Future<String> buildAotSnapshot(
outputPath: outputPath,
interpreter: interpreter,
previewDart2: previewDart2,
strongMode: strongMode,
extraFrontEndOptions: extraFrontEndOptions,
extraGenSnapshotOptions: extraGenSnapshotOptions,
preferSharedLibrary: preferSharedLibrary,
......@@ -148,7 +144,6 @@ Future<String> _buildAotSnapshot(
String outputPath,
bool interpreter: false,
bool previewDart2: false,
bool strongMode: false,
List<String> extraFrontEndOptions,
List<String> extraGenSnapshotOptions,
bool preferSharedLibrary: false,
......@@ -346,19 +341,16 @@ Future<String> _buildAotSnapshot(
extraFrontEndOptions: extraFrontEndOptions,
linkPlatformKernelIn : true,
aot : true,
strongMode: strongMode,
);
if (mainPath == null) {
printError('Compiler terminated unexpectedly.');
return null;
}
if (strongMode) {
genSnapshotCmd.addAll(<String>[
'--reify-generic-functions',
'--strong',
]);
}
genSnapshotCmd.addAll(<String>[
'--reify-generic-functions',
'--strong',
]);
}
genSnapshotCmd.add(mainPath);
......
......@@ -15,8 +15,7 @@ class BuildApkCommand extends BuildSubCommand {
usesPubOption();
argParser
..addFlag('preview-dart-2', negatable: false, hide: !verboseHelp)
..addFlag('strong', negatable: false, hide: !verboseHelp)
..addFlag('preview-dart-2', negatable: false, hide: !verboseHelp)
..addFlag('prefer-shared-library', negatable: false,
help: 'Whether to prefer compiling to a *.so file (android only).')
..addOption('target-platform',
......
......@@ -21,7 +21,6 @@ class BuildFlxCommand extends BuildSubCommand {
argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath);
argParser.addOption('depfile', defaultsTo: defaultDepfilePath);
argParser.addFlag('preview-dart-2', negatable: false, hide: !verboseHelp);
argParser.addFlag('strong', negatable: false, hide: !verboseHelp);
argParser.addOption('working-dir', defaultsTo: getAssetBuildDirectory());
argParser.addFlag('report-licensed-packages', help: 'Whether to report the names of all the packages that are included in the application\'s LICENSE file.', defaultsTo: false);
usesPubOption();
......@@ -51,7 +50,6 @@ class BuildFlxCommand extends BuildSubCommand {
privateKeyPath: argResults['private-key'],
workingDirPath: argResults['working-dir'],
previewDart2: argResults['preview-dart-2'],
strongMode: argResults['strong'],
precompiledSnapshot: argResults['precompiled'],
reportLicensedPackages: argResults['report-licensed-packages']
);
......
......@@ -31,8 +31,6 @@ class BuildIOSCommand extends BuildSubCommand {
help: 'Codesign the application bundle (only available on device builds).');
argParser.addFlag('preview-dart-2', negatable: false,
hide: !verboseHelp);
argParser.addFlag('strong', negatable: false,
hide: !verboseHelp);
}
@override
......
......@@ -238,7 +238,6 @@ class CreateCommand extends FlutterCommand {
target: flx.defaultMainPath,
hasPlugins: generatePlugin,
previewDart2: false,
strongMode: false,
);
if (argResults['pub']) {
......
......@@ -374,7 +374,6 @@ class AppDomain extends Domain {
usesTerminalUI: false,
applicationBinary: applicationBinary,
previewDart2: previewDart2,
strongMode: strongMode,
projectRootPath: projectRootPath,
packagesFilePath: packagesFilePath,
projectAssets: projectAssets,
......@@ -389,7 +388,6 @@ class AppDomain extends Domain {
usesTerminalUI: false,
applicationBinary: applicationBinary,
previewDart2: previewDart2,
strongMode: strongMode,
ipv6: ipv6,
);
}
......
......@@ -254,7 +254,6 @@ class RunCommand extends RunCommandBase {
_createDebuggingOptions(), hotMode,
applicationBinary: argResults['use-application-binary'],
previewDart2: argResults['preview-dart-2'],
strongMode: argResults['strong'],
projectRootPath: argResults['project-root'],
packagesFilePath: globalResults['packages'],
projectAssets: argResults['project-assets'],
......@@ -293,9 +292,7 @@ class RunCommand extends RunCommandBase {
}
final List<FlutterDevice> flutterDevices = devices.map((Device device) {
return new FlutterDevice(device,
previewDart2: argResults['preview-dart-2'],
strongMode : argResults['strong']);
return new FlutterDevice(device, previewDart2: argResults['preview-dart-2']);
}).toList();
ResidentRunner runner;
......@@ -307,7 +304,6 @@ class RunCommand extends RunCommandBase {
benchmarkMode: argResults['benchmark'],
applicationBinary: argResults['use-application-binary'],
previewDart2: argResults['preview-dart-2'],
strongMode: argResults['strong'],
projectRootPath: argResults['project-root'],
packagesFilePath: globalResults['packages'],
projectAssets: argResults['project-assets'],
......@@ -322,7 +318,6 @@ class RunCommand extends RunCommandBase {
traceStartup: traceStartup,
applicationBinary: argResults['use-application-binary'],
previewDart2: argResults['preview-dart-2'],
strongMode: argResults['strong'],
stayResident: stayResident,
ipv6: ipv6,
);
......
......@@ -60,7 +60,6 @@ Future<String> compile(
String mainPath,
bool linkPlatformKernelIn: false,
bool aot: false,
bool strongMode: false,
List<String> extraFrontEndOptions,
String incrementalCompilerByteStorePath,
String packagesPath}) async {
......@@ -76,15 +75,13 @@ Future<String> compile(
frontendServer,
'--sdk-root',
sdkRoot,
'--strong',
];
if (!linkPlatformKernelIn)
command.add('--no-link-platform');
if (aot) {
command.add('--aot');
}
if (strongMode) {
command.add('--strong');
}
if (incrementalCompilerByteStorePath != null) {
command.add('--incremental');
}
......@@ -121,16 +118,13 @@ Future<String> compile(
/// The wrapper is intended to stay resident in memory as user changes, reloads,
/// restarts the Flutter app.
class ResidentCompiler {
ResidentCompiler(this._sdkRoot, {bool strongMode: false})
: assert(_sdkRoot != null) {
ResidentCompiler(this._sdkRoot) : assert(_sdkRoot != null) {
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!_sdkRoot.endsWith('/'))
_sdkRoot = '$_sdkRoot/';
_strongMode = strongMode;
}
String _sdkRoot;
bool _strongMode;
Process _server;
final _StdoutHandler stdoutHandler = new _StdoutHandler();
......@@ -165,11 +159,9 @@ class ResidentCompiler {
frontendServer,
'--sdk-root',
_sdkRoot,
'--incremental'
'--incremental',
'--strong'
];
if (_strongMode) {
args.add('--strong');
}
_server = await processManager.start(args);
_server.stdout
.transform(UTF8.decoder)
......
......@@ -39,7 +39,6 @@ Future<Null> build({
String workingDirPath,
String packagesPath,
bool previewDart2 : false,
bool strongMode : false,
bool precompiledSnapshot: false,
bool reportLicensedPackages: false
}) async {
......@@ -74,7 +73,6 @@ Future<Null> build({
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
incrementalCompilerByteStorePath: fs.path.absolute(getIncrementalCompilerByteStoreDirectory()),
mainPath: fs.file(mainPath).absolute.path,
strongMode: strongMode
);
if (kernelBinaryFilename == null) {
throwToolExit('Compiler terminated unexpectedly on $mainPath');
......@@ -90,7 +88,6 @@ Future<Null> build({
privateKeyPath: privateKeyPath,
workingDirPath: workingDirPath,
packagesPath: packagesPath,
strongMode: strongMode,
reportLicensedPackages: reportLicensedPackages
).then((_) => null);
}
......@@ -104,7 +101,6 @@ Future<List<String>> assemble({
String privateKeyPath: defaultPrivateKeyPath,
String workingDirPath,
String packagesPath,
bool strongMode : false,
bool includeDefaultFonts: true,
bool reportLicensedPackages: false
}) async {
......@@ -135,9 +131,7 @@ Future<List<String>> assemble({
.toList();
if (kernelContent != null) {
final String platformKernelDill = strongMode ?
artifacts.getArtifactPath(Artifact.platformKernelStrongDill) :
artifacts.getArtifactPath(Artifact.platformKernelDill);
final String platformKernelDill = artifacts.getArtifactPath(Artifact.platformKernelDill);
zipBuilder.entries[_kKernelKey] = kernelContent;
zipBuilder.entries[_kPlatformKernelKey] = new DevFSFileContent(fs.file(platformKernelDill));
}
......
......@@ -264,7 +264,6 @@ Future<XcodeBuildResult> buildXcodeProject({
target: target,
hasPlugins: hasFlutterPlugins,
previewDart2: buildInfo.previewDart2,
strongMode: buildInfo.strongMode,
);
if (hasFlutterPlugins) {
......
......@@ -392,7 +392,6 @@ class IOSSimulator extends Device {
final BuildInfo debugBuildInfo = new BuildInfo(BuildMode.debug, buildInfo.flavor,
previewDart2: buildInfo.previewDart2,
strongMode: buildInfo.strongMode,
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
preferSharedLibrary: buildInfo.preferSharedLibrary);
......@@ -416,8 +415,7 @@ class IOSSimulator extends Device {
// When running in previewDart2 mode, we still need to run compiler to
// produce kernel file for the application.
flx.build(precompiledSnapshot: !buildInfo.previewDart2,
previewDart2: buildInfo.previewDart2,
strongMode: buildInfo.strongMode);
previewDart2: buildInfo.previewDart2);
@override
Future<bool> stopApp(ApplicationPackage app) async {
......
......@@ -25,7 +25,6 @@ void updateXcodeGeneratedProperties({
@required String target,
@required bool hasPlugins,
@required bool previewDart2,
@required bool strongMode,
}) {
final StringBuffer localsBuffer = new StringBuffer();
......@@ -57,8 +56,6 @@ void updateXcodeGeneratedProperties({
if (previewDart2) {
localsBuffer.writeln('PREVIEW_DART_2=true');
}
if (strongMode) {
localsBuffer.writeln('STRONG=true');
}
......
......@@ -38,12 +38,9 @@ class FlutterDevice {
StreamSubscription<String> _loggingSubscription;
FlutterDevice(this.device,
{ bool previewDart2 : false, bool strongMode : false }) {
FlutterDevice(this.device, { bool previewDart2 : false }) {
if (previewDart2)
generator = new ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
strongMode: strongMode);
generator = new ResidentCompiler(artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath));
}
String viewFilter;
......@@ -270,8 +267,8 @@ class FlutterDevice {
}
final Map<String, dynamic> platformArgs = <String, dynamic>{};
if (hotRunner.strongMode != null)
platformArgs['strong'] = hotRunner.strongMode;
if (hotRunner.previewDart2 != null)
platformArgs['strong'] = hotRunner.previewDart2;
startEchoingDeviceLog();
......@@ -333,8 +330,8 @@ class FlutterDevice {
final Map<String, dynamic> platformArgs = <String, dynamic>{};
if (coldRunner.traceStartup != null)
platformArgs['trace-startup'] = coldRunner.traceStartup;
if (coldRunner.strongMode != null)
platformArgs['strong'] = coldRunner.strongMode;
if (coldRunner.previewDart2 != null)
platformArgs['strong'] = coldRunner.previewDart2;
startEchoingDeviceLog();
......
......@@ -21,7 +21,6 @@ class ColdRunner extends ResidentRunner {
this.traceStartup: false,
this.applicationBinary,
this.previewDart2 : false,
this.strongMode : false,
bool stayResident: true,
bool ipv6: false,
}) : super(devices,
......@@ -34,7 +33,6 @@ class ColdRunner extends ResidentRunner {
final bool traceStartup;
final String applicationBinary;
final bool previewDart2;
final bool strongMode;
@override
Future<int> run({
......
......@@ -40,7 +40,6 @@ class HotRunner extends ResidentRunner {
this.benchmarkMode: false,
this.applicationBinary,
this.previewDart2: false,
this.strongMode: false,
this.hostIsIde: false,
String projectRootPath,
String packagesFilePath,
......@@ -67,7 +66,6 @@ class HotRunner extends ResidentRunner {
bool _runningFromSnapshot = true;
bool previewDart2 = false;
DateTime firstBuildTime;
bool strongMode = false;
void _addBenchmarkData(String name, int value) {
benchmarkData[name] ??= <int>[];
......
......@@ -163,20 +163,12 @@ abstract class FlutterCommand extends Command<Null> {
final bool previewDart2 = argParser.options.containsKey('preview-dart-2')
? argResults['preview-dart-2']
: false;
final bool strongMode = argParser.options.containsKey('strong')
? argResults['strong']
: false;
if (strongMode == true && previewDart2 == false) {
throw new UsageException(
'--strong is valid only when --preview-dart-2 is specified.', null);
}
return new BuildInfo(getBuildMode(),
argParser.options.containsKey('flavor')
? argResults['flavor']
: null,
previewDart2: previewDart2,
strongMode: strongMode,
extraFrontEndOptions: argParser.options.containsKey(FlutterOptions.kExtraFrontEndOptions)
? argResults[FlutterOptions.kExtraFrontEndOptions]
: null,
......@@ -400,16 +392,6 @@ abstract class FlutterCommand extends Command<Null> {
if (!fs.isFileSync(targetPath))
throw new ToolExit('Target file "$targetPath" not found.');
}
final bool previewDart2 = argParser.options.containsKey('preview-dart-2')
? argResults['preview-dart-2']
: false;
final bool strongMode = argParser.options.containsKey('strong')
? argResults['strong']
: false;
if (strongMode == true && previewDart2 == false) {
throw new ToolExit('--strong is valid only with --preview-dart-2 option.');
}
}
ApplicationPackageStore applicationPackages;
......
......@@ -209,7 +209,6 @@ class _FlutterPlatform extends PlatformPlugin {
incrementalCompilerByteStorePath: '' /* not null is enough */,
mainPath: listenerFile.path,
packagesPath: PackageMap.globalPackagesPath,
strongMode: true,
);
// bundlePath needs to point to a folder with `platform.dill` file.
......@@ -222,7 +221,7 @@ class _FlutterPlatform extends PlatformPlugin {
// copy 'vm_platform_strong.dill' into 'platform.dill'
final File vmPlatformStrongDill = fs.file(
artifacts.getArtifactPath(Artifact.platformKernelStrongDill),
artifacts.getArtifactPath(Artifact.platformKernelDill),
);
final File platformDill = vmPlatformStrongDill.copySync(
tempBundleDirectory.childFile('platform.dill').path,
......@@ -547,11 +546,12 @@ void main() {
}
if (strongMode) {
command.add('--strong');
} else {
command.add('--enable-checked-mode');
}
command.addAll(<String>[
'--enable-dart-profiling',
'--non-interactive',
'--enable-checked-mode',
'--use-test-fonts',
// '--enable-txt', // enable this to test libtxt rendering
'--packages=$packages',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment