| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 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. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import os.path | 7 import os.path |
| 8 import shutil | 8 import shutil |
| 9 import sys | 9 import sys |
| 10 import subprocess | 10 import subprocess |
| 11 | 11 |
| 12 import bot | 12 import bot |
| 13 import bot_utils | 13 import bot_utils |
| 14 | 14 |
| 15 utils = bot_utils.GetUtils() | 15 utils = bot_utils.GetUtils() |
| 16 | 16 |
| 17 BUILD_OS = utils.GuessOS() | 17 BUILD_OS = utils.GuessOS() |
| 18 | 18 |
| 19 (bot_name, _) = bot.GetBotName() | 19 (bot_name, _) = bot.GetBotName() |
| 20 CHANNEL = bot_utils.GetChannelFromName(bot_name) | 20 CHANNEL = bot_utils.GetChannelFromName(bot_name) |
| 21 | 21 |
| 22 def BuildSDK(): | 22 def BuildSDK(): |
| 23 with bot.BuildStep('Build SDK'): | 23 with bot.BuildStep('Build SDK'): |
| 24 Run([sys.executable, './tools/build.py', '--mode=release', | 24 Run([sys.executable, './tools/build.py', '--mode=release', |
| 25 '--arch=ia32,x64', 'create_sdk']) | 25 '--arch=ia32,x64', 'create_sdk']) |
| 26 | 26 |
| 27 def BuildAPIDocs(): | |
| 28 with bot.BuildStep('Build API docs'): | |
| 29 Run([sys.executable, './tools/build.py', '--mode=release', | |
| 30 '--arch=ia32', 'api_docs']) | |
| 31 Run([sys.executable, './tools/build.py', '--mode=release', | |
| 32 '--arch=ia32', 'dartdocgen']) | |
| 33 | |
| 34 def BuildDartdocAPIDocs(dirname): | 27 def BuildDartdocAPIDocs(dirname): |
| 35 dart_sdk = os.path.join(bot_utils.DART_DIR, | 28 dart_sdk = os.path.join(bot_utils.DART_DIR, |
| 36 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 29 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
| 37 'dart-sdk') | 30 'dart-sdk') |
| 38 dart_exe = os.path.join(dart_sdk, 'bin', 'dart') | 31 dart_exe = os.path.join(dart_sdk, 'bin', 'dart') |
| 39 dartdoc_dart = os.path.join(bot_utils.DART_DIR, | 32 dartdoc_dart = os.path.join(bot_utils.DART_DIR, |
| 40 'third_party', 'pkg' , 'dartdoc' , 'bin' , | 33 'third_party', 'pkg' , 'dartdoc' , 'bin' , |
| 41 'dartdoc.dart') | 34 'dartdoc.dart') |
| 42 packages_dir = os.path.join(bot_utils.DART_DIR, | 35 packages_dir = os.path.join(bot_utils.DART_DIR, |
| 43 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 36 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') | 86 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') |
| 94 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') | 87 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') |
| 95 DartArchiveFile(sdk32_zip, path32, checksum_files=True) | 88 DartArchiveFile(sdk32_zip, path32, checksum_files=True) |
| 96 DartArchiveFile(sdk64_zip, path64, checksum_files=True) | 89 DartArchiveFile(sdk64_zip, path64, checksum_files=True) |
| 97 | 90 |
| 98 def CreateUploadSDK(): | 91 def CreateUploadSDK(): |
| 99 BuildSDK() | 92 BuildSDK() |
| 100 CreateUploadSDKZips() | 93 CreateUploadSDKZips() |
| 101 | 94 |
| 102 def CreateUploadAPIDocs(): | 95 def CreateUploadAPIDocs(): |
| 103 api_path = os.path.join(bot_utils.DART_DIR, | |
| 104 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | |
| 105 'api_docs') | |
| 106 api_zip = os.path.join(bot_utils.DART_DIR, | |
| 107 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | |
| 108 'dart-api-docs.zip') | |
| 109 dartdoc_dir = os.path.join(bot_utils.DART_DIR, | 96 dartdoc_dir = os.path.join(bot_utils.DART_DIR, |
| 110 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 97 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
| 111 'gen-dartdocs') | 98 'gen-dartdocs') |
| 112 dartdoc_zip = os.path.join(bot_utils.DART_DIR, | 99 dartdoc_zip = os.path.join(bot_utils.DART_DIR, |
| 113 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 100 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
| 114 'dartdocs-api.zip') | 101 'dartdocs-api.zip') |
| 115 shutil.rmtree(api_path, ignore_errors=True) | 102 shutil.rmtree(api_path, ignore_errors=True) |
| 116 FileDelete(api_zip) | 103 FileDelete(api_zip) |
| 117 BuildAPIDocs() | |
| 118 UploadApiDocs(api_path) | |
| 119 UploadApiLatestFile() | 104 UploadApiLatestFile() |
| 120 CreateZip(api_path, api_zip) | |
| 121 DartArchiveUploadAPIDocs(api_zip) | |
| 122 BuildDartdocAPIDocs(dartdoc_dir) | 105 BuildDartdocAPIDocs(dartdoc_dir) |
| 123 UploadDartdocApiDocs(dartdoc_dir) | 106 UploadDartdocApiDocs(dartdoc_dir) |
| 124 CreateZip(dartdoc_dir, dartdoc_zip) | 107 CreateZip(dartdoc_dir, dartdoc_zip) |
| 125 DartArchiveUploadDartdocAPIDocs(dartdoc_zip) | 108 DartArchiveUploadDartdocAPIDocs(dartdoc_zip) |
| 126 | 109 |
| 127 def DartArchiveUploadAPIDocs(api_zip): | |
| 128 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | |
| 129 revision = utils.GetArchiveVersion() | |
| 130 for revision in [revision, 'latest']: | |
| 131 destination = (namer.apidocs_directory(revision) + '/' + | |
| 132 namer.apidocs_zipfilename()) | |
| 133 DartArchiveFile(api_zip, destination, checksum_files=False) | |
| 134 | |
| 135 def UploadApiDocs(dir_name): | |
| 136 apidocs_namer = bot_utils.GCSNamerApiDocs(CHANNEL) | |
| 137 revision = utils.GetArchiveVersion() | |
| 138 apidocs_destination_gcsdir = apidocs_namer.docs_dirpath(revision) | |
| 139 apidocs_destination_latestfile = apidocs_namer.docs_latestpath(revision) | |
| 140 | |
| 141 # Return early if the documents have already been uploaded. | |
| 142 # (This can happen if a build was forced, or a commit had no changes in the | |
| 143 # dart repository (e.g. DEPS file update).) | |
| 144 if GsutilExists(apidocs_destination_gcsdir): | |
| 145 print ("Not uploading api docs, since %s is already present." | |
| 146 % apidocs_destination_gcsdir) | |
| 147 return | |
| 148 | |
| 149 # Upload everything inside the built apidocs directory. | |
| 150 gsutil = bot_utils.GSUtil() | |
| 151 gsutil.upload(dir_name, apidocs_destination_gcsdir, recursive=True, | |
| 152 public=True) | |
| 153 | |
| 154 def DartArchiveUploadDartdocAPIDocs(api_zip): | 110 def DartArchiveUploadDartdocAPIDocs(api_zip): |
| 155 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | 111 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 156 revision = utils.GetArchiveVersion() | 112 revision = utils.GetArchiveVersion() |
| 157 for revision in [revision, 'latest']: | 113 for revision in [revision, 'latest']: |
| 158 destination = (namer.apidocs_directory(revision) + '/' + | 114 destination = (namer.apidocs_directory(revision) + '/' + |
| 159 namer.dartdocs_zipfilename()) | 115 namer.dartdocs_zipfilename()) |
| 160 DartArchiveFile(api_zip, destination, checksum_files=False) | 116 DartArchiveFile(api_zip, destination, checksum_files=False) |
| 161 | 117 |
| 162 def UploadDartdocApiDocs(dir_name): | 118 def UploadDartdocApiDocs(dir_name): |
| 163 apidocs_namer = bot_utils.GCSNamerApiDocs(CHANNEL) | 119 apidocs_namer = bot_utils.GCSNamerApiDocs(CHANNEL) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 205 |
| 250 if __name__ == '__main__': | 206 if __name__ == '__main__': |
| 251 # We always clobber the bot, to make sure releases are build from scratch | 207 # We always clobber the bot, to make sure releases are build from scratch |
| 252 force = CHANNEL != bot_utils.Channel.BLEEDING_EDGE | 208 force = CHANNEL != bot_utils.Channel.BLEEDING_EDGE |
| 253 bot.Clobber(force=force) | 209 bot.Clobber(force=force) |
| 254 | 210 |
| 255 CreateUploadSDK() | 211 CreateUploadSDK() |
| 256 if BUILD_OS == 'linux': | 212 if BUILD_OS == 'linux': |
| 257 CreateUploadVersionFile() | 213 CreateUploadVersionFile() |
| 258 CreateUploadAPIDocs() | 214 CreateUploadAPIDocs() |
| OLD | NEW |