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

Side by Side Diff: remoting/webapp/build-webapp.py

Issue 1251273002: Remove legacy CRD application types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Creates a directory with with the unpacked contents of the remoting webapp. 6 """Creates a directory with with the unpacked contents of the remoting webapp.
7 7
8 The directory will contain a copy-of or a link-to to all remoting webapp 8 The directory will contain a copy-of or a link-to to all remoting webapp
9 resources. This includes HTML/JS and any plugin binaries. The script also 9 resources. This includes HTML/JS and any plugin binaries. The script also
10 massages resulting files appropriately with host plugin data. Finally, 10 massages resulting files appropriately with host plugin data. Finally,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 sys.path.append(os.path.split(jinja2_path)[0]) 100 sys.path.append(os.path.split(jinja2_path)[0])
101 import jinja2 101 import jinja2
102 (template_path, template_name) = os.path.split(input_file) 102 (template_path, template_name) = os.path.split(input_file)
103 include_paths = [template_path] + include_paths 103 include_paths = [template_path] + include_paths
104 env = jinja2.Environment(loader=jinja2.FileSystemLoader(include_paths)) 104 env = jinja2.Environment(loader=jinja2.FileSystemLoader(include_paths))
105 template = env.get_template(template_name) 105 template = env.get_template(template_name)
106 rendered = template.render(context) 106 rendered = template.render(context)
107 io.open(output_file, 'w', encoding='utf-8').write(rendered) 107 io.open(output_file, 'w', encoding='utf-8').write(rendered)
108 108
109 109
110 def getClientPluginType(webapp_type):
111 if webapp_type in ['v1', 'v2']:
112 return 'native'
113 elif webapp_type in ['v2_pnacl', 'shared_module']:
114 return 'pnacl'
115 elif webapp_type is 'app_remoting':
116 return ''
117
118
119 def buildWebApp(buildtype, version, destination, zip_path, 110 def buildWebApp(buildtype, version, destination, zip_path,
120 manifest_template, webapp_type, appid, app_client_id, app_name, 111 manifest_template, webapp_type, appid, app_client_id, app_name,
121 app_description, app_capabilities, manifest_key, files, 112 app_description, app_capabilities, manifest_key, files,
122 files_listfile, locales_listfile, jinja_paths, 113 files_listfile, locales_listfile, jinja_paths,
123 service_environment, use_gcd): 114 service_environment, use_gcd):
124 """Does the main work of building the webapp directory and zipfile. 115 """Does the main work of building the webapp directory and zipfile.
125 116
126 Args: 117 Args:
127 buildtype: the type of build ("Official", "Release" or "Dev"). 118 buildtype: the type of build ("Official", "Release" or "Dev").
128 destination: A string with path to directory where the webapp will be 119 destination: A string with path to directory where the webapp will be
129 written. 120 written.
130 zipfile: A string with path to the zipfile to create containing the 121 zipfile: A string with path to the zipfile to create containing the
131 contents of |destination|. 122 contents of |destination|.
132 manifest_template: jinja2 template file for manifest. 123 manifest_template: jinja2 template file for manifest.
133 webapp_type: webapp type: 124 webapp_type: webapp type:
134 For DesktopRemoting: "v1", "v2" or "v2_pnacl" 125 For DesktopRemoting: "desktop"
135 For AppRemoting: "app_remoting" or "shared_module" 126 For AppRemoting: "app_remoting" or "shared_module"
136 appid: A string with the Remoting Application Id (only used for app 127 appid: A string with the Remoting Application Id (only used for app
137 remoting webapps). If supplied, it defaults to using the 128 remoting webapps). If supplied, it defaults to using the
138 test API server. 129 test API server.
139 app_client_id: The OAuth2 client ID for the webapp. 130 app_client_id: The OAuth2 client ID for the webapp.
140 app_name: A string with the name of the application. 131 app_name: A string with the name of the application.
141 app_description: A string with the description of the application. 132 app_description: A string with the description of the application.
142 app_capabilities: A set of strings naming the capabilities that should be 133 app_capabilities: A set of strings naming the capabilities that should be
143 enabled for this application. 134 enabled for this application.
144 manifest_key: The manifest key for the webapp. 135 manifest_key: The manifest key for the webapp.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 raise Exception('Unknown extension: ' + current_locale) 216 raise Exception('Unknown extension: ' + current_locale)
226 217
227 is_app_remoting_webapp = webapp_type == 'app_remoting' 218 is_app_remoting_webapp = webapp_type == 'app_remoting'
228 is_app_remoting_shared_module = webapp_type == 'shared_module' 219 is_app_remoting_shared_module = webapp_type == 'shared_module'
229 is_app_remoting = is_app_remoting_webapp or is_app_remoting_shared_module 220 is_app_remoting = is_app_remoting_webapp or is_app_remoting_shared_module
230 is_prod_service_environment = service_environment == 'vendor' or \ 221 is_prod_service_environment = service_environment == 'vendor' or \
231 service_environment == 'prod' or \ 222 service_environment == 'prod' or \
232 service_environment == 'prod-testing' 223 service_environment == 'prod-testing'
233 is_desktop_remoting = not is_app_remoting 224 is_desktop_remoting = not is_app_remoting
234 225
235 # Set client plugin type.
236 if not is_app_remoting_webapp:
237 client_plugin = getClientPluginType(webapp_type)
238 findAndReplace(os.path.join(destination, 'plugin_settings.js'),
239 "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'")
240
241 # Allow host names for google services/apis to be overriden via env vars. 226 # Allow host names for google services/apis to be overriden via env vars.
242 oauth2AccountsHost = os.environ.get( 227 oauth2AccountsHost = os.environ.get(
243 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com') 228 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com')
244 oauth2ApiHost = os.environ.get( 229 oauth2ApiHost = os.environ.get(
245 'OAUTH2_API_HOST', 'https://www.googleapis.com') 230 'OAUTH2_API_HOST', 'https://www.googleapis.com')
246 directoryApiHost = os.environ.get( 231 directoryApiHost = os.environ.get(
247 'DIRECTORY_API_HOST', 'https://www.googleapis.com') 232 'DIRECTORY_API_HOST', 'https://www.googleapis.com')
248 remotingApiHost = os.environ.get( 233 remotingApiHost = os.environ.get(
249 'REMOTING_API_HOST', 'https://remoting-pa.googleapis.com') 234 'REMOTING_API_HOST', 'https://remoting-pa.googleapis.com')
250 235
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 parser.add_argument('--use_gcd', choices=['0', '1'], default='0') 484 parser.add_argument('--use_gcd', choices=['0', '1'], default='0')
500 485
501 args = parser.parse_args() 486 args = parser.parse_args()
502 args.use_gcd = (args.use_gcd != '0') 487 args.use_gcd = (args.use_gcd != '0')
503 args.app_capabilities = set(args.app_capabilities) 488 args.app_capabilities = set(args.app_capabilities)
504 return buildWebApp(**vars(args)) 489 return buildWebApp(**vars(args))
505 490
506 491
507 if __name__ == '__main__': 492 if __name__ == '__main__':
508 sys.exit(main()) 493 sys.exit(main())
OLDNEW
« no previous file with comments | « remoting/webapp/base/js/plugin_settings.js ('k') | testing/chromoting/chromoting_integration_tests.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698