| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 import multiprocessing | 6 import multiprocessing |
| 7 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 import buildbot_common | 11 import buildbot_common |
| 12 import build_version | 12 import build_version |
| 13 import generate_make | 13 import generate_make |
| 14 import parse_dsc | 14 import parse_dsc |
| 15 | 15 |
| 16 from build_paths import NACL_DIR, SDK_SRC_DIR, OUT_DIR, SDK_EXAMPLE_DIR | 16 from build_paths import NACL_DIR, SDK_SRC_DIR, OUT_DIR, SDK_RESOURCE_DIR |
| 17 from build_paths import GSTORE | 17 from build_paths import GSTORE |
| 18 from generate_index import LandingPage | 18 from generate_index import LandingPage |
| 19 | 19 |
| 20 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) | 20 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) |
| 21 sys.path.append(os.path.join(NACL_DIR, 'build')) | 21 sys.path.append(os.path.join(NACL_DIR, 'build')) |
| 22 import getos | 22 import getos |
| 23 import http_download | 23 import http_download |
| 24 | 24 |
| 25 | 25 |
| 26 MAKE = 'nacl_sdk/make_3.99.90-26-gf80222c/make.exe' | 26 MAKE = 'nacl_sdk/make_3.99.90-26-gf80222c/make.exe' |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 def UpdateHelpers(pepperdir, clobber=False): | 47 def UpdateHelpers(pepperdir, clobber=False): |
| 48 tools_dir = os.path.join(pepperdir, 'tools') | 48 tools_dir = os.path.join(pepperdir, 'tools') |
| 49 if not os.path.exists(tools_dir): | 49 if not os.path.exists(tools_dir): |
| 50 buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) | 50 buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) |
| 51 | 51 |
| 52 exampledir = os.path.join(pepperdir, 'examples') | 52 exampledir = os.path.join(pepperdir, 'examples') |
| 53 if clobber: | 53 if clobber: |
| 54 buildbot_common.RemoveDir(exampledir) | 54 buildbot_common.RemoveDir(exampledir) |
| 55 buildbot_common.MakeDir(exampledir) | 55 buildbot_common.MakeDir(exampledir) |
| 56 | 56 |
| 57 # Copy files for individual bild and landing page | 57 # Copy files for individual build and landing page |
| 58 files = ['favicon.ico', 'httpd.cmd'] | 58 files = ['favicon.ico', 'httpd.cmd', 'index.css', 'index.js', |
| 59 CopyFilesFromTo(files, SDK_EXAMPLE_DIR, exampledir) | 59 'button_close.png', 'button_close_hover.png'] |
| 60 | 60 CopyFilesFromTo(files, SDK_RESOURCE_DIR, exampledir) |
| 61 resourcesdir = os.path.join(SDK_EXAMPLE_DIR, 'resources') | |
| 62 files = ['index.css', 'index.js', 'button_close.png', | |
| 63 'button_close_hover.png'] | |
| 64 CopyFilesFromTo(files, resourcesdir, exampledir) | |
| 65 | 61 |
| 66 # Copy tools scripts and make includes | 62 # Copy tools scripts and make includes |
| 67 buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), | 63 buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), |
| 68 tools_dir) | 64 tools_dir) |
| 69 buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), | 65 buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), |
| 70 tools_dir) | 66 tools_dir) |
| 71 | 67 |
| 72 # On Windows add a prebuilt make | 68 # On Windows add a prebuilt make |
| 73 if getos.GetPlatform() == 'win': | 69 if getos.GetPlatform() == 'win': |
| 74 buildbot_common.BuildStep('Add MAKE') | 70 buildbot_common.BuildStep('Add MAKE') |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 generate_make.ProcessProject(pepperdir, srcroot, pepperdir, desc, | 122 generate_make.ProcessProject(pepperdir, srcroot, pepperdir, desc, |
| 127 toolchains, configs=configs, | 123 toolchains, configs=configs, |
| 128 first_toolchain=first_toolchain) | 124 first_toolchain=first_toolchain) |
| 129 | 125 |
| 130 if branch.startswith('examples'): | 126 if branch.startswith('examples'): |
| 131 landing_page.AddDesc(desc) | 127 landing_page.AddDesc(desc) |
| 132 | 128 |
| 133 if landing_page: | 129 if landing_page: |
| 134 # Generate the landing page text file. | 130 # Generate the landing page text file. |
| 135 index_html = os.path.join(pepperdir, 'examples', 'index.html') | 131 index_html = os.path.join(pepperdir, 'examples', 'index.html') |
| 136 example_resources_dir = os.path.join(SDK_EXAMPLE_DIR, 'resources') | 132 index_template = os.path.join(SDK_RESOURCE_DIR, 'index.html.template') |
| 137 index_template = os.path.join(example_resources_dir, | |
| 138 'index.html.template') | |
| 139 with open(index_html, 'w') as fh: | 133 with open(index_html, 'w') as fh: |
| 140 out = landing_page.GeneratePage(index_template) | 134 out = landing_page.GeneratePage(index_template) |
| 141 fh.write(out) | 135 fh.write(out) |
| 142 | 136 |
| 143 # Generate top Make for examples | 137 # Generate top Make for examples |
| 144 targets = ['api', 'demo', 'getting_started', 'tutorial'] | 138 targets = ['api', 'demo', 'getting_started', 'tutorial'] |
| 145 targets = [x for x in targets if 'examples/'+x in project_tree] | 139 targets = [x for x in targets if 'examples/'+x in project_tree] |
| 146 branch_name = 'examples' | 140 branch_name = 'examples' |
| 147 generate_make.GenerateMasterMakefile(pepperdir, | 141 generate_make.GenerateMasterMakefile(pepperdir, |
| 148 os.path.join(pepperdir, branch_name), | 142 os.path.join(pepperdir, branch_name), |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 283 |
| 290 | 284 |
| 291 if __name__ == '__main__': | 285 if __name__ == '__main__': |
| 292 script_name = os.path.basename(sys.argv[0]) | 286 script_name = os.path.basename(sys.argv[0]) |
| 293 try: | 287 try: |
| 294 sys.exit(main(sys.argv)) | 288 sys.exit(main(sys.argv)) |
| 295 except parse_dsc.ValidationError as e: | 289 except parse_dsc.ValidationError as e: |
| 296 buildbot_common.ErrorExit('%s: %s' % (script_name, e)) | 290 buildbot_common.ErrorExit('%s: %s' % (script_name, e)) |
| 297 except KeyboardInterrupt: | 291 except KeyboardInterrupt: |
| 298 buildbot_common.ErrorExit('%s: interrupted' % script_name) | 292 buildbot_common.ErrorExit('%s: interrupted' % script_name) |
| OLD | NEW |