-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruling.sh
executable file
·61 lines (49 loc) · 1.12 KB
/
ruling.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
#!/bin/bash
basedir=~/workspace
targetDir=its/ruling
currentDir=${PWD##*/}
#set up env
if [[ $currentDir = sonar-javascript ]]
then
versionName="-DjavascriptVersion"
expected=src/test/expected
fi
if [[ $currentDir = sonar-java ]]
then
versionName="-DjavaVersion"
expected=src/test/resources/guava
fi
export ORCHESTRATOR_CONFIG_URL=file:///home/ganncamp/workspace/orchestrator.properties
#sanity checks
if [[ $currentDir != sonar-* ]]
then
echo "Not a plugin directory. Goodbye"
exit
fi
if [ ! -d $targetDir ]
then
echo "I don't see '${targetDir}'. Goodbye"
exit
fi
#build project
mvn clean install
if [[ $? != 0 ]] ; then
echo 'Build failed!'
exit $rc
fi
cd $targetDir
#run ruling
mvn install -Dmaven.test.redirectTestOutputToFile=false ${versionName}="DEV" -Dsonar.runtimeVersion="LATEST_RELEASE"
#copy new .json file
if [[ $? != 0 ]]
then
actual=target/actual
newFile=$(diff -qr $expected $actual | grep "Only in" | awk '{print $4}')
echo $newFile
# if [[ ! -z $newFile ]]
# then
# cp ${actual}/${newFile} ${expected}/.
# git add ${actual}/${newFile}
# echo Copied $newFile to $actual
# fi
fi