0

Add hook to generate dawn version file using lastchange.py.

- Generating the version file is important since it ensures that even when a checkout/tarball of the chromium files do not have the git related directories, Dawn is able to build with a unique version.
- Updated lastchange.py script to add a simple hash file output option since Dawn expects a one-liner hash.
- Pass the generated file path to Dawn via BUILD overrides so that it can be used.

Bug: dawn:549
Change-Id: Ib7aa6a7dd533d0b3652e619a2992db517850e08e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3711140
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1017038}
This commit is contained in:
Loko Kung
2022-06-23 06:02:42 +00:00
committed by Chromium LUCI CQ
parent 8ee13a5bf1
commit a6cc0fdd17
4 changed files with 32 additions and 7 deletions
DEPS
build/util
build_overrides
gpu/webgpu

8
DEPS

@ -3893,6 +3893,14 @@ hooks = [
'-s', 'src/third_party/skia',
'--header', 'src/skia/ext/skia_commit_hash.h'],
},
{
# Update dawn_version.h.
'name': 'lastchange_dawn',
'pattern': '.',
'action': ['python3', 'src/build/util/lastchange.py',
'-s', 'src/third_party/dawn',
'--revision', 'src/gpu/webgpu/DAWN_VERSION'],
},
# Pull dsymutil binaries using checked-in hashes.
{
'name': 'dsymutil_mac_arm64',

@ -221,12 +221,22 @@ def main(argv=None):
parser.add_argument("-m", "--version-macro",
help=("Name of C #define when using --header. Defaults to "
"LAST_CHANGE."))
parser.add_argument("-o", "--output", metavar="FILE",
help=("Write last change to FILE. "
"Can be combined with --header to write both files."))
parser.add_argument("--header", metavar="FILE",
help=("Write last change to FILE as a C/C++ header. "
"Can be combined with --output to write both files."))
parser.add_argument("-o",
"--output",
metavar="FILE",
help=("Write last change to FILE. "
"Can be combined with other file-output-related "
"options to write multiple files."))
parser.add_argument("--header",
metavar="FILE",
help=("Write last change to FILE as a C/C++ header. "
"Can be combined with other file-output-related "
"options to write multiple files."))
parser.add_argument("--revision",
metavar="FILE",
help=("Write last change to FILE as a one-line revision. "
"Can be combined with other file-output-related "
"options to write multiple files."))
parser.add_argument("--merge-base-ref",
default=None,
help=("Only consider changes since the merge "
@ -255,6 +265,7 @@ def main(argv=None):
out_file = args.output
header = args.header
revision = args.revision
commit_filter=args.filter
while len(extras) and out_file is None:
@ -311,7 +322,7 @@ def main(argv=None):
"LASTCHANGE_YEAR=%s" % lastchange_year,
]
contents = '\n'.join(contents_lines) + '\n'
if not out_file and not args.header:
if not out_file and not header and not revision:
sys.stdout.write(contents)
else:
if out_file:
@ -324,6 +335,8 @@ def main(argv=None):
WriteIfChanged(header,
GetHeaderContents(header, args.version_macro,
revision_string))
if revision:
WriteIfChanged(revision, revision_string)
return 0

@ -13,3 +13,5 @@ dawn_swiftshader_dir = "//third_party/swiftshader"
dawn_vulkan_loader_dir = "//third_party/vulkan-deps/vulkan-loader/src"
dawn_vulkan_validation_layers_dir =
"//third_party/vulkan-deps/vulkan-validation-layers/src"
dawn_version_file = "//gpu/webgpu/DAWN_VERSION"

2
gpu/webgpu/.gitignore vendored Normal file

@ -0,0 +1,2 @@
### Dawn version file (generated as part of DEPS hook)
DAWN_VERSION