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

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: fix long line 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
« no previous file with comments | « 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..4ae91b7cacdd7e43e11f02b591ace3e16bda36aa 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,23 @@ 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'),
+ 'dart-sdk')
+ 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')
+ 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','--output', dirname, '--dart-sdk', dart_sdk,
+ '--package-root=%s' % packages_dir],
+ stdout=open(os.devnull, 'wb'))
+
def CreateUploadVersionFile():
file_path = os.path.join(bot_utils.DART_DIR,
utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'),
@@ -86,12 +104,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 +149,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) + '/' +
+ 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
+ # 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')
« no previous file with comments | « tools/bots/bot_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698