Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 # | |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 4 # for details. All rights reserved. Use of this source code is governed by a | |
| 5 # BSD-style license that can be found in the LICENSE file. | |
| 6 | |
| 7 """ This file will run docgen.dart on the SDK libraries, and upload them to | |
| 8 Google Cloud Storage for the documentation viewer. | |
| 9 """ | |
| 10 | |
| 11 import os | |
| 12 import platform | |
| 13 import subprocess | |
| 14 import sys | |
| 15 sys.path.append(os.path.abspath('../../../tools')) | |
| 16 import utils | |
| 17 from upload_sdk import ExecuteCommand | |
| 18 | |
| 19 | |
| 20 DART = os.path.abspath('../../../%s/%s/dart-sdk/bin/dart' | |
| 21 % (utils.BUILD_ROOT[utils.GuessOS()], | |
| 22 utils.GetBuildConf('release', utils.GuessArchitecture()))) | |
| 23 GSUTIL = utils.GetBuildbotGSUtilPath() | |
| 24 GS_SITE = 'gs://dartlang-docgen' | |
| 25 | |
| 26 | |
| 27 def SetGsutil(): | |
| 28 """ If not on buildbots, find gsutil relative to docgen. """ | |
| 29 global GSUTIL | |
| 30 if not os.path.exists(GSUTIL): | |
| 31 GSUTIL = os.path.abspath('../../../third_party/gsutil/gsutil') | |
| 32 | |
| 33 | |
| 34 def Upload(source, target): | |
| 35 """ Upload files to Google Storage. """ | |
| 36 cmd = [GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', '-r', source, target] | |
| 37 (status, output) = ExecuteCommand(cmd) | |
| 38 return status | |
| 39 | |
| 40 | |
| 41 def main(): | |
| 42 SetGsutil() | |
| 43 | |
| 44 # Execute Docgen.dart on the SDK. | |
| 45 ExecuteCommand([DART, 'docgen.dart', '--parse-sdk']) | |
| 46 | |
| 47 # Use SVN Revision to get the revision number. | |
| 48 revision = utils.GetSVNRevision() | |
| 49 if revision is None: | |
| 50 raise Exception("Unable to find revision. ") | |
| 51 | |
| 52 # Upload the all files in Docs into a folder based off Revision number on | |
| 53 # Cloud Storage. | |
| 54 Upload('./docs/*', GS_SITE + '/' + revision + '/') | |
|
Emily Fortuna
2013/07/11 20:47:33
does docgen create the docs directory in whatever
| |
| 55 | |
| 56 # Update VERSION file in Cloud Storage. | |
| 57 with open('VERSION', 'w') as version_file: | |
| 58 version_file.write(revision) | |
| 59 Upload('./VERSION', GS_SITE + '/VERSION') | |
| 60 | |
| 61 # Clean up the files it creates. | |
| 62 ExecuteCommand(['rm', '-rf', './docs']) | |
| 63 ExecuteCommand(['rm', '-f', './VERSION']) | |
| 64 | |
| 65 | |
| 66 if __name__ == '__main__': | |
| 67 main() | |
| OLD | NEW |