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

Side by Side Diff: platform_tools/android/gyp_gen/android_framework_gyp.py

Issue 295103008: If our gyp does not exist, use chromium's. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 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 """ 8 """
9 Modified version of gyp_skia, used by gyp_to_android.py to generate Android.mk 9 Modified version of gyp_skia, used by gyp_to_android.py to generate Android.mk
10 """ 10 """
11 11
12 import os 12 import os
13 import sys 13 import sys
14 14
15 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) 15 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
16 16
17 # Unlike gyp_skia, this file is nested deep inside Skia. Find Skia's trunk dir. 17 # Unlike gyp_skia, this file is nested deep inside Skia. Find Skia's trunk dir.
18 # This line depends on the fact that the script is three levels deep 18 # This line depends on the fact that the script is three levels deep
19 # (specifically, it is in platform_tools/android/gyp_gen). 19 # (specifically, it is in platform_tools/android/gyp_gen).
20 SKIA_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir, 20 SKIA_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
21 os.pardir)) 21 os.pardir))
22 DIR_CONTENTS = os.listdir(SKIA_DIR) 22 DIR_CONTENTS = os.listdir(SKIA_DIR)
23 assert 'gyp' in DIR_CONTENTS 23 assert 'gyp' in DIR_CONTENTS
24 24
25 # Directory within which we can find the gyp source. 25 # Directory within which we can find the gyp source.
26 if 'third_party' in DIR_CONTENTS: 26 gyp_source_dir = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp')
27 GYP_SOURCE_DIR = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp') 27 if not os.path.exists(gyp_source_dir):
28 else:
29 # In an Android tree, there is no third_party/externals/gyp, which would 28 # In an Android tree, there is no third_party/externals/gyp, which would
30 # require running gclient sync. Use chromium's instead. 29 # require running gclient sync. Use chromium's instead.
31 GYP_SOURCE_DIR = os.path.join(SKIA_DIR, os.pardir, 'chromium_org', 'tools', 30 gyp_source_dir = os.path.join(SKIA_DIR, os.pardir, 'chromium_org', 'tools',
32 'gyp') 31 'gyp')
33 32
34 assert os.path.exists(GYP_SOURCE_DIR) 33 assert os.path.exists(gyp_source_dir)
35 34
36 # Ensure we import our current gyp source's module, not any version 35 # Ensure we import our current gyp source's module, not any version
37 # pre-installed in your PYTHONPATH. 36 # pre-installed in your PYTHONPATH.
38 sys.path.insert(0, os.path.join(GYP_SOURCE_DIR, 'pylib')) 37 sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib'))
39 38
40 import gyp 39 import gyp
41 40
42 def main(target_dir, target_file, skia_arch_type, have_neon): 41 def main(target_dir, target_file, skia_arch_type, have_neon):
43 """Create gypd files based on target_file. 42 """Create gypd files based on target_file.
44 43
45 Args: 44 Args:
46 target_dir: Directory containing all gyp files, including common.gypi 45 target_dir: Directory containing all gyp files, including common.gypi
47 target_file: Gyp file to start on. Other files within target_dir will 46 target_file: Gyp file to start on. Other files within target_dir will
48 be read if target_file depends on them. 47 be read if target_file depends on them.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 """Remove the gypd files generated by main(). 93 """Remove the gypd files generated by main().
95 94
96 Args: 95 Args:
97 folder: Folder in which to delete all files ending with 'gypd'. 96 folder: Folder in which to delete all files ending with 'gypd'.
98 """ 97 """
99 assert os.path.isdir(folder) 98 assert os.path.isdir(folder)
100 files = os.listdir(folder) 99 files = os.listdir(folder)
101 for f in files: 100 for f in files:
102 if f.endswith('gypd'): 101 if f.endswith('gypd'):
103 os.remove(os.path.join(folder, f)) 102 os.remove(os.path.join(folder, f))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698