Roll src/third_party/WebKit 06cb9e9:a978ee5 (svn 202558:202559)
[chromium-blink-merge.git] / third_party / closure_compiler / tools / create_externs_gyp.py
blob144a26c137c221eb7d4c959d508401d21a1bc537
1 #!/usr/bin/env python
2 # Copyright %d The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # Usage:
8 # cd third_party/closure_compiler
9 # tools/create_externs_gyp.py > externs/compiled_resources.gyp
11 from datetime import date
12 import os
15 _EXTERNS_TEMPLATE = """
16 # Copyright %d The Chromium Authors. All rights reserved.
17 # Use of this source code is governed by a BSD-style license that can be
18 # found in the LICENSE file.
20 ########################################################
21 # NOTE: THIS FILE IS GENERATED. DO NOT EDIT IT! #
22 # Instead, run create_externs_gyp.py to regenerate it. #
23 ########################################################
25 'targets': [
26 %s,
28 }""".lstrip()
31 _TARGET_TEMPLATE = """
33 'target_name': '%s',
34 'includes': ['../externs_js.gypi'],
35 }"""
38 def CreateExternsGyp():
39 externs_dir = os.path.join(os.path.dirname(__file__), "..", "externs")
40 externs_files = [f for f in os.listdir(externs_dir) if f.endswith('.js')]
41 externs_files.sort()
42 targets = [_TARGET_TEMPLATE % f[:-3] for f in externs_files]
43 return _EXTERNS_TEMPLATE % (date.today().year, ",".join(targets).strip())
46 if __name__ == "__main__":
47 print CreateExternsGyp()