Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: build/config/mac/prepare_framework_version.py

Issue 2453043002: [Mac/GN] Fix rebuilds when changing framework_version of a mac_framework_bundle. (Closed)
Patch Set: Re-land Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « .gn ('k') | build/config/mac/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import os
6 import shutil
7 import sys
8
9 # Ensures that the current version matches the last-produced version, which is
10 # stored in the version_file. If it does not, then the framework_root_dir is
11 # obliterated.
12 # Usage: python prepare_framework_version.py out/obj/version_file \
13 # out/Framework.framework \
14 # 'A'
15
16 def PrepareFrameworkVersion(version_file, framework_root_dir, version):
17 # Test what the current framework version is. Stop if it is up-to-date.
18 try:
19 with open(version_file, 'r') as f:
20 current_version = f.read()
21 if current_version == version:
22 return
23 except IOError:
24 pass
25
26 # The framework version has changed, so clobber the framework.
27 if os.path.exists(framework_root_dir):
28 shutil.rmtree(framework_root_dir)
29
30 # Write out the new framework version file, making sure its containing
31 # directory exists.
32 dirname = os.path.dirname(version_file)
33 if not os.path.isdir(dirname):
34 os.makedirs(dirname, 0700)
35
36 with open(version_file, 'w+') as f:
37 f.write(version)
38
39
40 if __name__ == '__main__':
41 PrepareFrameworkVersion(sys.argv[1], sys.argv[2], sys.argv[3])
42 sys.exit(0)
OLDNEW
« no previous file with comments | « .gn ('k') | build/config/mac/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698