Skip to content

Commit e31cdad

Browse files
authored
Added dependency on CppWinRT for UWP builds (flutter#24770)
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: flutter#70205
1 parent a546f16 commit e31cdad

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed

DEPS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,19 @@ deps = {
558558
'condition': 'host_os == "linux"',
559559
'dep_type': 'cipd',
560560
},
561+
562+
# CppWinRT tooling for UWP builds
563+
'src/third_party/cppwinrt': {
564+
'packages': [
565+
{
566+
'package': 'flutter/cppwinrt/win-amd64',
567+
'version': 'build:2.0.210301.1'
568+
}
569+
],
570+
'condition': 'download_windows_deps',
571+
'dep_type': 'cipd',
572+
},
573+
561574
}
562575

563576
hooks = [

tools/cipd/cppwinrt/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Temp directory into which we unpack the .nupkg archive
2+
cppwinrt
3+
4+
# nupkg archives
5+
*.nupkg

tools/cipd/cppwinrt/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# CppWinRT CIPD package
2+
3+
CppWinRT is a tool that generates standard C++17 header-file libraries
4+
for Windows Runtime (WinRT) APIs. These instructions describe how to
5+
update the CIPD package that bundles these tools for Flutter builds.
6+
7+
A more detailed introduction to C++/WinRT can be found in the Microsoft
8+
[documentation](https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/).
9+
10+
The source code is available under an MIT license, from
11+
https://github.com/microsoft/cppwinrt.
12+
13+
14+
## Requirements
15+
16+
Updating this package requires the following dependencies:
17+
18+
1. [Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up).
19+
20+
21+
## Uploading a new CIPD package version
22+
23+
To update the CIPD package, follow these steps:
24+
25+
1. From the [CppWinRT package](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/)
26+
page on nuget, click the _Download pacakge_ link.
27+
2. Copy the downloaded `.nupkg` file into this directory.
28+
3. Unzip the archive to a new subdirectory named `tmp`:
29+
```
30+
unzip microsoft.windows.cppwinrt.<version_number>.nupkg -d tmp
31+
```
32+
4. `cd` into the `tmp` directory.
33+
4. Create the CIPD package:
34+
```
35+
cipd create --pkg-def ../cppwinrt-win-amd64.cipd.yaml`
36+
```
37+
The tool should output that the package was successfully uploaded and
38+
verified, including the package path and an identifier SHA.
39+
5. Set a new `build:` tag:
40+
```
41+
cipd set-tag flutter/cppwinrt/win-amd64 --version=<new_version_sha> --tag=build:<upstream_version>
42+
```
43+
6. Verify the package was successfully created and tagged:
44+
```
45+
cipd describe flutter/cppwinrt/win-amd64 <new_version_sha>
46+
```
47+
7. Delete the archive and temp directory:
48+
```
49+
rm -rf cppwinrt *.nupkg
50+
```
51+
52+
53+
## Updating the Flutter DEPS file
54+
55+
Finally, we'll update the DEPS file to point to the latest version.
56+
57+
1. Open the `DEPS` file in an editor.
58+
2. Locate the block covering `cppwinrt`.
59+
3. Update the `version` value to the version you just tagged.
60+
61+
The block should look like this:
62+
```
63+
'src/third_party/cppwinrt': {
64+
'packages': [
65+
{
66+
'package': 'flutter/cppwinrt/win-amd64',
67+
'version': 'build:<upstream_version>'
68+
}
69+
],
70+
'condition': 'download_windows_deps',
71+
'dep_type': 'cipd',
72+
},
73+
```
74+
75+
Finally, re-run `gclient sync` to verify the package downloads
76+
correctly.
77+
78+
79+
## References
80+
81+
* [CIPD for chromium dependencies](https://chromium.googlesource.com/chromium/src/+/67.0.3396.74/docs/cipd.md)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package: flutter/cppwinrt/win-amd64
2+
description: C++/WinRT tool used for building WinRT headers for Windows UWP builds
3+
install_mode: copy
4+
# The temp directory into which the nupkg archive is extracted.
5+
root: cppwinrt
6+
data:
7+
# Contents of the cppwinrt/ directory are at the root of the CIPD package.
8+
- dir: .

0 commit comments

Comments
 (0)