-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-all-apache.sh
executable file
·117 lines (102 loc) · 2.9 KB
/
run-all-apache.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
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
113
114
115
116
117
#!/usr/bin/env bash
BASEDIR="$(pwd)"
TOOLS_DIR="$BASEDIR/tools"
APACHE_HOME="$BASEDIR/apache-projects"
SELECTION_DIR="$BASEDIR/out/selection"
analysis() {
echo Running ANALYSIS step
if [[ ! -d "$APACHE_HOME" ]]; then
echo Missing APACHE_HOME dir. Did you run apache_download.sh?
echo Aborting
exit 1
fi
find "$APACHE_HOME" -type f -path '*.sh' |
while read -r subject; do
time "$TOOLS_DIR/pipeline-analysis.sh" "$subject"
done
echo Done ANALYSIS step
}
selection() {
echo Running selection pipeline
local OUTPUT_DATA="$SELECTION_DIR/data"
if [[ ! -d "$APACHE_HOME" ]]; then
echo Missing APACHE_HOME dir. Did you run apache_download.sh?
echo Aborting
exit 1
fi
# Always save in a clean state
[[ -d "$SELECTION_DIR" ]] && rm -rf "$SELECTION_DIR"
mkdir -p "$OUTPUT_DATA"
"$TOOLS_DIR"/summary-analysis.sh >"$OUTPUT_DATA/analysis.csv"
"$TOOLS_DIR"/selection.R "$OUTPUT_DATA/analysis.csv" | tee "$OUTPUT_DATA/selection.log"
mv filtering.csv "$OUTPUT_DATA"
grep -v '"name","java_files' "$OUTPUT_DATA/filtering.csv" |
sed 's/",.*//' | sed 's/"//' |
while read -r name; do
cp "$APACHE_HOME/$name.sh" "$SELECTION_DIR"
done
}
log_removal() {
echo Running LOG-REMOVAL step
if [[ ! -d "$SELECTION_DIR" ]]; then
echo Missing SELECTION dir. Did you run the run-selection script?
echo Aborting
exit 1
fi
find "$SELECTION_DIR" -type f -path '*.sh' |
while read -r subject; do
echo Running "$subject"
time "$TOOLS_DIR/pipeline-log-removal.sh" "$subject"
echo "done $subject"
done
echo Done LOG-REMOVAL step
}
code_metrics() {
echo Running CODE-METRICS step
if [[ ! -d "$SELECTION_DIR" ]]; then
echo Missing SELECTION dir. Did you run the run-selection script?
echo Aborting
exit 1
fi
find "$SELECTION_DIR" -type f -path '*.sh' |
while read -r subject; do
echo Running "$subject"
time "$TOOLS_DIR/pipeline-codemetrics.sh" "$subject"
done
echo Done CODE-METRICS step
}
create_dataset() {
echo Running DATASET step
if [[ ! -d "$SELECTION_DIR" ]]; then
echo Missing SELECTION dir. Did you run the run-selection script?
echo Aborting
exit 1
fi
find "$SELECTION_DIR" -type f -path '*.sh' |
while read -r subject; do
echo Running "$subject"
time "$TOOLS_DIR/build-datasets.sh" "$subject"
done
echo Done DATASET step
}
extract_textual_features() {
echo Running TEXTUAL FEATURES step
if [[ ! -d "$SELECTION_DIR" ]]; then
echo Missing SELECTION dir. Did you run the run-selection script?
echo Aborting
exit 1
fi
find "$SELECTION_DIR" -type f -path '*.sh' |
while read -r subject; do
echo Running "$subject"
time "$TOOLS_DIR/pipeline-textual-features.sh" "$subject"
done
echo Done TEXTUAL FEATURES step
}
# main
time analysis
time selection
time log_removal
time code_metrics
time create_dataset
time extract_textual_features