|
1 | 1 | #!/bin/bash
|
| 2 | +# |
| 3 | +# Copyright (c) 2002-2020, Rice University. |
| 4 | +# See the file edu.rice.cs.hpcviewer.ui/License.txt for details. |
| 5 | +# |
| 6 | +# Build hpcviewer and generate tar or zip files |
| 7 | +# This script is only for Unix and X windows. |
| 8 | +# |
2 | 9 |
|
| 10 | +if ! command -v mvn &> /dev/null |
| 11 | +then |
| 12 | + echo "Maven mvn command is not found" |
| 13 | + echo "Please install Apache maven" |
| 14 | + exit |
| 15 | +fi |
| 16 | + |
| 17 | +# |
| 18 | +# Update the release file |
| 19 | +# |
3 | 20 | GITC=`git rev-parse --short HEAD`
|
4 | 21 | release=`date +"%Y.%m.%d"`
|
5 | 22 |
|
6 | 23 | echo "Release ${release}. Commit $GITC" > edu.rice.cs.hpcviewer.ui/release.txt
|
7 | 24 |
|
| 25 | +# |
| 26 | +# build the viewer |
| 27 | +# |
| 28 | +echo "==================================" |
| 29 | +echo " Building the viewer" |
| 30 | +echo "==================================" |
8 | 31 | mvn clean package
|
9 |
| -platform=`uname -m` |
10 |
| -prefix="linux.gtk" |
11 |
| -extension="tgz" |
12 | 32 |
|
13 |
| -os=`uname` |
| 33 | +# The result should be: |
| 34 | +# |
| 35 | +# Building tar: edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-linux.gtk.x86_64.tar.gz |
| 36 | +# Building tar: edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-linux.gtk.ppc64le.tar.gz |
| 37 | +# Building zip: edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-win32.win32.x86_64.zip |
| 38 | +# Building zip: edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-macosx.cocoa.x86_64.zip |
14 | 39 |
|
15 |
| -if [ "$os" == "Darwin" ]; then |
16 |
| - prefix="macosx.cocoa" |
17 |
| - extension="zip" |
18 |
| -fi |
| 40 | +echo "==================================" |
| 41 | +echo " Repackaging the viewer" |
| 42 | +echo "==================================" |
19 | 43 |
|
20 |
| -package=`ls edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-${prefix}.${platform}*` |
| 44 | +# wrap the generated files into standard hpcviewer product |
| 45 | +# |
21 | 46 |
|
22 |
| -if [ -e "$package" ]; then |
23 |
| - echo "package: $package" |
24 |
| -else |
25 |
| - echo "package ${package} not found" |
26 |
| - exit |
27 |
| -fi |
| 47 | +# repackage |
| 48 | +repackage_linux(){ |
| 49 | + prefix=$1 |
| 50 | + platform=$2 |
| 51 | + package=`ls edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-${prefix}.${platform}*` |
| 52 | + extension="tgz" |
| 53 | + |
| 54 | + [[ -z $package ]] && { echo "$package doesn't exist"; exit 1; } |
| 55 | + |
| 56 | + mkdir -p tmp/hpcviewer |
| 57 | + cd tmp/hpcviewer |
| 58 | + |
| 59 | + tar xzf ../../$package |
| 60 | + cp ../../scripts/* . |
| 61 | + |
| 62 | + cd .. |
| 63 | + |
| 64 | + output="hpcviewer-${release}-${prefix}.${platform}.$extension" |
| 65 | + tar czf ../$output hpcviewer/ |
| 66 | + |
| 67 | + cd .. |
| 68 | + ls -l $output |
| 69 | + rm -rf tmp |
| 70 | +} |
28 | 71 |
|
29 |
| -mkdir -p tmp/hpcviewer |
30 |
| -cd tmp/hpcviewer |
| 72 | +repackage_nonLinux(){ |
| 73 | + input=$1 |
| 74 | + output=$2 |
31 | 75 |
|
32 |
| -tar xzf ../../$package |
33 |
| -cp ../../scripts/* . |
| 76 | + [[ -z $input ]] && { echo "$input doesn't exist"; exit 1; } |
34 | 77 |
|
35 |
| -cd .. |
| 78 | + cp $input $output |
| 79 | + ls -l $output |
| 80 | +} |
36 | 81 |
|
37 |
| -output="hpcviewer-${release}-${prefix}.${platform}.$extension" |
| 82 | +# repackage linux files |
| 83 | +repackage_linux linux.gtk x86_64 |
| 84 | +repackage_linux linux.gtk ppc64le |
38 | 85 |
|
39 |
| -tar czf ../$output hpcviewer/ |
| 86 | +# copy and rename mac file |
| 87 | +output="hpcviewer-${release}-win32.win32.x86_64.zip" |
| 88 | +input=edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-win32.win32.x86_64.zip |
| 89 | +repackage_nonLinux $input $output |
40 | 90 |
|
41 |
| -cd .. |
| 91 | +# copy and rename windows file |
| 92 | +output="hpcviewer-${release}-macosx.cocoa.x86_64.zip" |
| 93 | +input=edu.rice.cs.hpcviewer.product/target/products/edu.rice.cs.hpcviewer-macosx.cocoa.x86_64.zip |
| 94 | +cp $input $output |
42 | 95 |
|
43 |
| -ls -l $output |
| 96 | +echo "==================================" |
| 97 | +echo " Done" |
| 98 | +echo "==================================" |
44 | 99 |
|
45 |
| -rm -rf tmp |
|
0 commit comments