Commit 4447c0aa authored by Alexander Aprelev's avatar Alexander Aprelev Committed by Ian Hickson

Add --preview-dart-2 option support for ios builds (#13251)

parent cb7599aa
...@@ -88,6 +88,11 @@ BuildApp() { ...@@ -88,6 +88,11 @@ BuildApp() {
local_engine_flag="--local-engine=$LOCAL_ENGINE" local_engine_flag="--local-engine=$LOCAL_ENGINE"
fi fi
local preview_dart_2_flag=""
if [[ -n "$PREVIEW_DART_2" ]]; then
preview_dart_2_flag="--preview-dart-2"
fi
if [[ "$CURRENT_ARCH" != "x86_64" ]]; then if [[ "$CURRENT_ARCH" != "x86_64" ]]; then
local aot_flags="" local aot_flags=""
if [[ "$build_mode" == "debug" ]]; then if [[ "$build_mode" == "debug" ]]; then
...@@ -101,7 +106,8 @@ BuildApp() { ...@@ -101,7 +106,8 @@ BuildApp() {
--target-platform=ios \ --target-platform=ios \
--target="${target_path}" \ --target="${target_path}" \
${aot_flags} \ ${aot_flags} \
${local_engine_flag} ${local_engine_flag} \
${preview_dart_2_flag}
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
EchoError "Failed to build ${project_path}." EchoError "Failed to build ${project_path}."
...@@ -133,6 +139,7 @@ BuildApp() { ...@@ -133,6 +139,7 @@ BuildApp() {
--working-dir="${build_dir}/flx" \ --working-dir="${build_dir}/flx" \
${precompilation_flag} \ ${precompilation_flag} \
${local_engine_flag} \ ${local_engine_flag} \
${preview_dart_2_flag} \
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
EchoError "Failed to package ${project_path}." EchoError "Failed to package ${project_path}."
......
...@@ -29,6 +29,7 @@ class BuildIOSCommand extends BuildSubCommand { ...@@ -29,6 +29,7 @@ class BuildIOSCommand extends BuildSubCommand {
argParser.addFlag('simulator', help: 'Build for the iOS simulator instead of the device.'); argParser.addFlag('simulator', help: 'Build for the iOS simulator instead of the device.');
argParser.addFlag('codesign', negatable: true, defaultsTo: true, argParser.addFlag('codesign', negatable: true, defaultsTo: true,
help: 'Codesign the application bundle (only available on device builds).'); help: 'Codesign the application bundle (only available on device builds).');
argParser.addFlag('preview-dart-2', negatable: false);
} }
@override @override
...@@ -70,7 +71,8 @@ class BuildIOSCommand extends BuildSubCommand { ...@@ -70,7 +71,8 @@ class BuildIOSCommand extends BuildSubCommand {
buildInfo: buildInfo, buildInfo: buildInfo,
target: targetFile, target: targetFile,
buildForDevice: !forSimulator, buildForDevice: !forSimulator,
codesign: shouldCodesign codesign: shouldCodesign,
previewDart2 : argResults['preview-dart-2'],
); );
if (!result.success) { if (!result.success) {
......
...@@ -214,6 +214,7 @@ class CreateCommand extends FlutterCommand { ...@@ -214,6 +214,7 @@ class CreateCommand extends FlutterCommand {
buildInfo: BuildInfo.debug, buildInfo: BuildInfo.debug,
target: flx.defaultMainPath, target: flx.defaultMainPath,
hasPlugins: generatePlugin, hasPlugins: generatePlugin,
previewDart2: false,
); );
if (argResults['pub']) { if (argResults['pub']) {
......
...@@ -205,6 +205,7 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -205,6 +205,7 @@ Future<XcodeBuildResult> buildXcodeProject({
bool buildForDevice, bool buildForDevice,
bool codesign: true, bool codesign: true,
bool usesTerminalUi: true, bool usesTerminalUi: true,
bool previewDart2: false,
}) async { }) async {
if (!_checkXcodeVersion()) if (!_checkXcodeVersion())
return new XcodeBuildResult(success: false); return new XcodeBuildResult(success: false);
...@@ -264,7 +265,8 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -264,7 +265,8 @@ Future<XcodeBuildResult> buildXcodeProject({
projectPath: fs.currentDirectory.path, projectPath: fs.currentDirectory.path,
buildInfo: buildInfo, buildInfo: buildInfo,
target: target, target: target,
hasPlugins: hasFlutterPlugins hasPlugins: hasFlutterPlugins,
previewDart2: previewDart2,
); );
final List<String> commands = <String>[ final List<String> commands = <String>[
......
...@@ -24,6 +24,7 @@ void updateXcodeGeneratedProperties({ ...@@ -24,6 +24,7 @@ void updateXcodeGeneratedProperties({
@required BuildInfo buildInfo, @required BuildInfo buildInfo,
@required String target, @required String target,
@required bool hasPlugins, @required bool hasPlugins,
@required bool previewDart2,
}) { }) {
final StringBuffer localsBuffer = new StringBuffer(); final StringBuffer localsBuffer = new StringBuffer();
...@@ -53,6 +54,10 @@ void updateXcodeGeneratedProperties({ ...@@ -53,6 +54,10 @@ void updateXcodeGeneratedProperties({
localsBuffer.writeln('LOCAL_ENGINE=${localEngineArtifacts.engineOutPath}'); localsBuffer.writeln('LOCAL_ENGINE=${localEngineArtifacts.engineOutPath}');
} }
if (previewDart2) {
localsBuffer.writeln('PREVIEW_DART_2=true');
}
// Add dependency to CocoaPods' generated project only if plugins are used. // Add dependency to CocoaPods' generated project only if plugins are used.
if (hasPlugins) if (hasPlugins)
localsBuffer.writeln('#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"'); localsBuffer.writeln('#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"');
......
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