forked from triSYCL/triSYCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish_Doxygen
executable file
·112 lines (88 loc) · 3.51 KB
/
publish_Doxygen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#! /bin/bash -vx
# Publish the Doxygen API of SYCL on GitHub
# Ronan Keryell at Xilinx point COM
# Publish on GitHub the API for the master branch of this git repository.
# This script is to be used in the top-level directory of the git
# repository.
# Everything is quite hard-coded but it is not to be used outside of the
# web-site maintenance...
# Recycle some ideas used in the publication of the Par4All web-site on
# GitHub
# Exit if an error occurs rather than unspecified dangerous behaviour...
set -e
# Move a Doxygen documentation at the right place
update_doc() {
# First argument: where the doc is published
PUB_DIR=$1
# Second argument: the name of the PDF version output
PDF_NAME=$2
# Where the doc is generated
DOXYGEN_DIR=tmp/$PUB_DIR
# Remove the old version, if any
rm -rf $PUB_DIR
mkdir -p $PUB_DIR
cp -a $DOXYGEN_DIR/html $PUB_DIR
# Add the PDF documentation at the top level of SYCL API
cp $DOXYGEN_DIR/latex/refman.pdf $PUB_DIR/$PDF_NAME
# Add the generated directory to the index
git add $PUB_DIR
}
# Use another copy of the git repository to avoid messing up with the
# state of the current repository
tmp_git=tmp_publish_github_pages
# Work in a new working copy of the repository to compile the WWW pages
rm -rf $tmp_git
# Assume we are in the top directory of the reference repository so we can
# clone it
git clone . $tmp_git
cd $tmp_git
# Build the API web pages with Doxygen from this repository to be sure we
# have the state of the master branch without uncommitted files
make doc-clean
make doc
# The special gh-pages branch is used by GitHub as the GitHub Pages WWW
# site.
# (Assume a previous initialization with git checkout --orphan gh-pages)
git checkout gh-pages
# Move the generated documentation at the right place
update_doc Doxygen/SYCL SYCL-API-refman.pdf
update_doc Doxygen/triSYCL triSYCL-implementation-refman.pdf
# Take also into account what has been deleted
git add --update
# Add the home page which comes from the master branch
git checkout master -- doc/WWW/index.html
cp doc/WWW/index.html .
git add index.html
# Remove this file added by the check-out above from the files to be
# committed
git reset HEAD doc/WWW/index.html
# Create a snapshot of the index content
tree_object=`git write-tree`
# Construct a log message with the list of commits since the previous
# publication
(
echo "Publish new WWW site version"
echo
echo "The list of commits since last publication:"
echo
# gh-pages point to the current published version, which is the old
# one. gh-pages^2 is the second parent of the old one, and thus the
# master used for this old publication. master point to the last
# commit to be taken for publishing, so the following list all the
# commits between master and the previous master used for the old
# publication
git log gh-pages^2..master
) > commit_list
# Create a commit object that takes into account its natural history but
# also the master branch as an ancestor so we can figure out easily which
# source of the WWW site is currently published
commit_object=`git commit-tree -p HEAD -p master \
-F commit_list $tree_object`
# Update the gh-pages branch to this commit object. By construction this
# is not a merge, it is just a fast-forward update, but add --ff-only to
# assert this
git merge --ff-only $commit_object
# Update the gh-pages branch on the reference git repository
git push
echo To do the publication, just push the gh-pages branch on GitHub
echo To revert this generation: git branch -f gh-pages gh-pages^