-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-snapshot.sh
85 lines (77 loc) · 2.29 KB
/
build-snapshot.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
function usage() {
echo "Usage: $(basename $0) <eclipseDirectory> <archiveFile>"
echo ""
echo "where:"
echo " <eclipseDirectory> is the path to an Eclipse install containing SAFARI"
echo " <archiveFile> is an archive file to be created by this script"
}
getArgs() {
while [[ $# -gt 0 ]]; do
if [[ "$1" = "--help" || "$1" = "-h" ]]; then
usage
exit 0
elif [[ "$1" = -* ]]; then
echo "Invalid option: $1, or missing argument"
usage
exit 1
elif [[ -z "$eclipseDir" ]]; then
eclipseDir="$1"
elif [[ -z "$archiveFile" ]]; then
archiveFile="$1"
else
echo "Invalid argument: $1"
usage
exit 1
fi
shift
done
}
setDefaults() {
eclipseDir=""
archiveFile=""
extraFeatures="lpg.runtime polyglot"
featureNames="org.eclipse.imp.lpg org.eclipse.imp.runtime org.eclipse.imp"
# TODO read feature manifests to determine set of plugins
pluginNames="com.ibm.wala.shrike org.eclipse.imp.cheatsheets org.eclipse.imp.xform org.eclipse.imp.smapi org.eclipse.imp.smapifier lpg.runtime org.eclipse.imp.analysis org.eclipse.imp.lpg.runtime org.eclipse.imp.lpg org.eclipse.imp.runtime org.eclipse.imp.runtime org.eclipse.imp org.eclipse.imp.lpg polyglot"
}
checkSettings() {
echo "Eclipse directory is $eclipseDir"
echo "Archiving to $archiveFile"
if [[ -z "${eclipseDir}" || ! -r ${eclipseDir}/eclipse.ini ]]; then
echo "Error: need an eclipse installation directory"
usage
exit 1
fi
if [[ -z "$archiveFile" ]]; then
usage
exit 1
fi
}
collectInfo() {
echo "Collecting features to snapshot..."
for featureName in ${featureNames} ${extraFeatures}; do
newestFeature=$(ls -1td features/${featureName}* | head -1)
featureList="${featureList} ${newestFeature}"
done
echo "Collecting plugins to snapshot..."
for pluginName in ${pluginNames}; do
newestPlugin=$(ls -1td plugins/${pluginName}* | head -1)
pluginList="${pluginList} ${newestPlugin}"
done
}
buildSnapshot() {
cd ${eclipseDir}
collectInfo
echo "Building snapshot..."
tar czf ${archiveFile} ${featureList} ${pluginList}
echo "Done."
}
main() {
setDefaults
getArgs "$@"
checkSettings
buildSnapshot
}
main "$@"
exit 0