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

Side by Side Diff: third_party/closure_compiler/tools/create_include_gyp.py

Issue 2826693002: Fix create_include_gyp.py to support relative paths to include_js.gypi (Closed)
Patch Set: nits Created 3 years, 8 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 # 5 #
6 # Usage: 6 # Usage:
7 # 7 #
8 # cd third_party/closure_compiler 8 # cd third_party/closure_compiler
9 # tools/create_include_gyp.py externs > externs/compiled_resources2.gyp 9 # tools/create_include_gyp.py externs > externs/compiled_resources2.gyp
10 # tools/create_include_gyp.py interfaces > interfaces/compiled_resources2.gyp 10 # tools/create_include_gyp.py interfaces > interfaces/compiled_resources2.gyp
11 11
12 from datetime import date 12 from datetime import date
13 import os 13 import os
14 import sys 14 import sys
15 15
16 16
17 _INCLUDE_GYPI = os.path.join(os.path.dirname(__file__), '..', 'include_js.gypi')
18
19
17 _INCLUDE_TEMPLATE = """ 20 _INCLUDE_TEMPLATE = """
18 # Copyright %d The Chromium Authors. All rights reserved. 21 # Copyright %d The Chromium Authors. All rights reserved.
19 # Use of this source code is governed by a BSD-style license that can be 22 # Use of this source code is governed by a BSD-style license that can be
20 # found in the LICENSE file. 23 # found in the LICENSE file.
21 24
22 ######################################################## 25 ########################################################
23 # NOTE: THIS FILE IS GENERATED. DO NOT EDIT IT! # 26 # NOTE: THIS FILE IS GENERATED. DO NOT EDIT IT! #
24 # Instead, run create_include_gyp.py to regenerate it. # 27 # Instead, run create_include_gyp.py to regenerate it. #
25 ######################################################## 28 ########################################################
26 { 29 {
27 'targets': [ 30 'targets': [
28 %s, 31 %s,
29 ], 32 ],
30 }""".lstrip() 33 }""".lstrip()
31 34
32 35
33 _TARGET_TEMPLATE = """ 36 _TARGET_TEMPLATE = """
34 { 37 {
35 'target_name': '%s', 38 'target_name': '%s',
36 'includes': ['../include_js.gypi'], 39 'includes': ['%s'],
37 }""" 40 }"""
38 41
39 42
40 def CreateIncludeGyp(directory): 43 def CreateIncludeGyp(directory):
41 include_dir = os.path.join(os.path.dirname(__file__), "..", directory) 44 include_path = os.path.normpath(os.path.relpath(_INCLUDE_GYPI, directory))
42 include_files = [f for f in os.listdir(include_dir) if f.endswith('.js')] 45 js_files = [f for f in os.listdir(directory) if f.endswith('.js')]
43 include_files.sort() 46 js_files.sort()
44 targets = [_TARGET_TEMPLATE % f[:-3] for f in include_files] 47 targets = [_TARGET_TEMPLATE % (f[:-3], include_path) for f in js_files]
45 return _INCLUDE_TEMPLATE % (date.today().year, ",".join(targets).strip()) 48 return _INCLUDE_TEMPLATE % (date.today().year, ",".join(targets).strip())
46 49
47 50
48 def ShowUsageAndDie(): 51 def ShowUsageAndDie():
49 print "usage: tools/create_include_gyp.py externs/ > externs/compiled_resource s2.gyp" 52 print "usage: tools/create_include_gyp.py externs/ > externs/compiled_resource s2.gyp"
50 sys.exit(1) 53 sys.exit(1)
51 54
52 55
53 if __name__ == "__main__": 56 if __name__ == "__main__":
54 if len(sys.argv) != 2: 57 if len(sys.argv) != 2:
55 ShowUsageAndDie() 58 ShowUsageAndDie()
56 59
57 print CreateIncludeGyp(sys.argv[1]) 60 print CreateIncludeGyp(sys.argv[1])
OLDNEW
« no previous file with comments | « third_party/closure_compiler/interfaces/compiled_resources2.gyp ('k') | ui/file_manager/externs/compiled_resources2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698