@@ -17,13 +17,14 @@ LIFT_TARGET="empty"
1717# sbt command files targeting different Lift versions, see respective files for more information.
1818PUBLISH_25_SBT_COMMAND_FILE=${PWD} /project/autobuildscript/build-publish-Lift25.txt
1919PUBLISH_26_SBT_COMMAND_FILE=${PWD} /project/autobuildscript/build-publish-Lift26.txt
20- PUBLISH_30_SBT_COMMAND_FILE=${PWD} /project/autobuildscript/build-publish-Lift3.txt
20+ PUBLISH_30_SBT_COMMAND_FILE=${PWD} /project/autobuildscript/build-publish-Lift30.txt
21+ PUBLISH_31_SBT_COMMAND_FILE=${PWD} /project/autobuildscript/build-publish-Lift31.txt
2122# default location's for java on a ubuntu system
2223JAVA_6_PATH=/usr/lib/jvm/java-6-oracle/jre/bin/java
2324JAVA_7_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
2425JAVA_8_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
2526LOG_FILE=build.log
26-
27+
2728while getopts t: opts; do
2829 case ${opts} in
2930 t) LIFT_TARGET=${OPTARG} ;;
@@ -38,93 +39,107 @@ function die {
3839
3940# If $DO_DEBUG=0 then echo provided information
4041function debug {
41- if [[ $DO_DEBUG == 0 ]]; then
42+ if [[ $DO_DEBUG == 0 ]]; then
4243 echo -e $@
4344 else
4445 echo -n " "
4546 fi
4647}
4748
4849# Validation: Check if provided path is the current set java path.
49- # This function only works on a ubuntu system.
50+ # This function only works on a ubuntu system.
5051function currentJavaPathIsSetTo() {
5152 local lsalPart=$1
52- curr_java_path=$( ls -al /etc/alternatives/java)
53- if [[ $curr_java_path == * ${lsalPart} * ]]; then
54- return 0
55- else
56- return 1
57- fi
53+ curr_java_path=$( ls -al /etc/alternatives/java)
54+ if [[ $curr_java_path == * ${lsalPart} * ]]; then
55+ return 0
56+ else
57+ return 1
58+ fi
5859}
5960
60- # This function has the effect of, if needed, trying to set the required java path
61+ # This function has the effect of, if needed, trying to set the required java path
6162# The function will return 0 if the required java version is or has been successfully set.
6263function requiredJavaIsSuccessfullySet() {
6364 local javaPath=$1
64- if ! currentJavaPathIsSetTo $javaPath ; then
65- setJDKEnvironment $javaPath
65+ if ! currentJavaPathIsSetTo $javaPath ; then
66+ setJDKEnvironment $javaPath
6667 fi
67- if currentJavaPathIsSetTo $javaPath ; then
68+ if currentJavaPathIsSetTo $javaPath ; then
6869 return 0
6970 else
7071 return 1
71- fi
72+ fi
7273}
7374
7475# This function sets the JDK environment in a ubuntu system.
7576function setJDKEnvironment() {
7677 local javaPath=$1
7778 debug " Need to switching JDK version "
78- sudo update-alternatives --set java $javaPath
79- }
79+ sudo update-alternatives --set java $javaPath
80+ }
81+
8082
81-
8283# Execute the necessary steps for publishing a Lift 2.5 module build
8384function do25Publish {
8485 debug " \nTarget is set to Lift v2.5, require java-6" ;
85- if ! requiredJavaIsSuccessfullySet $JAVA_6_PATH ; then
86+ if ! requiredJavaIsSuccessfullySet $JAVA_6_PATH ; then
8687 die " java-6 dosen't seem to be present, cancelling release build!"
8788 fi
88- debug " Current java environment is java-6"
89- debug " \n***Start processing the sbt command file.***\n"
89+ debug " Current java environment is java-6"
90+ debug " \n***Start processing the sbt command file.***\n"
9091 sbt < $PUBLISH_25_SBT_COMMAND_FILE 2>&1 | tee ${LOG_FILE}
91- debug " \n***...done processing the sbt command file***\n"
92+ debug " \n***...done processing the sbt command file***\n"
9293}
9394
9495# Execute the necessary steps for publishing a Lift 2.6 module build
9596function do26Publish {
9697 debug " \nTarget is set to Lift v2.6, require java-6" ;
97- if ! requiredJavaIsSuccessfullySet $JAVA_6_PATH ; then
98+ if ! requiredJavaIsSuccessfullySet $JAVA_6_PATH ; then
9899 die " java-6 dosen't seem to be present, cancelling release build!"
99- fi
100- debug " Current java environment is java-6"
101- debug " \n***Start processing the sbt command file.***\n"
100+ fi
101+ debug " Current java environment is java-6"
102+ debug " \n***Start processing the sbt command file.***\n"
102103 sbt < $PUBLISH_26_SBT_COMMAND_FILE 2>&1 | tee ${LOG_FILE}
103- debug " \n***...done processing the sbt command file***\n"
104+ debug " \n***...done processing the sbt command file***\n"
104105}
105106
106107# Execute the necessary steps for publishing a Lift 3.0 module build
107108function do30Publish {
108109 debug " \nTarget is set to Lift v3.0, require java-8" ;
109- if ! requiredJavaIsSuccessfullySet $JAVA_8_PATH ; then
110+ if ! requiredJavaIsSuccessfullySet $JAVA_8_PATH ; then
110111 die " java-8 dosen't seem to be present, cancelling release build!"
111- fi
112- debug " Current java environment is java-8\n"
113- debug " \n***Start processing the sbt command file.***\n"
114- sbt < $PUBLISH_30_SBT_COMMAND_FILE 2>&1 | tee ${LOG_FILE}
115- debug " \n***...done processing the sbt command file***\n"
112+ fi
113+ debug " Current java environment is java-8\n"
114+ debug " \n***Start processing the sbt command file.***\n"
115+ sbt < $PUBLISH_30_SBT_COMMAND_FILE 2>&1 | tee ${LOG_FILE}
116+ debug " \n***...done processing the sbt command file***\n"
117+ }
118+
119+ # Execute the necessary steps for publishing a Lift 3.1 module build
120+ function do31Publish {
121+ debug " \nTarget is set to Lift v3.1, require java-8" ;
122+ if ! requiredJavaIsSuccessfullySet $JAVA_8_PATH ; then
123+ die " java-8 dosen't seem to be present, cancelling release build!"
124+ fi
125+ debug " Current java environment is java-8\n"
126+ debug " \n***Start processing the sbt command file.***\n"
127+ sbt < $PUBLISH_31_SBT_COMMAND_FILE 2>&1 | tee ${LOG_FILE}
128+ debug " \n***...done processing the sbt command file***\n"
116129}
117130
118131function runMain {
119132 if [ $LIFT_TARGET == " 2.5" ]; then {
120133 do25Publish
121- } elif [ $LIFT_TARGET == " 2.6" ]; then {
122- do26Publish
123- } elif [ $LIFT_TARGET == " 3.0" ]; then {
134+ } elif [ $LIFT_TARGET == " 2.6" ]; then {
135+ do26Publish
136+ } elif [ $LIFT_TARGET == " 3.0" ]; then {
124137 do30Publish
125- } else
138+ } elif [ $LIFT_TARGET == " 3.1" ]; then {
139+ do31Publish
140+ } else
126141 echo -e " \nNo target set! You need to specify a Lift version as target.\nUsage ./project/autobuildscript/publish.sh -t [2.5,2.6,3.0]\n" ;
127142 fi
128143}
129144
130- runMain
145+ runMain
0 commit comments