From 9bf86f9b6a17340fc21abe2001add617b27397e8 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sat, 30 Apr 2022 12:08:18 -0700 Subject: [PATCH] Win: Remove WinRT headers, Windows SDK, cppwinrt (flutter/engine#33030) WinRT was only ever used by the Windows UWP embedder since the main Windows embedder supports compatibility with Windows 7 and WinRT requires a Windows SDK target version of at least 10.0.17134.0 (Windows 10, version 1803). When, at some point, we drop support for versions of Windows earlier than Windows 10, we'll almost certainly want to resurrect this and start using WinRT in the main Windows embedder. The Windows UWP embedder was removed in: https://github.com/flutter/engine/pull/33019 Issue: flutter/flutter#102172 --- DEPS | 35 -------- .../flutter/shell/platform/windows/BUILD.gn | 11 --- .../flutter/tools/cipd/cppwinrt/.gitignore | 5 -- .../src/flutter/tools/cipd/cppwinrt/README.md | 80 ------------------- .../cppwinrt/cppwinrt-win-amd64.cipd.yaml | 8 -- 5 files changed, 139 deletions(-) delete mode 100644 engine/src/flutter/tools/cipd/cppwinrt/.gitignore delete mode 100644 engine/src/flutter/tools/cipd/cppwinrt/README.md delete mode 100644 engine/src/flutter/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml diff --git a/DEPS b/DEPS index 05d935f385..fba06ab946 100644 --- a/DEPS +++ b/DEPS @@ -631,30 +631,6 @@ deps = { 'condition': 'host_os == "linux" and not download_fuchsia_sdk', 'dep_type': 'cipd', }, - - # Windows SDK - 'src/third_party/windows_sdk': { - 'packages': [ - { - 'package': 'flutter/windows/windows-sdk', - 'version': 'build:10.0.19041.0' - } - ], - 'condition': 'download_windows_deps', - 'dep_type': 'cipd', - }, - # CppWinRT tooling for UWP builds - 'src/third_party/cppwinrt': { - 'packages': [ - { - 'package': 'flutter/cppwinrt/win-amd64', - 'version': 'build:2.0.210505.3' - } - ], - 'condition': 'download_windows_deps', - 'dep_type': 'cipd', - }, - } hooks = [ @@ -717,17 +693,6 @@ hooks = [ 'src/flutter/tools/pub_get_offline.py', ] }, - { - # This must run whenever the cppwinrt dependency is updated - # to regenerate winrt headers - 'name': 'Generate winrt headers', - 'pattern': '.', - 'condition': 'download_windows_deps', - 'action': [ - 'python3', - 'src/build/win/generate_winrt_headers.py', - ] - }, { 'name': 'Download prebuilt Dart SDK', 'pattern': '.', diff --git a/engine/src/flutter/shell/platform/windows/BUILD.gn b/engine/src/flutter/shell/platform/windows/BUILD.gn index 9672e7eeb7..1ac8628583 100644 --- a/engine/src/flutter/shell/platform/windows/BUILD.gn +++ b/engine/src/flutter/shell/platform/windows/BUILD.gn @@ -21,17 +21,6 @@ config("relative_flutter_windows_headers") { include_dirs = [ "public" ] } -config("cppwinrt_defs") { - # Use winrt headers generated by the cppwinrt tool rather than those shipped in the installed SDK. - # The Windows metadata used to generate the headers does come from the installed SDK, by generating them rather than using the shipped ones - # the latest cppwinrt compatibility fixes can be derived. For example, clang support is broken in the winrt headers shipped in SDK 10.0.19041.0. - # By generating them in the flutter toolchain using the SDK 10.0.19041.0 metadata and the latest version of the cppwinrt tool, that SDK version can be supported. - # - # Generated with command bin\cppwinrt.exe -in sdk -out generated - # by src\build\win\generate_winrt_headers.py - include_dirs = [ "..\..\..\..\third_party\cppwinrt\generated" ] -} - # The headers are a separate source set since the client wrapper is allowed # to depend on the public headers, but none of the rest of the code. source_set("flutter_windows_headers") { diff --git a/engine/src/flutter/tools/cipd/cppwinrt/.gitignore b/engine/src/flutter/tools/cipd/cppwinrt/.gitignore deleted file mode 100644 index 30ab8cae92..0000000000 --- a/engine/src/flutter/tools/cipd/cppwinrt/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Temp directory into which we unpack the .nupkg archive -tmp - -# nupkg archives -*.nupkg diff --git a/engine/src/flutter/tools/cipd/cppwinrt/README.md b/engine/src/flutter/tools/cipd/cppwinrt/README.md deleted file mode 100644 index 2876733e95..0000000000 --- a/engine/src/flutter/tools/cipd/cppwinrt/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# CppWinRT CIPD package - -CppWinRT is a tool that generates standard C++17 header-file libraries -for Windows Runtime (WinRT) APIs. These instructions describe how to -update the CIPD package that bundles these tools for Flutter builds. - -A more detailed introduction to C++/WinRT can be found in the Microsoft -[documentation](https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/). - -The source code is available under an MIT license, from -https://github.com/microsoft/cppwinrt. - - -## Requirements - -Updating this package requires the following dependencies: - -1. [Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up). - - -## Uploading a new CIPD package version - -To update the CIPD package, follow these steps: - -1. From the [CppWinRT package](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/) - page on nuget, click the _Download package_ link. -2. Copy the downloaded `.nupkg` file into this directory. -3. Unzip the archive to a new subdirectory named `tmp`: - ``` - unzip microsoft.windows.cppwinrt..nupkg -d tmp - ``` -4. Create the CIPD package: - ``` - cipd create --pkg-def cppwinrt-win-amd64.cipd.yaml - ``` - The tool should output that the package was successfully uploaded and - verified, including the package path and an identifier SHA. -5. Set a new `build:` tag: - ``` - cipd set-tag flutter/cppwinrt/win-amd64 --version= --tag=build: - ``` -6. Verify the package was successfully created and tagged: - ``` - cipd describe flutter/cppwinrt/win-amd64 -version - ``` -7. Delete the archive and temp directory: - ``` - rm -rf cppwinrt *.nupkg - ``` - - -## Updating the Flutter DEPS file - -Finally, we'll update the DEPS file to point to the latest version. - -1. Open the `DEPS` file in an editor. -2. Locate the block covering `cppwinrt`. -3. Update the `version` value to the version you just tagged. - -The block should look like this: -``` - 'src/third_party/cppwinrt': { - 'packages': [ - { - 'package': 'flutter/cppwinrt/win-amd64', - 'version': 'build:' - } - ], - 'condition': 'download_windows_deps', - 'dep_type': 'cipd', - }, -``` - -Finally, re-run `gclient sync` to verify the package downloads -correctly. - - -## References - -* [CIPD for chromium dependencies](https://chromium.googlesource.com/chromium/src/+/67.0.3396.74/docs/cipd.md) diff --git a/engine/src/flutter/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml b/engine/src/flutter/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml deleted file mode 100644 index 594dc7a7ad..0000000000 --- a/engine/src/flutter/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml +++ /dev/null @@ -1,8 +0,0 @@ -package: flutter/cppwinrt/win-amd64 -description: C++/WinRT tool used for building WinRT headers for Windows UWP/App SDK builds -install_mode: copy -# The temp directory into which the nupkg archive is extracted. -root: tmp -data: - # Contents of the cppwinrt/ directory are at the root of the CIPD package. - - dir: .