-
Notifications
You must be signed in to change notification settings - Fork 6
/
travis_build.sh
85 lines (71 loc) · 3.09 KB
/
travis_build.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
#!/bin/bash
git_push(){
echo "git push new change of parent pom"
git config --global user.email "[email protected]"
git config --global user.name "hqnghi88"
git config --global push.default simple
git remote rm origin
git remote add origin https://hqnghi88:[email protected]/gama-platform/gama.experimental.git
git add -A
git commit -m "[ci skip] Generate parent and p2 pom"
git push origin HEAD:master
}
generate_parent_pom(){
header=$(<msi.gama.experimental.parent/pom_header.xml)
current_modules=$(<msi.gama.experimental.parent/pom_modules.xml)
footer=$(<msi.gama.experimental.parent/pom_footer.xml)
modules=$'\n'$"<modules>"$'\n'
for file in *; do
if [[ -d "$file" && ! -L "$file" ]]; then
#echo "$file is a directory";
if [[ -f "$file/pom.xml" && "$file" != "msi.gama.experimental.parent" ]]; then
echo "File $file/pom.xml found!"
modules="$modules <module>../$file</module> "$'\n'
fi
fi;
done
modules="$modules </modules>"$'\n'
if [[ "$current_modules" != "$modules" ]]; then
echo "$modules" > msi.gama.experimental.parent/pom_modules.xml
echo "$header $modules $footer"> msi.gama.experimental.parent/pom.xml
fi
}
generate_p2updatesite_category(){
header=$(<msi.gama.experimental.p2updatesite/category_header.xml)
user_cate=$(<msi.gama.experimental.p2updatesite/category_body_user.xml)
current_cate=$(<msi.gama.experimental.p2updatesite/category_body.xml)
footer=$(<msi.gama.experimental.p2updatesite/category_footer.xml)
cate=$'\n'$" "$'\n'
for file in *; do
if [[ -d "$file" && ! -L "$file" ]]; then
isInFile=$( cat msi.gama.experimental.p2updatesite/category_body_user.xml | grep -c ${file})
if [[ -f "$file/pom.xml" && ${file} != *"msi.gama.experimental.parent"* && $isInFile -eq 0 ]]; then
if [[ ${file} == *"feature"* ]]; then
version=$(sed '/<parent>/,/<\/parent>/d;/<version>/!d;s/ *<\/\?version> *//g' "$file/pom.xml")
q=$".qualifier"
version=${version/-SNAPSHOT/$q}
temp="<feature url=\"features/"$file"_$version.jar\" id=\"$file\" version=\"$version\"> <category name=\"gama.optional\"/> </feature>"
temp=$(echo $temp|tr -d '\r')
temp=$(echo $temp|tr -d '\n')
cate="$cate $temp "$'\r'$'\n'
#echo $cate
echo
fi
fi
fi;
done
#echo $cate
if [[ "$current_cate" != "$cate" ]]; then
echo "$cate" > msi.gama.experimental.p2updatesite/category_body.xml
echo "$header $cate $user_cate $footer " > msi.gama.experimental.p2updatesite/category.xml
fi
}
generate_parent_pom
generate_p2updatesite_category
#git_push
cd msi.gama.experimental.parent &&
if [[ $GPG_PASSPHRASE != "" ]]; then
mvn verify -Dgpg.passphrase=$GPG_PASSPHRASE --settings ../settings.xml
fi
mvn clean install -Dtycho.p2.transport.min-cache-minutes=0 -Dtycho.equinox.resolver.uses=true -P p2Repo --settings ../settings.xml &&
cd -