Bug 1585661 - Update mach geckoview-docs command to upload markdown as well as javadoc. r=agi

Slightly reorganize file structure to make copying files over easier. Needs to land in conjunction with https://github.com/mozilla/geckoview/pull/94, which should land first.

Differential Revision: https://phabricator.services.mozilla.com/D48564

--HG--
rename : mobile/android/docs/geckoview/Gemfile => mobile/android/docs/Gemfile
rename : mobile/android/docs/geckoview/_config.yml => mobile/android/docs/_config.yml
extra : moz-landing-system : lando
This commit is contained in:
Emily Toop 2019-11-14 15:53:53 +00:00
Родитель a763b02585
Коммит 64fd791361
5 изменённых файлов: 36 добавлений и 52 удалений

Просмотреть файл

Просмотреть файл

@ -16,3 +16,5 @@ plugins:
- jekyll-seo-tag
search_enabled: true
source: ./geckoview

Просмотреть файл

@ -1,41 +0,0 @@
This GitHub repository contains the documentation for [GeckoView][8]. If you are looking for the code for GeckoView you can find it at [Mozilla Central][9].
If there is documentation that you feel is missing, or an existing document doesn't cover the aspect that you are looking for, please request it by [raising an issue][10].
If you have a GeckoView bug that you want to raise, please do so on our [Bugzilla][11].
## Get Started with GeckoView
* [GeckoView Quick Start Guide][1]
* [Interacting with Web content and WebExtension][7]
## API Documentation
* [Changelog][2]
* [API][12]
## Get Started as a Contributor
* [GeckoView Contributor Quick Start Guide][3]
* [Mozilla Central Quick Start Guide][4]
* [Mozilla Central Contributor Guide][5]
* [Guide to Native Debugging in Android Studio][6]
## More information
You can read more about GeckoView on the [wiki](https://wiki.mozilla.org/Mobile/GeckoView).
[1]:https://geckoview.dev/consumer/docs/geckoview-quick-start
[2]:https://geckoview.dev/javadoc/mozilla-central/org/mozilla/geckoview/doc-files/CHANGELOG
[3]:https://geckoview.dev/contributor/geckoview-quick-start
[4]:https://geckoview.dev/contributor/mc-quick-start
[5]:https://geckoview.dev/contributor/contributing-to-mc
[6]:https://geckoview.dev/contributor/native-debugging
[7]:https://geckoview.dev/consumer/docs/web-extensions
[8]:https://geckoview.dev
[9]:https://searchfox.org/mozilla-central/source/mobile/android/geckoview
[10]:https://github.com/mozilla/geckoview/issues
[11]:https://bugzilla.mozilla.org/enter_bug.cgi?product=GeckoView
[12]:https://geckoview.dev/javadoc/mozilla-central/index.html

Просмотреть файл

@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
from distutils.file_util import copy_file
import argparse
import logging
@ -189,15 +190,18 @@ REMOVED/DEPRECATED: Use 'mach lint --linter android-checkstyle'.""")
@CommandArgument('--archive', action='store_true',
help='Generate a javadoc archive.')
@CommandArgument('--upload', metavar='USER/REPO',
help='Upload generated javadoc to Github, '
help='Upload geckoview documentation to Github, '
'using the specified USER/REPO.')
@CommandArgument('--upload-branch', metavar='BRANCH[/PATH]',
default='gh-pages/javadoc',
help='Use the specified branch/path for commits.')
default='gh-pages',
help='Use the specified branch/path for documentation commits.')
@CommandArgument('--javadoc-path', metavar='/PATH',
default='javadoc',
help='Use the specified path for javadoc commits.')
@CommandArgument('--upload-message', metavar='MSG',
default='GeckoView docs upload',
help='Use the specified message for commits.')
def android_geckoview_docs(self, archive, upload, upload_branch,
def android_geckoview_docs(self, archive, upload, upload_branch, javadoc_path,
upload_message):
tasks = (self.substs['GRADLE_ANDROID_GECKOVIEW_DOCS_ARCHIVE_TASKS'] if archive or upload
@ -237,21 +241,39 @@ REMOVED/DEPRECATED: Use 'mach lint --linter android-checkstyle'.""")
env['GIT_SSH_COMMAND'] = 'ssh -i "%s" -o StrictHostKeyChecking=no' % keyfile
# Clone remote repo.
branch, _, branch_path = upload_branch.partition('/')
branch = upload_branch.format(**fmt)
repo_url = 'git@github.com:%s.git' % upload
repo_path = mozpath.abspath('gv-docs-repo')
self.run_process(['git', 'clone', '--branch', branch, '--depth', '1',
self.run_process(['git', 'clone', '--branch', upload_branch, '--depth', '1',
repo_url, repo_path], append_env=env, pass_thru=True)
env['GIT_DIR'] = mozpath.join(repo_path, '.git')
env['GIT_WORK_TREE'] = repo_path
env['GIT_AUTHOR_NAME'] = env['GIT_COMMITTER_NAME'] = 'GeckoView Docs Bot'
env['GIT_AUTHOR_EMAIL'] = env['GIT_COMMITTER_EMAIL'] = 'nobody@mozilla.com'
# Extract new javadoc to specified directory inside repo.
# Copy over user documentation.
import mozfile
docs_path = mozpath.join(self.topsrcdir, 'mobile', 'android', 'docs')
# Some files need to be in the GH repo root folder and should be
# copied over directly
root_docs = ["_config.yml", "Gemfile"]
for filename in root_docs:
src_filepath = mozpath.join(docs_path, filename)
dst_filepath = mozpath.join(repo_path, filename)
copy_file(src_filepath, dst_filepath, update=1)
# Remove existing geckoview docs and replace with the local copy
src_path = mozpath.join(docs_path, 'geckoview')
docs_path = mozpath.join(repo_path, 'geckoview')
mozfile.remove(docs_path)
os.system("rsync -aruz {} {}".format(src_path, repo_path))
# Extract new javadoc to specified directory inside repo.
src_tar = mozpath.join(self.topobjdir, 'gradle', 'build', 'mobile', 'android',
'geckoview', 'libs', 'geckoview-javadoc.jar')
dst_path = mozpath.join(repo_path, branch_path.format(**fmt))
dst_path = mozpath.join(docs_path, javadoc_path)
mozfile.remove(dst_path)
mozfile.extract_zip(src_tar, dst_path)
@ -263,7 +285,7 @@ REMOVED/DEPRECATED: Use 'mach lint --linter android-checkstyle'.""")
self.run_process(['git', 'commit',
'--message', upload_message.format(**fmt)],
append_env=env, pass_thru=True)
self.run_process(['git', 'push', 'origin', 'gh-pages'],
self.run_process(['git', 'push', 'origin', branch],
append_env=env, pass_thru=True)
mozfile.remove(repo_path)

Просмотреть файл

@ -9,8 +9,9 @@ config = {
'geckoview-docs',
'--archive',
'--upload', 'mozilla/geckoview',
'--upload-branch', 'gh-pages/javadoc/{project}',
'--upload-message', 'Update {project} javadoc to rev {revision}',
'--upload-branch', 'gh-pages'
'--javadoc-path', 'javadoc/{project}',
'--upload-message', 'Update {project} documentation to rev {revision}',
],
],
'max_build_output_timeout': 0,