Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
create.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright 2023 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""
10Create the DWriteCore asset. DWriteCore is now part of the WindowsAppSDK
11which is distrubuted as a nuget package. To update, go to
12https://www.nuget.org/packages/Microsoft.WindowsAppSDK and pick a version.
13The URL below should match that of the "Download package" link.
14
15The asset this creates contains just the DWriteCore headers and dll. In
16particular the lib is not bundled as Skia does not link directly against
17DWriteCore.
18"""
19
20
21import argparse
22import subprocess
23
24
25VERSION = "1.4.230822000"
26SHORT_VERSION = "1.4"
27SHA256 = "7f20ada4989afb3efd885f3c26ad2b63c1b01f4b1d7bb183f5f1a7f859c566df"
28URL = "https://www.nuget.org/api/v2/package/Microsoft.WindowsAppSDK/%s"
29
30
31def create_asset(target_dir):
32 """Create the asset."""
33 subprocess.check_call(["mkdir", "%s/tmp" % target_dir])
34
35 subprocess.check_call(["curl", "-L", URL % VERSION, "-o", "%s/tmp/windowsappsdk.zip" % target_dir])
36 output = subprocess.check_output(["sha256sum", "%s/tmp/windowsappsdk.zip" % target_dir], encoding="utf-8")
37 actual_hash = output.split(" ")[0]
38 if actual_hash != SHA256:
39 raise Exception("SHA256 does not match (%s != %s)" % (actual_hash, SHA256))
40
41 subprocess.check_call(["unzip", "%s/tmp/windowsappsdk.zip" % target_dir, "-d", "%s/tmp/sdk" % target_dir])
42 subprocess.check_call(["unzip", "%s/tmp/sdk/tools/MSIX/win10-x64/Microsoft.WindowsAppRuntime.%s.msix" % (target_dir, SHORT_VERSION), "-d", "%s/tmp/runtime" % target_dir])
43
44 subprocess.check_call(["mkdir", "%s/include" % target_dir])
45 subprocess.check_call(["mkdir", "%s/bin" % target_dir])
46 subprocess.check_call(["cp", "%s/tmp/sdk/include/dwrite.h" % target_dir, "%s/include" % target_dir])
47 subprocess.check_call(["cp", "%s/tmp/sdk/include/dwrite_1.h" % target_dir, "%s/include" % target_dir])
48 subprocess.check_call(["cp", "%s/tmp/sdk/include/dwrite_2.h" % target_dir, "%s/include" % target_dir])
49 subprocess.check_call(["cp", "%s/tmp/sdk/include/dwrite_3.h" % target_dir, "%s/include" % target_dir])
50 subprocess.check_call(["cp", "%s/tmp/sdk/include/dwrite_core.h" % target_dir, "%s/include" % target_dir])
51 subprocess.check_call(["cp", "%s/tmp/runtime/DWriteCore.dll" % target_dir, "%s/bin" % target_dir])
52
53 subprocess.check_call(["rm", "-rf", "%s/tmp" % target_dir])
54
55
56def main():
57 parser = argparse.ArgumentParser()
58 parser.add_argument('--target_dir', '-t', required=True)
59 args = parser.parse_args()
60 create_asset(args.target_dir)
61
62
63if __name__ == '__main__':
64 main()
create_asset(target_dir)
Definition create.py:32
main()
Definition create.py:69
Definition main.py:1