Unverified Commit 932200ca authored by stuartmorgan's avatar stuartmorgan Committed by GitHub

Restructure macOS project files (#33608)

Rather than macos/Flutter containing a mixture of files that should and
shouldn't be checked in, create clear locations for:
- Files that are "owned" by Flutter, but should be checked in
  (Flutter/). This will contain files like the top-level Flutter
  xcconfigs, generated plugin registrants, etc.
- Files that are generated by Flutter on the fly, and should not be
  checked in (Flutter/ephemeral/). This will contain Flutter SDK caches,
  the generated xcconfig, etc.

Also adds Flutter-owned Debug and Release xcconfig variants, in
preparation for PodSpec tooling.
parent 0b235ebf
......@@ -41,7 +41,7 @@ fi
# Copy the framework and handle local engine builds.
framework_name="FlutterMacOS.framework"
derived_dir="${SOURCE_ROOT}/Flutter"
ephemeral_dir="${SOURCE_ROOT}/Flutter/ephemeral"
framework_path="${FLUTTER_ROOT}/bin/cache/artifacts/engine/darwin-x64"
flutter_framework="${framework_path}/${framework_name}"
......@@ -66,9 +66,9 @@ if [[ -n "$LOCAL_ENGINE" ]]; then
flutter_framework="${FLUTTER_ENGINE}/out/${LOCAL_ENGINE}/${framework_name}"
fi
RunCommand mkdir -p -- "$derived_dir"
RunCommand rm -rf -- "${derived_dir}/${framework_name}"
RunCommand cp -Rp -- "${flutter_framework}" "${derived_dir}"
RunCommand mkdir -p -- "$ephemeral_dir"
RunCommand rm -rf -- "${ephemeral_dir}/${framework_name}"
RunCommand cp -Rp -- "${flutter_framework}" "${ephemeral_dir}"
# Set the build mode
build_mode="$(echo "${FLUTTER_BUILD_MODE:-${CONFIGURATION}}" | tr "[:upper:]" "[:lower:]")"
......
......@@ -580,27 +580,38 @@ class MacOSProject {
static const String _hostAppBundleName = 'Runner';
bool existsSync() => project.directory.childDirectory('macos').existsSync();
bool existsSync() => _macOSDirectory.existsSync();
Directory get _editableDirectory => project.directory.childDirectory('macos');
Directory get _macOSDirectory => project.directory.childDirectory('macos');
Directory get _cacheDirectory => _editableDirectory.childDirectory('Flutter');
/// The directory in the project that is managed by Flutter. As much as
/// possible, files that are edited by Flutter tooling after initial project
/// creation should live here.
Directory get managedDirectory => _macOSDirectory.childDirectory('Flutter');
/// The subdirectory of [managedDirectory] that contains files that are
/// generated on the fly. All generated files that are not intended to be
/// checked in should live here.
Directory get ephemeralDirectory => managedDirectory.childDirectory('ephemeral');
/// Contains definitions for FLUTTER_ROOT, LOCAL_ENGINE, and more flags for
/// the Xcode build.
File get generatedXcodePropertiesFile => _cacheDirectory.childFile('Generated.xcconfig');
File get generatedXcodePropertiesFile => ephemeralDirectory.childFile('Flutter-Generated.xcconfig');
/// The Flutter-managed Xcode config file for [mode].
File xcodeConfigFor(String mode) => managedDirectory.childFile('Flutter-$mode.xcconfig');
/// The Xcode project file.
Directory get xcodeProject => _editableDirectory.childDirectory('$_hostAppBundleName.xcodeproj');
Directory get xcodeProject => _macOSDirectory.childDirectory('$_hostAppBundleName.xcodeproj');
/// The Xcode workspace file.
Directory get xcodeWorkspace => _editableDirectory.childDirectory('$_hostAppBundleName.xcworkspace');
Directory get xcodeWorkspace => _macOSDirectory.childDirectory('$_hostAppBundleName.xcworkspace');
/// The file where the Xcode build will write the name of the built app.
///
/// Ideally this will be replaced in the future with inspection of the Runner
/// scheme's target.
File get nameFile => _cacheDirectory.childFile('.app_filename');
File get nameFile => ephemeralDirectory.childFile('.app_filename');
}
/// The Windows sub project
......
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