This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_woboq.sh
executable file
·68 lines (55 loc) · 1.7 KB
/
run_woboq.sh
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
#! /bin/bash
# Generate code HTML by woboq using compile_commands.json
# Dependence:
# - compile_commands.json exist
# - woboq has been built (which means clang environment is available)
# see: https://github.com/woboq/woboq_codebrowser
#
# Author: Yantao Zhao
# Update: 2017.08.01
function Usage() {
echo "Usage: $0 woboqRoot codeRoot outputRoot projectName"
echo "Example: $0 ~/woboq_codebrowser-2.1/ ~/linux-3.18.65/ ~/public_html/ linuxkernel"
}
## check params
if [[ $# -lt 4 ]]; then
Usage
exit
fi
woboqRoot=${1%/}
# codeRoot=$2
outputRoot=${3%/}
projectName=$4
OUTPUTDIRECTORY=$outputRoot/${projectName}
DATADIRECTORY=$OUTPUTDIRECTORY/../data
BUILDIRECTORY=${2%/}
# VERSION=`git describe --always --tags`
## check the woboq binary
if ! [[ -x $woboqRoot/generator/codebrowser_generator && -x $woboqRoot/indexgenerator/codebrowser_indexgenerator ]]; then
echo -e "woboq binary not exist!\nexit"
exit
fi
## check the output directory
if [[ -d $OUTPUTDIRECTORY ]]; then
echo "Warning: output directory '$OUTPUTDIRECTORY' already exist!"
read -p "Backup it automatically and continue? [Y/n]" bkup
case $bkup in
[yY] | [yY][eE][sS] | '' )
mv -fv $OUTPUTDIRECTORY $OUTPUTDIRECTORY.backup.$(date +%Y%m%d_%H%M%S)
if [[ $? -ne 0 ]]; then exit; fi
;;
* )
echo "Nothing done, exit"
exit
;;
esac
fi
mkdir -pv $OUTPUTDIRECTORY
sleep 1
pushd .
cd $woboqRoot
./generator/codebrowser_generator -b $BUILDIRECTORY -a -o $OUTPUTDIRECTORY -p ${projectName}:$BUILDIRECTORY
./indexgenerator/codebrowser_indexgenerator $OUTPUTDIRECTORY
cp -rv ./data $DATADIRECTORY
popd
echo "Result at: $OUTPUTDIRECTORY"