Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2015 Google Inc. | 3 # Copyright 2015 Google Inc. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 # This script will update Skia's dependencies as necessary and run | 8 # This script will update Skia's dependencies as necessary and run |
| 9 # gyp if needed. | 9 # gyp if needed. |
| 10 | 10 |
| 11 # Depends on: Python, and Git. | 11 # Depends on: Python, Git, and depot_tools. |
| 12 # | 12 # |
| 13 # Example usage: | 13 # Example usage: |
| 14 # | 14 # |
| 15 # git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
| 16 # export PATH="${PWD}/depot_tools:${PATH}" | |
| 15 # git clone https://skia.googlesource.com/skia | 17 # git clone https://skia.googlesource.com/skia |
| 16 # cd skia | 18 # cd skia |
| 17 # python bin/sync-and-gyp | 19 # python bin/sync-and-gyp |
| 18 # ninja -C out/Debug && out/Debug/dm | 20 # ninja -C out/Debug && out/Debug/dm |
| 19 # | 21 # |
| 20 # Once changes are made to DEPS or gyp/ or the source, call: | 22 # Once changes are made to DEPS or gyp/ or the source, call: |
| 21 # | 23 # |
| 22 # python bin/sync-and-gyp | 24 # python bin/sync-and-gyp |
| 23 | 25 |
| 24 import fnmatch | 26 import fnmatch |
| 25 import hashlib | 27 import hashlib |
| 26 import subprocess | 28 import subprocess |
| 27 import os | 29 import os |
| 28 | 30 |
| 29 skia_dir = os.path.join(os.path.dirname(__file__), os.pardir) | 31 skia_dir = os.path.join(os.path.dirname(__file__), os.pardir) |
| 30 | 32 |
| 31 skia_out = os.environ.get("SKIA_OUT") | 33 skia_out = os.environ.get("SKIA_OUT") |
| 32 if skia_out: | 34 if skia_out: |
| 33 skia_out = os.path.abspath(skia_out) | 35 skia_out = os.path.abspath(skia_out) |
| 34 hash_path = os.path.join(skia_out, 'gyp_hash') | 36 hash_path = os.path.join(skia_out, 'gyp_hash') |
| 35 else: | 37 else: |
| 36 hash_path = os.path.join('out', 'gyp_hash') | 38 hash_path = os.path.join('out', 'gyp_hash') |
| 37 | 39 |
| 38 os.chdir(skia_dir) | 40 os.chdir(skia_dir) |
| 39 | 41 |
| 40 if not os.path.isfile('DEPS'): | 42 if not os.path.isfile('DEPS'): |
| 41 sys.stderr.write('DEPS file missing') | 43 sys.stderr.write('DEPS file missing') |
| 42 exit(1) | 44 exit(1) |
| 43 | 45 |
| 44 env = os.environ.copy() | 46 deps_hasher = hashlib.sha1() |
| 45 env["GIT_SYNC_DEPS_QUIET"] = "1" | 47 with open('DEPS', 'r') as f: |
| 46 subprocess.call(['python', 'tools/git-sync-deps'], env=env) | 48 deps_hasher.update(f.read()) |
|
scroggo
2016/02/16 15:02:42
Should we also delete tools/git-sync-deps?
hal.canary
2016/02/16 15:43:44
Maybe. Let's do that in another CL, in case someo
| |
| 49 deps_hash = deps_hasher.hexdigest() | |
| 50 current_deps_hash = None | |
| 51 if os.path.isfile('.deps_sha1'): | |
| 52 with open('.deps_sha1', 'r') as f: | |
| 53 current_deps_hash = f.read().strip() | |
| 54 | |
| 55 gclient_config = ''' | |
|
scroggo
2016/02/16 15:02:42
Why not use the existing gclient config? Mine is s
mtklein
2016/02/16 15:32:05
Nah, target_os = ['android'] doesn't actually do a
hal.canary
2016/02/16 15:43:44
okay. I'll check to see if the file exists first.
| |
| 56 solutions = [ | |
| 57 { "name" : ".", | |
| 58 "url" : "https://skia.googlesource.com/skia.git", | |
| 59 "deps_file" : "DEPS", | |
| 60 "managed" : False, | |
| 61 "custom_deps" : { | |
| 62 }, | |
| 63 "safesync_url": "", | |
| 64 }, | |
| 65 ] | |
| 66 cache_dir = None | |
| 67 ''' | |
| 68 if current_deps_hash != deps_hash: | |
| 69 # `gclient sync` is very slow, so skip whenver we can | |
|
scroggo
2016/02/16 15:02:42
whenever*
hal.canary
2016/02/16 15:43:44
done
| |
| 70 with open('.gclient', 'w') as o: | |
| 71 o.write(gclient_config) | |
| 72 subprocess.call(['gclient', 'sync']) | |
| 73 with open('.deps_sha1', 'w') as o: | |
| 74 o.write(deps_hash) | |
| 47 | 75 |
| 48 hasher = hashlib.sha1() | 76 hasher = hashlib.sha1() |
| 49 | 77 |
| 50 for var in ['AR', 'AR_host', 'AR_target', | 78 for var in ['AR', 'AR_host', 'AR_target', |
| 51 'CC', 'CC_host', 'CC_target', | 79 'CC', 'CC_host', 'CC_target', |
| 52 'CFLAGS', 'CFLAGS_host', | 80 'CFLAGS', 'CFLAGS_host', |
| 53 'CPPFLAGS', 'CPPFLAGS_host', | 81 'CPPFLAGS', 'CPPFLAGS_host', |
| 54 'CXX', 'CXX_host', 'CXX_target', | 82 'CXX', 'CXX_host', 'CXX_target', |
| 55 'GYP_DEFINES', 'GYP_GENERATORS', | 83 'GYP_DEFINES', 'GYP_GENERATORS', |
| 56 'NM', 'NM_host', 'NM_target', | 84 'NM', 'NM_host', 'NM_target', |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 79 return f.read() | 107 return f.read() |
| 80 return '' | 108 return '' |
| 81 | 109 |
| 82 if cat_if_exists(hash_path).strip() != gyp_hash: | 110 if cat_if_exists(hash_path).strip() != gyp_hash: |
| 83 env = os.environ.copy() | 111 env = os.environ.copy() |
| 84 if skia_out: | 112 if skia_out: |
| 85 env['SKIA_OUT'] = skia_out | 113 env['SKIA_OUT'] = skia_out |
| 86 subprocess.call(['python', './gyp_skia'], env=env) | 114 subprocess.call(['python', './gyp_skia'], env=env) |
| 87 with open(hash_path, 'w') as o: | 115 with open(hash_path, 'w') as o: |
| 88 o.write(gyp_hash) | 116 o.write(gyp_hash) |
| OLD | NEW |