Teach FlutterPlugin.groovy about AOT builds (#4389)

The `flutter.buildMode` property now controls whether to build in debug,
profiling, or release.
This commit is contained in:
Adam Barth
2016-06-06 12:56:04 -07:00
parent 6c96e1a320
commit 8f03ebe56b
4 changed files with 87 additions and 30 deletions

View File

@@ -33,17 +33,17 @@ BuildApp() {
target_path=${FLUTTER_TARGET}
fi
local flutter_mode="release"
if [[ -n "$FLUTTER_MODE" ]]; then
flutter_mode=${FLUTTER_MODE}
local build_mode="release"
if [[ -n "$FLUTTER_BUILD_MODE" ]]; then
build_mode=${FLUTTER_BUILD_MODE}
fi
local artifact_variant="unknown"
case "$flutter_mode" in
case "$build_mode" in
release) artifact_variant="ios-release";;
profile) artifact_variant="ios-profile";;
debug) artifact_variant="ios";;
*) echo "Unknown FLUTTER_MODE: $FLUTTER_MODE";;
*) echo "Unknown FLUTTER_BUILD_MODE: $FLUTTER_BUILD_MODE";;
esac
local framework_path="${FLUTTER_ROOT}/bin/cache/artifacts/engine/${artifact_variant}"
@@ -72,10 +72,10 @@ BuildApp() {
if [[ $CURRENT_ARCH != "x86_64" ]]; then
local aot_flags=""
if [[ "$flutter_mode" == "debug" ]]; then
if [[ "$build_mode" == "debug" ]]; then
aot_flags="--interpreter --debug"
else
aot_flags="--${flutter_mode}"
aot_flags="--${build_mode}"
fi
RunCommand ${FLUTTER_ROOT}/bin/flutter --suppress-analytics build aot \
@@ -95,7 +95,7 @@ BuildApp() {
fi
local precompilation_flag=""
if [[ $CURRENT_ARCH != "x86_64" ]] && [[ "$flutter_mode" != "debug" ]]; then
if [[ $CURRENT_ARCH != "x86_64" ]] && [[ "$build_mode" != "debug" ]]; then
precompilation_flag="--precompiled"
fi

View File

@@ -70,7 +70,7 @@ void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String t
localsBuffer.writeln('FLUTTER_TARGET=$target');
// The runtime mode for the current build.
localsBuffer.writeln('FLUTTER_MODE=${getModeName(mode)}');
localsBuffer.writeln('FLUTTER_BUILD_MODE=${getModeName(mode)}');
String flutterFrameworkDir = path.normalize(tools.getEngineArtifactsDirectory(TargetPlatform.ios, mode).path);
localsBuffer.writeln('FLUTTER_FRAMEWORK_DIR=$flutterFrameworkDir');