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

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

Issue 177073022: Use chromium's gyp if third_party is not available. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update a comment. Created 6 years, 9 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/bin). 19 # (specifically, it is in platform_tools/android/bin).
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 'third_party' in dir_contents and '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 GYP_SOURCE_DIR = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp') 26 if 'third_party' in DIR_CONTENTS:
27 GYP_SOURCE_DIR = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp')
28 else:
29 # In an Android tree, there is no third_party/externals/gyp, which would
30 # require running gclient sync. Use chromium's instead.
31 GYP_SOURCE_DIR = os.path.join(SKIA_DIR, os.pardir, 'chromium_org', 'tools',
32 'gyp')
33
34 assert os.path.exists(GYP_SOURCE_DIR)
27 35
28 # Ensure we import our current gyp source's module, not any version 36 # Ensure we import our current gyp source's module, not any version
29 # pre-installed in your PYTHONPATH. 37 # pre-installed in your PYTHONPATH.
30 sys.path.insert(0, os.path.join(GYP_SOURCE_DIR, 'pylib')) 38 sys.path.insert(0, os.path.join(GYP_SOURCE_DIR, 'pylib'))
31 39
32 import gyp 40 import gyp
33 41
34 def main(target_dir, target_file, skia_arch_type, have_neon): 42 def main(target_dir, target_file, skia_arch_type, have_neon):
35 """ 43 """
36 Create gypd files based on target_file. 44 Create gypd files based on target_file.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if ret != 0: 78 if ret != 0:
71 raise Exception("gyp failed!") 79 raise Exception("gyp failed!")
72 80
73 # Running gyp should have created a gypd file, with the same name as 81 # Running gyp should have created a gypd file, with the same name as
74 # full_path but with a 'd' on the end. 82 # full_path but with a 'd' on the end.
75 gypd_file = full_path + 'd' 83 gypd_file = full_path + 'd'
76 if not os.path.exists(gypd_file): 84 if not os.path.exists(gypd_file):
77 raise Exception("gyp failed to produce gypd file!") 85 raise Exception("gyp failed to produce gypd file!")
78 86
79 return gypd_file 87 return gypd_file
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