Unverified Commit 91b82347 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Build App.framework directly to build directory (#69699)

parent 23198d4e
......@@ -119,6 +119,12 @@ Future<void> main() async {
<String>['embed_and_thin'],
environment: <String, String>{
'SOURCE_ROOT': flutterProject.iosPath,
'BUILT_PRODUCTS_DIR': path.join(
flutterProject.rootPath,
'build',
'ios',
'Release-iphoneos',
),
'TARGET_BUILD_DIR': buildPath,
'FRAMEWORKS_FOLDER_PATH': 'Runner.app/Frameworks',
'VERBOSE_SCRIPT_LOGGING': '1',
......
......@@ -179,7 +179,7 @@ is set to release or run \"flutter build ios --release\", then re-run Archive fr
${flutter_engine_flag} \
${local_engine_flag} \
assemble \
--output="${derived_dir}/" \
--output="${BUILT_PRODUCTS_DIR}/" \
${performance_measurement_option} \
-dTargetPlatform=ios \
-dTargetFile="${target_path}" \
......@@ -287,26 +287,24 @@ EmbedFlutterFrameworks() {
project_path="${FLUTTER_APPLICATION_PATH}"
fi
# Prefer the hidden .ios folder, but fallback to a visible ios folder if .ios
# doesn't exist.
local flutter_ios_out_folder="${project_path}/.ios/Flutter"
local flutter_ios_engine_folder="${project_path}/.ios/Flutter/engine"
if [[ ! -d ${flutter_ios_out_folder} ]]; then
flutter_ios_out_folder="${project_path}/ios/Flutter"
flutter_ios_engine_folder="${project_path}/ios/Flutter"
fi
AssertExists "${flutter_ios_out_folder}"
# Embed App.framework from Flutter into the app (after creating the Frameworks directory
# if it doesn't already exist).
local xcode_frameworks_dir="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
RunCommand mkdir -p -- "${xcode_frameworks_dir}"
RunCommand rsync -av --delete "${flutter_ios_out_folder}/App.framework" "${xcode_frameworks_dir}"
RunCommand rsync -av --delete --filter "- .DS_Store/" "${BUILT_PRODUCTS_DIR}/App.framework" "${xcode_frameworks_dir}"
# Embed the actual Flutter.framework that the Flutter app expects to run against,
# which could be a local build or an arch/type specific build.
# Prefer the hidden .ios folder, but fallback to a visible ios folder if .ios
# doesn't exist.
local flutter_ios_engine_folder="${project_path}/.ios/Flutter/engine"
if [[ ! -d ${flutter_ios_engine_folder} ]]; then
flutter_ios_engine_folder="${project_path}/ios/Flutter"
fi
AssertExists "${flutter_ios_engine_folder}"
# Copy Xcode behavior and don't copy over headers or modules.
RunCommand rsync -av --delete --filter "- .DS_Store/" --filter "- Headers/" --filter "- Modules/" "${flutter_ios_engine_folder}/Flutter.framework" "${xcode_frameworks_dir}/"
if [[ "$ACTION" != "install" || "$ENABLE_BITCODE" == "NO" ]]; then
......
......@@ -50,7 +50,7 @@ class CleanCommand extends FlutterCommand {
deleteFile(flutterProject.ios.ephemeralDirectory);
deleteFile(flutterProject.ios.generatedXcodePropertiesFile);
deleteFile(flutterProject.ios.generatedEnvironmentVariableExportScript);
deleteFile(flutterProject.ios.compiledDartFramework);
deleteFile(flutterProject.ios.deprecatedCompiledDartFramework);
deleteFile(flutterProject.linux.ephemeralDirectory);
deleteFile(flutterProject.macos.ephemeralDirectory);
......
......@@ -539,7 +539,7 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result, Usage flutterUsa
logger.printError('Your Xcode project requires migration. See https://flutter.dev/docs/development/ios-project-migration for details.');
logger.printError('');
logger.printError('You can temporarily work around this issue by running:');
logger.printError(' rm -rf ios/Flutter/App.framework');
logger.printError(' flutter clean');
return;
}
......
......@@ -682,7 +682,10 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
.childDirectory('Flutter')
.childFile('Generated.xcconfig');
Directory get compiledDartFramework => _flutterLibRoot
/// No longer compiled to this location.
///
/// Used only for "flutter clean" to remove old references.
Directory get deprecatedCompiledDartFramework => _flutterLibRoot
.childDirectory('Flutter')
.childDirectory('App.framework');
......
......@@ -48,7 +48,7 @@ void main() {
projectUnderTest.ios.ephemeralDirectory.createSync(recursive: true);
projectUnderTest.ios.generatedXcodePropertiesFile.createSync(recursive: true);
projectUnderTest.ios.generatedEnvironmentVariableExportScript.createSync(recursive: true);
projectUnderTest.ios.compiledDartFramework.createSync(recursive: true);
projectUnderTest.ios.deprecatedCompiledDartFramework.createSync(recursive: true);
projectUnderTest.linux.ephemeralDirectory.createSync(recursive: true);
projectUnderTest.macos.ephemeralDirectory.createSync(recursive: true);
......@@ -68,7 +68,7 @@ void main() {
expect(projectUnderTest.ios.ephemeralDirectory.existsSync(), isFalse);
expect(projectUnderTest.ios.generatedXcodePropertiesFile.existsSync(), isFalse);
expect(projectUnderTest.ios.generatedEnvironmentVariableExportScript.existsSync(), isFalse);
expect(projectUnderTest.ios.compiledDartFramework.existsSync(), isFalse);
expect(projectUnderTest.ios.deprecatedCompiledDartFramework.existsSync(), isFalse);
expect(projectUnderTest.linux.ephemeralDirectory.existsSync(), isFalse);
expect(projectUnderTest.macos.ephemeralDirectory.existsSync(), isFalse);
......
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