Revision 7d01792d

b/make-dist.sh
18 18
    exit 1
19 19
}
20 20

  
21
checkdist() {
22
    [ -e $DIST ] && {
23
        echo Folder $DIST exists. Removing it.
24
        rm -rf "$DIST"
25
        echo
26
    }
27
    echo Creating dist dirs
21
removedist() {
22
  if [ -e $DIST ]; then
23
    echo Folder $DIST exists. Removing it.
24
    rm -rf "$DIST"
25
  fi
26
}
27

  
28
createdist() {
29
  echo
30
  echo Creating dist dirs
28 31

  
29
    mkdir -pv $DIST
30
    mkdir -pv $DIST/bin
31
    mkdir -pv $DIST/lib
32
    mkdir -pv $DIST/conf
33
    mkdir -pv $DIST/logs
32
  mkdir -pv $DIST
33
  mkdir -pv $DIST/bin
34
  mkdir -pv $DIST/lib
35
  mkdir -pv $DIST/conf
36
  mkdir -pv $DIST/logs
34 37
}
35 38

  
36 39
clean() {
37
    local p="$ARG1"
38
    if [ -z "$p" ]; then
39
      echo
40
      echo "==============================="
41
      echo "=== mvn clean ================="
42
      echo "==============================="
43
      echo
44
      mvn clean || fail "cleaning compilation artifacts"
45
      echo
46
    elif [ "$p"="dev" -o "$p"="fast" -o "$p"="noclean" ]; then
47
      echo
48
      echo "==============================="
49
      echo "=== NOT executing mvn clean ==="
50
      echo "==============================="
51
      echo
52
    fi
40
  local p="$ARG1"
41
  if [ -z "$p" ]; then
42
    echo
43
    echo "==============================="
44
    echo "=== mvn clean ================="
45
    echo "==============================="
46
    echo
47
    mvn clean || fail "cleaning compilation artifacts"
48
    echo
49
  elif [ "$p"="dev" -o "$p"="fast" -o "$p"="noclean" ]; then
50
    echo
51
    echo "==============================="
52
    echo "=== NOT executing mvn clean ==="
53
    echo "==============================="
54
    echo
55
  fi
53 56
}
54 57

  
55 58
collectdeps() {
56
    mvn dependency:copy-dependencies && cp target/dependency/*.jar $DIST/lib || fail "collecting dependencies"
59
  mvn dependency:copy-dependencies && cp target/dependency/*.jar $DIST/lib || fail "collecting dependencies"
57 60
}
58 61

  
59 62
build() {
63
  echo
64
  echo "==============================="
65
  echo "=== mvn package ==============="
66
  echo "==============================="
67
  echo
68
  mvn package -DskipTests && {
60 69
    echo
61
    echo "==============================="
62
    echo "=== mvn package ==============="
63
    echo "==============================="
64
    echo
65
    mvn package -DskipTests && {
66
        echo "Copying Aquarium classes"
67
        aquariumjar=`find target -type f|egrep "aquarium-[0-9\.]+(-SNAPSHOT)?\.jar"`
68
        cp $aquariumjar $DIST/lib || fail "copying $aquariumjar"
69
    } || fail "building"
70
    echo "Copying Aquarium classes"
71
    aquariumjar=`find target -type f|egrep "aquarium-[0-9\.]+(-SNAPSHOT)?\.jar"`
72
    cp $aquariumjar $DIST/lib || fail "copying $aquariumjar"
73
  } || fail "building"
70 74
}
71 75

  
72 76
collectconf() {
73
    echo
74
    echo Copying config files from $CONF_SRC
75
    echo
76
    cp $CONF_SRC/log4j.properties $DIST/conf|| fail "copying log4j.properties"
77
    cp $CONF_SRC/aquarium.properties $DIST/conf || fail "copying aquarium.properties"
78
    cp $CONF_SRC/policy.yaml $DIST/conf || fail "copying policy.yaml"
79
    cp $CONF_SRC/roles-agreements.map $DIST/conf || fail "copying roles-agreements.map"
77
  echo
78
  echo Copying config files from $CONF_SRC
79
  echo
80
  cp $CONF_SRC/log4j.properties $DIST/conf|| fail "copying log4j.properties"
81
  cp $CONF_SRC/aquarium.properties $DIST/conf || fail "copying aquarium.properties"
82
  cp $CONF_SRC/policy.yaml $DIST/conf || fail "copying policy.yaml"
83
  cp $CONF_SRC/roles-agreements.map $DIST/conf || fail "copying roles-agreements.map"
80 84
}
81 85

  
82 86
collectscripts() {
83
    echo
84
    echo Copying scripts from $SERVER_SCRIPTS_SRC
85
    echo
86
    cp $SERVER_SCRIPTS_SRC/aquarium.sh $DIST/bin || fail "copying aquarium.sh"
87
    cp $SERVER_SCRIPTS_SRC/test.sh $DIST/bin || fail "copying test.sh"
87
  echo
88
  echo Copying scripts from $SERVER_SCRIPTS_SRC
89
  echo
90
  cp $SERVER_SCRIPTS_SRC/aquarium.sh $DIST/bin || fail "copying aquarium.sh"
91
  cp $SERVER_SCRIPTS_SRC/test.sh $DIST/bin || fail "copying test.sh"
88 92
}
89 93

  
90 94
gitmark() {
91
    echo $SHAFULL > $DIST/gitsha.txt
95
  echo $SHAFULL > $DIST/gitsha.txt
92 96
}
93 97

  
94 98
archive() {
95
    ARC=$DIST.tar.gz
96
    echo "Creating archive"
97
    tar zcvf $ARC $DIST/ || fail "creating archive"
98
    echo "File $ARC created succesfully"
99
    echo "Cleaning up"
100
    ls -al $ARC
99
  ARC=$DIST.tar.gz
100
  echo
101
  echo "Creating archive"
102
  tar zcvf $ARC $DIST/ || fail "creating archive"
103
  echo "File $ARC created succesfully"
104
  echo "Cleaning up"
105
  ls -al $ARC
101 106
}
102 107

  
103
checkdist      && \
108
removedist     && \
109
createdist     && \
104 110
clean          && \
105 111
build          && \
106 112
collectdeps    && \
107 113
collectconf    && \
108 114
collectscripts && \
109 115
gitmark        && \
110
archive
116
archive        && \
117
removedist

Also available in: Unified diff