Skip to content

Commit

Permalink
refine and optimize the doc build a little more
Browse files Browse the repository at this point in the history
Ensure that the travis deploy is creating the .nojekyll file, and
force push the gh-pages branch each time; we don't care about
doc history since everything is auto generated anyway.
  • Loading branch information
wez committed Oct 20, 2018
1 parent 7ab7dcd commit a706c44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
keep-history: false
local-dir: doc
on:
branch: master
22 changes: 16 additions & 6 deletions build-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,32 @@ def generate_docs():
"hal",
os.path.join(doc_build, "hal"))

exclude = set(crates_by_pac.keys())
exclude.remove(pac)

for crate in crates:
src_crate_dir = os.path.join("boards", crate)
dest_crate_dir = os.path.join(doc_build, "boards", crate)
copy_skeleton_crate(src_crate_dir, dest_crate_dir)

subprocess.call(['cargo', 'doc',
'--target-dir', 'target/%s' % pac,
'--lib',
'--no-deps',
'--manifest-path', '%s/Cargo.toml' % doc_build])
cmd = [
'cargo', 'doc',
'--target-dir', 'target/%s' % pac,
'--exclude', ' '.join(exclude),
'--all',
'--no-deps',
'--manifest-path', '%s/Cargo.toml' % doc_build]
print(cmd)
subprocess.call(cmd)

def copy_to_docs_dir():
""" Build out the doc tree from the cargo generated docs """
if os.path.exists('doc'):
shutil.rmtree('doc')
os.makedirs('doc')
with open("doc/.nojekyll", "w") as f:
f.write("")

for pac in crates_by_pac.keys():
shutil.copytree('target/%s/thumbv6m-none-eabi/doc' % pac,
'doc/%s' % pac)
Expand All @@ -104,7 +114,7 @@ def generate_all_index_html():
def push_using_ghp_import():
""" copy the doc dir to the gh_pages branch and push to github.
You can `apt install ghp-import` on ubuntu, or pip install it elsewhere. """
subprocess.call(['ghp-import', '-n', '-p', 'doc'])
subprocess.call(['ghp-import', '-p', 'doc'])

def main():
parser = argparse.ArgumentParser()
Expand Down

0 comments on commit a706c44

Please sign in to comment.