| Index: pkg/docgen/bin/upload_docgen.py
|
| diff --git a/pkg/docgen/bin/upload_docgen.py b/pkg/docgen/bin/upload_docgen.py
|
| index 9e2d335b6c4587037cf29cca1317f1f5c605abd5..6a3ea088324ebdf2aa71ad147f4d30d9b1ae8267 100644
|
| --- a/pkg/docgen/bin/upload_docgen.py
|
| +++ b/pkg/docgen/bin/upload_docgen.py
|
| @@ -29,16 +29,22 @@ GSUTIL = utils.GetBuildbotGSUtilPath()
|
| GS_SITE = 'gs://dartlang-docgen'
|
| DESCRIPTION='Runs docgen.dart on the SDK libraries, and uploads them to Google \
|
| Cloud Storage for the dartdoc-viewer. '
|
| -
|
| +# Allow us to override checking SVN's revision number. Useful for development
|
| +# so we can upload docs from a branch using an SDK that was built on a
|
| +# revision newer than when the branch was forked.
|
| +trustSVN = None
|
|
|
| def GetOptions():
|
| parser = optparse.OptionParser(description=DESCRIPTION)
|
| parser.add_option('--package-root', dest='pkg_root',
|
| help='The package root for dart. (Default is in the build directory.)',
|
| action='store', default=PACKAGE_ROOT)
|
| + parser.add_option('--dontTrustSVN', dest='dontTrustSVN', default=False,
|
| + help='Don''t rely on the SVN revision number, check the DART SDK instead',
|
| + action='store_true')
|
| (options, args) = parser.parse_args()
|
| SetPackageRoot(options.pkg_root)
|
| -
|
| + trustSVN = not options.dontTrustSVN
|
|
|
| def SetPackageRoot(path):
|
| global PACKAGE_ROOT
|
| @@ -67,12 +73,13 @@ def main():
|
| SetGsutil()
|
|
|
| # Execute Docgen.dart on the SDK.
|
| - ExecuteCommand([DART, '--checked', '--package-root=' + PACKAGE_ROOT,
|
| - abspath(join(dirname(__file__), 'docgen.dart')),
|
| - '--parse-sdk', '--json'])
|
| + ExecuteCommand(['sh', './generate_all_docs.sh'])
|
|
|
| # Use SVN Revision to get the revision number.
|
| - revision = utils.GetSVNRevision()
|
| + revision = None
|
| + if trustSVN:
|
| + revision = utils.GetSVNRevision()
|
| +
|
| if revision is None:
|
| # Try to find the version from the dart-sdk folder.
|
| revision_file_location = abspath(join(dirname(__file__),
|
| @@ -87,13 +94,19 @@ def main():
|
|
|
| # Upload the all files in Docs into a folder based off Revision number on
|
| # Cloud Storage.
|
| - Upload('./docs/*', GS_SITE + '/' + revision + '/')
|
| + # TODO(alanknight): If we give it ./docs/* it fails to upload files in the
|
| + # subdirectory, probably due to escaping. Work around it by changing dir.
|
| + # Better, generalize this to be less dependent on the working directory.
|
| + os.chdir('docs')
|
| + Upload('.', GS_SITE + '/' + revision + '/')
|
| + os.chdir('..')
|
|
|
| # Update VERSION file in Cloud Storage.
|
| with open('VERSION', 'w') as version_file:
|
| version_file.write(revision)
|
| version_file.close()
|
| Upload('./VERSION', GS_SITE + '/VERSION')
|
| + Upload('./VERSION', GS_SITE + '/' + revision + '/' + 'VERSION')
|
|
|
| # Clean up the files it creates.
|
| ExecuteCommand(['rm', '-rf', './docs'])
|
|
|