OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 else: | 184 else: |
185 oauth2RedirectUrlJs = "'" + baseUrl + "/dev'" | 185 oauth2RedirectUrlJs = "'" + baseUrl + "/dev'" |
186 oauth2RedirectUrlJson = baseUrl + '/dev*' | 186 oauth2RedirectUrlJson = baseUrl + '/dev*' |
187 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 187 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
188 "'OAUTH2_REDIRECT_URL'", | 188 "'OAUTH2_REDIRECT_URL'", |
189 oauth2RedirectUrlJs) | 189 oauth2RedirectUrlJs) |
190 findAndReplace(os.path.join(destination, 'manifest.json'), | 190 findAndReplace(os.path.join(destination, 'manifest.json'), |
191 "OAUTH2_REDIRECT_URL", | 191 "OAUTH2_REDIRECT_URL", |
192 oauth2RedirectUrlJson) | 192 oauth2RedirectUrlJson) |
193 | 193 |
| 194 # Set the correct API keys. |
| 195 if (buildtype == 'Official'): |
| 196 apiClientId = ('440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.' + |
| 197 'apps.googleusercontent.com') |
| 198 apiClientSecret = 'Bgur6DFiOMM1h8x-AQpuTQlK' |
| 199 else: |
| 200 apiClientId = ('440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.' + |
| 201 'apps.googleusercontent.com') |
| 202 apiClientSecret = 'W2ieEsG-R1gIA4MMurGrgMc_' |
| 203 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
| 204 "'API_CLIENT_ID'", |
| 205 "'" + apiClientId + "'") |
| 206 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
| 207 "'API_CLIENT_SECRET'", |
| 208 "'" + apiClientSecret + "'") |
| 209 |
194 # Make the zipfile. | 210 # Make the zipfile. |
195 createZip(zip_path, destination) | 211 createZip(zip_path, destination) |
196 | 212 |
197 | 213 |
198 def main(): | 214 def main(): |
199 if len(sys.argv) < 6: | 215 if len(sys.argv) < 6: |
200 print ('Usage: build-webapp.py ' | 216 print ('Usage: build-webapp.py ' |
201 '<build-type> <mime-type> <dst> <zip-path> <plugin> ' | 217 '<build-type> <mime-type> <dst> <zip-path> <plugin> ' |
202 '<other files...> --locales <locales...>') | 218 '<other files...> --locales <locales...>') |
203 return 1 | 219 return 1 |
204 | 220 |
205 reading_locales = False | 221 reading_locales = False |
206 files = [] | 222 files = [] |
207 locales = [] | 223 locales = [] |
208 for arg in sys.argv[6:]: | 224 for arg in sys.argv[6:]: |
209 if arg == "--locales": | 225 if arg == "--locales": |
210 reading_locales = True; | 226 reading_locales = True; |
211 elif reading_locales: | 227 elif reading_locales: |
212 locales.append(arg) | 228 locales.append(arg) |
213 else: | 229 else: |
214 files.append(arg) | 230 files.append(arg) |
215 | 231 |
216 buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], | 232 buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], |
217 files, locales) | 233 files, locales) |
218 return 0 | 234 return 0 |
219 | 235 |
220 | 236 |
221 if __name__ == '__main__': | 237 if __name__ == '__main__': |
222 sys.exit(main()) | 238 sys.exit(main()) |
OLD | NEW |