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

Unified Diff: tools/bots/dart_sdk.py

Issue 1164423008: add dartdoc to third_party/pkg, run dartdoc to generate docs for sdk and upload to GCS (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: remove comment, fix whitespace Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« tools/bots/bot_utils.py ('K') | « tools/bots/bot_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bots/dart_sdk.py
diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py
index 16094f0140468369fb35cc91c90a35af2e659965..c54e7db521f84ebb6a40939eaae5a8bfd431d069 100644
--- a/tools/bots/dart_sdk.py
+++ b/tools/bots/dart_sdk.py
@@ -7,6 +7,7 @@
import os.path
import shutil
import sys
+import subprocess
import bot
import bot_utils
@@ -30,6 +31,21 @@ def BuildAPIDocs():
Run([sys.executable, './tools/build.py', '--mode=release',
'--arch=ia32', 'dartdocgen'])
+def BuildDartdocAPIDocs(dirname):
+ dart_sdk = os.path.join(bot_utils.DART_DIR,
+ utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
ricow1 2015/06/11 15:51:50 indentation
keertip 2015/06/11 18:10:10 Done.
+ 'dart-sdk')
ricow1 2015/06/11 15:51:50 indentatione
keertip 2015/06/11 18:10:09 Done.
+ dart_exe = os.path.join(dart_sdk, 'bin', 'dart')
+ dartdoc_dart = os.path.join(bot_utils.DART_DIR,
+ 'third_party', 'pkg' , 'dartdoc' , 'bin' , 'dartdoc.dart')
ricow1 2015/06/11 15:51:50 long line
keertip 2015/06/11 18:10:09 Done.
+ packages_dir = os.path.join(bot_utils.DART_DIR,
+ utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
+ 'packages')
+ with bot.BuildStep('Build API docs by dartdoc'):
+ subprocess.call([dart_exe, '--package-root=' + packages_dir, dartdoc_dart, '--sdk-docs',
ricow1 2015/06/11 15:51:50 long line
ricow1 2015/06/11 15:51:50 '--package-root=%s' % packages_dir is the python w
keertip 2015/06/11 18:10:09 Done.
keertip 2015/06/11 18:10:10 Done.
+ '--output', dirname, '--dart-sdk', dart_sdk, '--package-root', packages_dir],
ricow1 2015/06/11 15:51:50 long line
keertip 2015/06/11 18:10:10 Done.
+ stdout=open(os.devnull, 'wb'))
+
def CreateUploadVersionFile():
file_path = os.path.join(bot_utils.DART_DIR,
utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
@@ -86,12 +102,23 @@ def CreateUploadAPIDocs():
api_zip = os.path.join(bot_utils.DART_DIR,
utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
'dart-api-docs.zip')
+ dartdoc_dir = os.path.join(bot_utils.DART_DIR,
+ utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
+ 'gen-dartdocs')
+ dartdoc_zip = os.path.join(bot_utils.DART_DIR,
+ utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
+ 'dartdocs-api.zip')
shutil.rmtree(api_path, ignore_errors=True)
FileDelete(api_zip)
BuildAPIDocs()
UploadApiDocs(api_path)
+ UploadApiLatestFile()
CreateZip(api_path, api_zip)
DartArchiveUploadAPIDocs(api_zip)
+ BuildDartdocAPIDocs(dartdoc_dir)
+ UploadDartdocApiDocs(dartdoc_dir)
+ CreateZip(dartdoc_dir, dartdoc_zip)
+ DartArchiveUploadDartdocAPIDocs(dartdoc_zip)
def DartArchiveUploadAPIDocs(api_zip):
namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
@@ -120,6 +147,36 @@ def UploadApiDocs(dir_name):
gsutil.upload(dir_name, apidocs_destination_gcsdir, recursive=True,
public=True)
+def DartArchiveUploadDartdocAPIDocs(api_zip):
+ namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
+ revision = utils.GetArchiveVersion()
+ for revision in [revision, 'latest']:
+ destination = (namer.apidocs_directory(revision) + '/' +
ricow1 2015/06/11 15:51:50 I don't like the + between strings, but I am fine
keertip 2015/06/11 18:10:09 Acknowledged.
+ namer.dartdocs_zipfilename())
+ DartArchiveFile(api_zip, destination, checksum_files=False)
+
+def UploadDartdocApiDocs(dir_name):
+ apidocs_namer = bot_utils.GCSNamerApiDocs(CHANNEL)
+ revision = utils.GetArchiveVersion()
+ dartdocs_destination_gcsdir = apidocs_namer.dartdocs_dirpath(revision)
+
+ # Return early if the documents have already been uploaded.
+ # (This can happen if a build was forced, or a commit had no changes in the
ricow1 2015/06/11 15:51:50 lose the ()
keertip 2015/06/11 18:10:09 Done.
+ # dart repository (e.g. DEPS file update).)
+ if GsutilExists(dartdocs_destination_gcsdir):
+ print ("Not uploading api docs, since %s is already present."
+ % dartdocs_destination_gcsdir)
+ return
+
+ # Upload everything inside the built apidocs directory.
+ gsutil = bot_utils.GSUtil()
+ gsutil.upload(dir_name, dartdocs_destination_gcsdir, recursive=True,
+ public=True, multithread=True)
+
+def UploadApiLatestFile():
+ apidocs_namer = bot_utils.GCSNamerApiDocs(CHANNEL)
+ revision = utils.GetArchiveVersion()
+ apidocs_destination_latestfile = apidocs_namer.docs_latestpath(revision)
# Update latest.txt to contain the newest revision.
with utils.TempDir('latest_file') as temp_dir:
latest_file = os.path.join(temp_dir, 'latest.txt')
@@ -187,6 +244,7 @@ def Run(command):
return bot.RunProcess(command)
if __name__ == '__main__':
+
ricow1 2015/06/11 15:51:50 stray edit?
keertip 2015/06/11 18:10:09 Done.
# We always clobber the bot, to make sure releases are build from scratch
force = CHANNEL != bot_utils.Channel.BLEEDING_EDGE
bot.Clobber(force=force)
« tools/bots/bot_utils.py ('K') | « tools/bots/bot_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698