-
Notifications
You must be signed in to change notification settings - Fork 9
/
cronStatistic.sh
executable file
·83 lines (64 loc) · 1.76 KB
/
cronStatistic.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
ONTOLOGY_DIR=$(cd $(dirname "$0") && pwd)
#setup env variables
. $ONTOLOGY_DIR/env-setup.sh
export REPO_SITE=opprop
### building checker framework stuffs and ontology
. $ONTOLOGY_DIR/dependency-setup.sh
### downloading do-like-javac if needs
if [ -d $JSR308/do-like-javac ] ; then
# Older versions of git don't support the -C command-line option
(cd $JSR308/do-like-javac && git pull)
else
(cd $JSR308 && git clone --depth 1 https://github.com/SRI-CSL/do-like-javac.git)
fi
### fetching annotated projects
PROJECTS_DIR=$JSR308/annotatedProjects
PROJECTS_DATA=$JSR308/ontology/projects.data
##
#$1: project_info, format is "project_gitUrl branch" or "project_url" which the master branch will be apply
#do a light clone (depth 1) of a given git project to current directory
function downloadGitProject() {
project_url=$1
if [ $# == "2" ]; then
branch=$2;
else
branch="master"
fi
git clone $project_url --branch $branch --depth=1
}
function runOntologyOnProject() {
mvn="pom.xml"
gradle="build.gradle"
ant="build.xml"
# echo "project: $1"
cd $1
#determine build cmd
if [ -e $ant ]; then
build_cmd="ant"
elif [ -e $gradle ]; then
build_cmd="gradle"
elif [ -e $mvn ]; then
build_cmd="mvn install"
else
echo "don't know for $1"
return 1
fi
echo "$1 $build_cmd"
$JSR308/ontology/run-dljc.sh $build_cmd 1> ontology.log 2> ontology-error.log
}
# remove legacy projects
if [ -d "$PROJECTS_DIR" ]; then
rm -rf "$PROJECTS_DIR"
fi
mkdir "$PROJECTS_DIR"
cd $PROJECTS_DIR
while read line
do
downloadGitProject $line
done < $PROJECTS_DATA
for project in $PROJECTS_DIR/*
do
runOntologyOnProject $project
done
### collecting statistics