diff --git a/dev/devicelab/bin/tasks/ios_content_validation_test.dart b/dev/devicelab/bin/tasks/ios_content_validation_test.dart index 6c1af6c7be..e84b346ec0 100644 --- a/dev/devicelab/bin/tasks/ios_content_validation_test.dart +++ b/dev/devicelab/bin/tasks/ios_content_validation_test.dart @@ -80,6 +80,9 @@ Future main() async { 'Frameworks', 'Flutter.framework', )); + + checkDirectoryNotExists(path.join(outputFlutterFramework.path, 'Headers')); + checkDirectoryNotExists(path.join(outputFlutterFramework.path, 'Modules')); final File outputFlutterFrameworkBinary = File(path.join( outputFlutterFramework.path, 'Flutter', diff --git a/packages/flutter_tools/bin/macos_assemble.sh b/packages/flutter_tools/bin/macos_assemble.sh index dc63081847..1cfd0feafb 100755 --- a/packages/flutter_tools/bin/macos_assemble.sh +++ b/packages/flutter_tools/bin/macos_assemble.sh @@ -109,13 +109,13 @@ EmbedFrameworks() { # 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 --filter "- .DS_Store/" "${BUILT_PRODUCTS_DIR}/App.framework" "${xcode_frameworks_dir}" + RunCommand rsync -av --delete --filter "- .DS_Store" "${BUILT_PRODUCTS_DIR}/App.framework" "${xcode_frameworks_dir}" # Embed the actual FlutterMacOS.framework that the Flutter app expects to run against, # which could be a local build or an arch/type specific build. # Copy Xcode behavior and don't copy over headers or modules. - RunCommand rsync -av --delete --filter "- .DS_Store/" --filter "- Headers/" --filter "- Modules/" "${BUILT_PRODUCTS_DIR}/FlutterMacOS.framework" "${xcode_frameworks_dir}/" + RunCommand rsync -av --delete --filter "- .DS_Store" --filter "- Headers" --filter "- Modules" "${BUILT_PRODUCTS_DIR}/FlutterMacOS.framework" "${xcode_frameworks_dir}/" # Sign the binaries we moved. if [[ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" ]]; then diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index 8172ec3823..35170e0e42 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -279,13 +279,13 @@ EmbedFlutterFrameworks() { # 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 --filter "- .DS_Store/" "${BUILT_PRODUCTS_DIR}/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. # Copy Xcode behavior and don't copy over headers or modules. - RunCommand rsync -av --delete --filter "- .DS_Store/" --filter "- Headers/" --filter "- Modules/" "${BUILT_PRODUCTS_DIR}/Flutter.framework" "${xcode_frameworks_dir}/" + RunCommand rsync -av --delete --filter "- .DS_Store" --filter "- Headers" --filter "- Modules" "${BUILT_PRODUCTS_DIR}/Flutter.framework" "${xcode_frameworks_dir}/" if [[ "$ACTION" != "install" || "$ENABLE_BITCODE" == "NO" ]]; then # Strip bitcode from the destination unless archiving, or if bitcode is disabled entirely. RunCommand "${DT_TOOLCHAIN_DIR}"/usr/bin/bitcode_strip "${BUILT_PRODUCTS_DIR}/Flutter.framework/Flutter" -r -o "${xcode_frameworks_dir}/Flutter.framework/Flutter" diff --git a/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart b/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart index 420ada07e1..139edd0abd 100644 --- a/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart +++ b/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart @@ -78,19 +78,39 @@ void main() { expect(vmSnapshot.existsSync(), buildMode == 'Debug'); - final File outputFlutterFrameworkBinary = - fileSystem.file(fileSystem.path.join( - outputApp.path, - 'Contents', - 'Frameworks', - 'FlutterMacOS.framework', - 'FlutterMacOS', - )); - expect(outputFlutterFrameworkBinary, exists); + final Directory outputFlutterFramework = fileSystem.directory( + fileSystem.path.join( + outputApp.path, + 'Contents', + 'Frameworks', + 'FlutterMacOS.framework', + ), + ); + + // Check complicated macOS framework symlink structure. + final Link current = outputFlutterFramework.childDirectory('Versions').childLink('Current'); + + expect(current.targetSync(), 'A'); + + expect(outputFlutterFramework.childLink('FlutterMacOS').targetSync(), + fileSystem.path.join('Versions', 'Current', 'FlutterMacOS')); + + expect(outputFlutterFramework.childLink('Resources'), exists); + expect(outputFlutterFramework.childLink('Resources').targetSync(), + fileSystem.path.join('Versions', 'Current', 'Resources')); + + expect(outputFlutterFramework.childLink('Headers'), isNot(exists)); + expect(outputFlutterFramework.childDirectory('Headers'), isNot(exists)); + expect(outputFlutterFramework.childLink('Modules'), isNot(exists)); + expect(outputFlutterFramework.childDirectory('Modules'), isNot(exists)); // Archiving should contain a bitcode blob, but not building. // This mimics Xcode behavior and present a developer from having to install a // 300+MB app. + final File outputFlutterFrameworkBinary = outputFlutterFramework + .childDirectory('Versions') + .childDirectory('A') + .childFile('FlutterMacOS'); expect( await containsBitcode(outputFlutterFrameworkBinary.path), isFalse,