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