Unverified Commit 710a0cb9 authored by stuartmorgan's avatar stuartmorgan Committed by GitHub

Adjust macOS build flow (#32538)

- Removes SYMROOT from the Generated.xcconfig. Having it causes current
  versions of Xcode to switch the project's build output to "Legacy",
  which causes anything not overridden to use a project-relative build
  directory instead of a shared directory in DerivedData, breaking
  anything with subprojects that it depends on.
  This means that `flutter run` and builds from Xcode will use
  completely different build directories, but that each should be
  internally consistent.
- Moves the FlutterMacOS.framework to $SRCROOT/Flutter. This is
  consistent with the approach we're moving to for all desktop
  platforms, and avoids issues finding it now that SYMROOT doesn't match
  for the two different build modes.

Fixes #32494
parent 145f9f7e
......@@ -41,7 +41,7 @@ fi
# Copy the framework and handle local engine builds.
framework_name="FlutterMacOS.framework"
derived_dir="${SOURCE_ROOT}/../build/macos/Build/Products/flutter_framework"
derived_dir="${SOURCE_ROOT}/Flutter"
framework_path="${FLUTTER_ROOT}/bin/cache/artifacts/engine/darwin-x64"
flutter_framework="${framework_path}/${framework_name}"
......
......@@ -37,8 +37,7 @@ String flutterMacOSFrameworkDir(BuildMode mode) {
/// useMacOSConfig: Optional parameter that controls whether we use the macOS
/// project file instead. Defaults to false.
///
/// symrootOverride: Optional parameter to specifify the symroot instead of
/// the default relative path.
/// setSymroot: Optional parameter to control whether to set SYMROOT.
///
/// targetOverride: Optional parameter, if null or unspecified the default value
/// from xcode_backend.sh is used 'lib/main.dart'.
......@@ -47,7 +46,7 @@ Future<void> updateGeneratedXcodeProperties({
@required BuildInfo buildInfo,
String targetOverride,
bool useMacOSConfig = false,
String symrootOverride,
bool setSymroot = true,
}) async {
final StringBuffer localsBuffer = StringBuffer();
......@@ -66,13 +65,8 @@ Future<void> updateGeneratedXcodeProperties({
// The build outputs directory, relative to FLUTTER_APPLICATION_PATH.
localsBuffer.writeln('FLUTTER_BUILD_DIR=${getBuildDirectory()}');
final String buildDirectory = useMacOSConfig
? getMacOSBuildDirectory()
: getIosBuildDirectory();
if (symrootOverride != null) {
localsBuffer.writeln('SYMROOT=$symrootOverride');
} else {
localsBuffer.writeln('SYMROOT=\${SOURCE_ROOT}/../$buildDirectory');
if (setSymroot) {
localsBuffer.writeln('SYMROOT=\${SOURCE_ROOT}/../${getIosBuildDirectory()}');
}
if (!project.isModule) {
......
......@@ -18,7 +18,6 @@ import '../project.dart';
// TODO(jonahwilliams): refactor to share code with the existing iOS code.
Future<void> buildMacOS(FlutterProject flutterProject, BuildInfo buildInfo) async {
final Directory flutterBuildDir = fs.directory(getMacOSBuildDirectory());
final String symrootOverride = fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products');
if (!flutterBuildDir.existsSync()) {
flutterBuildDir.createSync(recursive: true);
}
......@@ -27,7 +26,7 @@ Future<void> buildMacOS(FlutterProject flutterProject, BuildInfo buildInfo) asyn
project: flutterProject,
buildInfo: buildInfo,
useMacOSConfig: true,
symrootOverride: symrootOverride,
setSymroot: false,
);
// Set debug or release mode.
String config = 'Debug';
......@@ -44,7 +43,7 @@ Future<void> buildMacOS(FlutterProject flutterProject, BuildInfo buildInfo) asyn
'-scheme', 'Runner',
'-derivedDataPath', flutterBuildDir.absolute.path,
'OBJROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
'SYMROOT=$symrootOverride',
'SYMROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
], runInShell: true);
final Status status = logger.startProgress(
'Building macOS application...',
......
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