Commit 4daf08d0 authored by Takuto Ikuta's avatar Takuto Ikuta Committed by Commit Bot

Use AtomicOutput for aidl.py

AtomicOutput does not update file timestamp, and it prevents to invoke additional build steps when the file content is not changed.

Bug: 810298
Change-Id: I25fd08b2fb4eed98d25bdaf04437e85236391667
Reviewed-on: https://chromium-review.googlesource.com/1124136Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572192}
parent cca55c33
......@@ -44,13 +44,15 @@ def main(argv):
]
build_utils.CheckOutput(aidl_cmd)
with zipfile.ZipFile(options.srcjar, 'w') as srcjar:
for path in build_utils.FindInDirectory(temp_dir, '*.java'):
with open(path) as fileobj:
data = fileobj.read()
pkg_name = re.search(r'^\s*package\s+(.*?)\s*;', data, re.M).group(1)
arcname = '%s/%s' % (pkg_name.replace('.', '/'), os.path.basename(path))
build_utils.AddToZipHermetic(srcjar, arcname, data=data)
with build_utils.AtomicOutput(options.srcjar) as f:
with zipfile.ZipFile(f, 'w') as srcjar:
for path in build_utils.FindInDirectory(temp_dir, '*.java'):
with open(path) as fileobj:
data = fileobj.read()
pkg_name = re.search(r'^\s*package\s+(.*?)\s*;', data, re.M).group(1)
arcname = '%s/%s' % (
pkg_name.replace('.', '/'), os.path.basename(path))
build_utils.AddToZipHermetic(srcjar, arcname, data=data)
if options.depfile:
build_utils.WriteDepfile(options.depfile, options.srcjar)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment