From f443e4f48f0013a9c6a54765d59f026bda60b279 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 3 Mar 2021 16:01:00 -0800 Subject: [PATCH] Added dependency on CppWinRT for UWP builds CppWinRT is a tool that generates standard C++17 header-file libraries for Windows Runtime (WinRT) APIs. A more detailed introduction to C++/WinRT can be found in the Microsoft documentation at 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. Bug: https://github.com/flutter/flutter/issues/70205 --- DEPS | 13 +++ tools/cipd/cppwinrt/.gitignore | 5 ++ tools/cipd/cppwinrt/README.md | 81 +++++++++++++++++++ .../cppwinrt/cppwinrt-win-amd64.cipd.yaml | 8 ++ 4 files changed, 107 insertions(+) create mode 100644 tools/cipd/cppwinrt/.gitignore create mode 100644 tools/cipd/cppwinrt/README.md create mode 100644 tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml diff --git a/DEPS b/DEPS index 58a2cb7ba5cbc..9ebb8b019ca46 100644 --- a/DEPS +++ b/DEPS @@ -558,6 +558,19 @@ deps = { 'condition': 'host_os == "linux"', 'dep_type': 'cipd', }, + + # CppWinRT tooling for UWP builds + 'src/third_party/cppwinrt': { + 'packages': [ + { + 'package': 'flutter/cppwinrt/win-amd64', + 'version': 'build:2.0.210301.1' + } + ], + 'condition': 'download_windows_deps', + 'dep_type': 'cipd', + }, + } hooks = [ diff --git a/tools/cipd/cppwinrt/.gitignore b/tools/cipd/cppwinrt/.gitignore new file mode 100644 index 0000000000000..f31dffb4bcdd7 --- /dev/null +++ b/tools/cipd/cppwinrt/.gitignore @@ -0,0 +1,5 @@ +# Temp directory into which we unpack the .nupkg archive +cppwinrt + +# nupkg archives +*.nupkg diff --git a/tools/cipd/cppwinrt/README.md b/tools/cipd/cppwinrt/README.md new file mode 100644 index 0000000000000..7b4ce214fb139 --- /dev/null +++ b/tools/cipd/cppwinrt/README.md @@ -0,0 +1,81 @@ +# 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 pacakge_ 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. `cd` into the `tmp` directory. +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 + ``` +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/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml b/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml new file mode 100644 index 0000000000000..5957a040ac426 --- /dev/null +++ b/tools/cipd/cppwinrt/cppwinrt-win-amd64.cipd.yaml @@ -0,0 +1,8 @@ +package: flutter/cppwinrt/win-amd64 +description: C++/WinRT tool used for building WinRT headers for Windows UWP builds +install_mode: copy +# The temp directory into which the nupkg archive is extracted. +root: cppwinrt +data: + # Contents of the cppwinrt/ directory are at the root of the CIPD package. + - dir: .