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 optparse | 6 import optparse |
7 import os | 7 import os |
8 import re | 8 import re |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 filters['EXPERIMENTAL'] = False | 97 filters['EXPERIMENTAL'] = False |
98 filters['TOOLS'] = toolchains | 98 filters['TOOLS'] = toolchains |
99 filters['DEST'] = ['examples/api', 'examples/getting_started', | 99 filters['DEST'] = ['examples/api', 'examples/getting_started', |
100 'examples/demo', 'examples/tutorial'] | 100 'examples/demo', 'examples/tutorial'] |
101 tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, filters=filters) | 101 tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, filters=filters) |
102 build_projects.UpdateHelpers(app_dir, platform, clobber=True) | 102 build_projects.UpdateHelpers(app_dir, platform, clobber=True) |
103 build_projects.UpdateProjects(app_dir, platform, tree, clobber=False, | 103 build_projects.UpdateProjects(app_dir, platform, tree, clobber=False, |
104 toolchains=toolchains, configs=[config], | 104 toolchains=toolchains, configs=[config], |
105 first_toolchain=True) | 105 first_toolchain=True) |
106 | 106 |
| 107 # Collect permissions from each example, and aggregate them. |
| 108 all_permissions = [] |
| 109 for _, project in parse_dsc.GenerateProjects(tree): |
| 110 all_permissions.extend(project.get('PERMISSIONS', [])) |
| 111 |
107 template_dict = { | 112 template_dict = { |
108 'name': 'Native Client SDK', | 113 'name': 'Native Client SDK', |
109 'description': | 114 'description': |
110 'Native Client SDK examples, showing API use and key concepts.', | 115 'Native Client SDK examples, showing API use and key concepts.', |
111 # TODO(binji): generate list of permissions from examples' DSC files. | 116 'key': False, # manifests with "key" are rejected when uploading to CWS. |
112 'permissions': [ | 117 'permissions': all_permissions, |
113 'fullscreen', | |
114 'pointerLock', | |
115 'unlimitedStorage', | |
116 ], | |
117 'version': build_utils.ChromeVersionNoTrunk() | 118 'version': build_utils.ChromeVersionNoTrunk() |
118 } | 119 } |
119 easy_template.RunTemplateFile( | 120 easy_template.RunTemplateFile( |
120 os.path.join(sdk_resources_dir, 'manifest.json.template'), | 121 os.path.join(sdk_resources_dir, 'manifest.json.template'), |
121 os.path.join(app_examples_dir, 'manifest.json'), | 122 os.path.join(app_examples_dir, 'manifest.json'), |
122 template_dict) | 123 template_dict) |
123 for filename in ['background.js', 'icon128.png']: | 124 for filename in ['background.js', 'icon128.png']: |
124 buildbot_common.CopyFile(os.path.join(sdk_resources_dir, filename), | 125 buildbot_common.CopyFile(os.path.join(sdk_resources_dir, filename), |
125 os.path.join(app_examples_dir, filename)) | 126 os.path.join(app_examples_dir, filename)) |
126 | 127 |
127 os.environ['NACL_SDK_ROOT'] = pepperdir | 128 os.environ['NACL_SDK_ROOT'] = pepperdir |
128 | 129 |
129 build_projects.BuildProjects(app_dir, platform, tree, deps=True, clean=False, | 130 build_projects.BuildProjects(app_dir, platform, tree, deps=True, clean=False, |
130 config=config) | 131 config=config) |
131 | 132 |
132 RemoveBuildCruft(app_dir) | 133 RemoveBuildCruft(app_dir) |
133 StripNexes(app_dir, platform, pepperdir) | 134 StripNexes(app_dir, platform, pepperdir) |
134 | 135 |
135 app_zip = os.path.join(app_dir, 'examples.zip') | 136 app_zip = os.path.join(app_dir, 'examples.zip') |
136 os.chdir(app_examples_dir) | 137 os.chdir(app_examples_dir) |
137 oshelpers.Zip([app_zip, '-r', '*']) | 138 oshelpers.Zip([app_zip, '-r', '*']) |
138 | 139 |
139 return 0 | 140 return 0 |
140 | 141 |
141 | 142 |
142 if __name__ == '__main__': | 143 if __name__ == '__main__': |
143 sys.exit(main(sys.argv)) | 144 sys.exit(main(sys.argv)) |
OLD | NEW |