-
Notifications
You must be signed in to change notification settings - Fork 26
/
package.sh
executable file
·180 lines (143 loc) · 4.72 KB
/
package.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
# Use this file to build all the packages about ISA-Tools
# More details in the POM.
#
# usage:
# ./package.sh <PACKAGE_TYPE>
#
# The possible values for <PACKAGE_TYPE> are (use them without the quotes):
# - 'scidata': to build a package of ISAcreator including the Scientific Data ISA-Tab configurations
# - 'mixs': to build a package of ISAcreator including the MIXS ISA-Tab configurations
# - 'miacme': to build a package of ISAcreator including the MIACME ISA-Tab configurations
# - 'all': to build a package of ISAcreator including the default ISA-Tab configurations
#
# If no <PACKAGE_TYPE> parameter is passed, the default value 'all' will be used.
#
# e.g. ./package.sh scidata
#
PACKAGE_TYPE=$1
echo "ISAcreator packaging for type " $PACKAGE_TYPE
MIXS_DATASETS=mixs-datasets-v2.zip
if [ "$PACKAGE_TYPE" = "" ]
then
PACKAGE_TYPE="all"
fi
#MVNOPTS="--offline"
get_tag_data () {
local tag=$1
local xml_file=$2
# Find tag in the xml, convert tabs to spaces, remove leading spaces, remove the tag.
grep $tag $xml_file | \
tr '\011' '\040' | \
sed -e 's/^[ ]*//' \
-e 's/^<.*>\([^<].*\)<.*>$/\1/'
}
ALLVERSIONS=`get_tag_data \<version\> pom.xml 2>/dev/null`
VERSIONSPLIT=(`echo $ALLVERSIONS | tr ' ' ' '`)
# get first version number referenced. Should always be the version of the project, since it's always the first
VERSION=${VERSIONSPLIT[0]}
if [ "$VERSION" = "" ]
then
echo "Couldn't extract version from pom.xml. Exiting."
exit 1
fi
rm -rf src/main/resources/Configurations
mkdir src/main/resources/Configurations
if [ "$PACKAGE_TYPE" = "scidata" ]
then
CONFIGURATION=isaconfig-Scientific-Data-v1.2.zip
else
if [ "$PACKAGE_TYPE" = "mixs" ]
then
CONFIGURATION=isaconfig-mixs-v4.zip
else
if [ "$PACKAGE_TYPE" = "miacme" ]
then
CONFIGURATION=isaconfig-MIACMEv0.3-multiassay-20180725.zip
else
CONFIGURATION=isaconfig-default_v2015-07-02.zip
fi
fi
fi
echo "Configuration file: " $CONFIGURATION
if hash curl 2>/dev/null; then
echo "curl is installed, will download configurations next"
else
echo "curl is not installed, install it and then run package.sh again"
exit 1
fi
if [ "$PACKAGE_TYPE" = "miacme" ]
then
curl -L -O https://bitbucket.org/agbeltran/isatools-downloads/downloads/"$CONFIGURATION"
else
curl -L -O http://bitbucket.org/eamonnmag/isatools-downloads/downloads/"$CONFIGURATION"
fi
mkdir Configurations
cp $CONFIGURATION
cd Configurations
unzip $CONFIGURATION
rm -f $CONFIGURATION
cd ..
#back to project folder
cp $CONFIGURATION src/main/resources/Configurations/
#project folder
WD=$(pwd)
pwd
cd src/main/resources/Configurations/
unzip $CONFIGURATION
rm -f $CONFIGURATION
pwd
cd $WD
echo "Changing back to project folder..."
pwd
###installing xalan dependency
mvn dependency:get -Dartifact=xalan:xalan:2.4.0
mvn install:install-file -Dfile="$HOME/.m2/repository/xalan/xalan/2.4.0/xalan-2.4.0.jar" -DgroupId=xalan -DartifactId=xalan -Dversion=2.4 -Dpackaging=jar
##Building ISAcreator
mvn $MVNOPTS -Dmaven.test.skip=true clean assembly:assembly -Pbuild
if [ "$?" -ne 0 ]; then
echo "Maven Build Unsuccessful!"
exit 1
fi
mkdir target/Configurations
cp $CONFIGURATION target/Configurations/
rm -f $CONFIGURATION
cd target/Configurations/
unzip $CONFIGURATION
rm -f $CONFIGURATION
cd ..
#in target folder
ISATAB_FOLDER = "isatab files"
# Now package up the tools
mkdir "$ISATAB_FOLDER"
if [ "$PACKAGE_TYPE" = "scidata" ]
then
cd "$ISATAB_FOLDER"
curl -L -O https://bitbucket.org/eamonnmag/isatools-downloads/downloads/SciData-Datasets-1-and-2.zip
unzip SciData-Datasets-1-and-2.zip
rm -f SciData-Datasets-1-and-2.zip
cd ../
fi
if [ "$PACKAGE_TYPE" = "mixs" ]
then
cd "$ISATAB_FOLDER"
curl -L -O https://bitbucket.org/eamonnmag/isatools-downloads/downloads/$MIXS_DATASETS
unzip $MIXS_DATASETS
rm -f $MIXS_DATASETS
cd ../
else
cp -r ../src/test/resources/test-data/ ./"$ISATAB_FOLDER"
fi
pwd
zip --exclude .DS_STORE -r ISAcreator-$VERSION-$PACKAGE_TYPE.zip Configurations ../ProgramData "$ISATAB_FOLDER"
mv ISAcreator-$VERSION-jar-with-dependencies.jar ISAcreator.jar
zip -u ISAcreator-$VERSION-$PACKAGE_TYPE.zip ISAcreator.jar
python ../bundler.py
echo "Packaging completed successfully!"
# Creates the folder we then package up as a DMG.
mkdir ISAcreator-$VERSION-dmg-folder/
mkdir ISAcreator-$VERSION-dmg-folder/ISAcreator-$VERSION
mv ISAcreator.app ISAcreator-$VERSION-dmg-folder/ISAcreator-$VERSION
cp -r ../src/main/resources/Configurations ISAcreator-$VERSION-dmg-folder/ISAcreator-$VERSION
cp -r ../ProgramData ISAcreator-$VERSION-dmg-folder/ISAcreator-$VERSION
cp -r "$ISATAB_FOLDER" ISAcreator-$VERSION-dmg-folder/ISAcreator-$VERSION