-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupTBAppWorkspace.sh
executable file
·203 lines (169 loc) · 8.78 KB
/
setupTBAppWorkspace.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/bash
ROOT="$WORKSPACE/Root"
TB_PROJECT_JAR="woproject.jar"
JOB_ROOT="${WORKSPACE}/../.."
FRAMEWORKS_REPOSITORY="${JENKINS_HOME}/TreasureBoatFrameworksRepository"
WONDEREXTENSIONSLABORATORY="TreasureBoatProfessional"
echo "*****************************************************"
echo "Project Name: TreasureBoatProfessional Applications Builder"
echo " TBJenkins/setupTBAppWorkspace.sh"
echo " This ASSUMES that you have built TBProfessional into the WOdka folder"
echo "*****************************************************"
#
# Configure the environment based on the platform information.
#
# Expected uname values:
# Darwin
# Mac OS
# Rhapsody (this is for things like JavaConverter, which need to run on Mac OS X Server 1.2)
# *Windows* (this prints out an error message)
# *winnt* (ditto)
#
# Everything else is treated as "UNIX", the default.
#
PLATFORM_NAME="`uname -s`"
if [ "${PLATFORM_NAME}" = "" ]; then
echo "${SCRIPT_NAME}: Unable to access uname executable! Terminating."
echo "If you are running on Windows, Stop it! This script isn't Windows compatible"
exit 1
fi
case "${PLATFORM_NAME}" in
"Darwin") PLATFORM_DESCRIPTOR="MacOS"
PLATFORM_TYPE="Darwin"
;;
"Mac OS") PLATFORM_DESCRIPTOR="MacOS"
PLATFORM_TYPE="Darwin"
;;
"Rhapsody") PLATFORM_DESCRIPTOR="MacOS"
PLATFORM_TYPE="Rhapsody"
;;
*Windows*) echo "Windows?! Really?!! Shesh. This script only works with MacOS/Linux/UNIX. Terminating."
exit 1
;;
*winnt*) echo "Windows?! Really?!! Shesh. This script only works with MacOS/Linux/UNIX. Terminating."
exit 1
;;
*) PLATFORM_DESCRIPTOR="UNIX"
PLATFORM_TYPE="Other"
;;
esac
echo " Platform Type: ${PLATFORM_TYPE}"
#
# Depending upon the platform, provide default values for the path abstractions
#
if [ "${PLATFORM_TYPE}" = "Rhapsody" ]; then
LOCAL_PATH_PREFIX="/Local"
SYSTEM_PATH_PREFIX="/System"
elif [ "$PLATFORM_TYPE" = "Darwin" ]; then
LOCAL_PATH_PREFIX=""
SYSTEM_PATH_PREFIX="/System"
else
LOCAL_PATH_PREFIX="/Local"
SYSTEM_PATH_PREFIX=""
fi
echo " Local Path Prefix: ${LOCAL_PATH_PREFIX}"
echo " System Path Prefix: ${SYSTEM_PATH_PREFIX}"
WEBOBJECTS_ROOT_IN_FRAMEWORKS_REPOSITORY="${FRAMEWORKS_REPOSITORY}/WebObjects/543${SYSTEM_PATH_PREFIX}"
WO_JAVA_APPS_ROOT_IN_FRAMEWORKS_REPOSITORY="${WEBOBJECTS_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/WebObjects/JavaApplications"
WOTASKD_IN_FRAMEWORKS_REPOSITORY="${WO_JAVA_APPS_ROOT_IN_FRAMEWORKS_REPOSITORY}/wotaskd.woa"
WEBOBJECTS_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY="${WEBOBJECTS_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/Frameworks"
WODKA_ROOT_IN_FRAMEWORKS_REPOSITORY="${FRAMEWORKS_REPOSITORY}/WOdka"
WODKA_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY="${WODKA_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/Frameworks"
WO_SYSTEM_ROOT_FOR_THIS_BUILD="${ROOT}${SYSTEM_PATH_PREFIX}"
WO_SYSTEM_FRAMEWORKS_FOR_THIS_BUILD="${WO_SYSTEM_ROOT_FOR_THIS_BUILD}/Library/Frameworks"
WO_JAVA_APPS_ROOT_FOR_THIS_BUILD="${WO_SYSTEM_ROOT_FOR_THIS_BUILD}/Library/WebObjects/JavaApplications"
WO_BOOTSTRAP_JAR_FOR_THIS_BUILD="${WO_JAVA_APPS_ROOT_FOR_THIS_BUILD}/wotaskd.woa/WOBootstrap.jar"
WO_LOCAL_ROOT_FOR_THIS_BUILD="${ROOT}${LOCAL_PATH_PREFIX}"
WO_LOCAL_FRAMEWORKS_FOR_THIS_BUILD="${WO_LOCAL_ROOT_FOR_THIS_BUILD}/Library/Frameworks"
WO_EXTENSIONS_FOR_THIS_BUILD="${WO_LOCAL_ROOT_FOR_THIS_BUILD}/Library/WebObjects/Extensions"
WO_APPS_ROOT_FOR_THIS_BUILD="${WO_LOCAL_ROOT_FOR_THIS_BUILD}/Library/WebObjects/Applications"
# Make sure the Libraries folder exists
mkdir -p ${WORKSPACE}/Libraries
# Cleanout the Root directory of the project from the last build
rm -rf ${ROOT}
# Look for and link to the WOBootstrap.jar
echo " "
echo "Look for: ${WOTASKD_IN_FRAMEWORKS_REPOSITORY}"
if [ -e "${WOTASKD_IN_FRAMEWORKS_REPOSITORY}" ]; then
mkdir -p ${WO_JAVA_APPS_ROOT_FOR_THIS_BUILD}
echo " Found wotaskd.woa in the Framworks Repository."
echo " Linking: ln -sfn ${WOTASKD_IN_FRAMEWORKS_REPOSITORY}"
echo " ${WO_JAVA_APPS_ROOT_FOR_THIS_BUILD}"
(ln -sfn ${WOTASKD_IN_FRAMEWORKS_REPOSITORY} ${WO_JAVA_APPS_ROOT_FOR_THIS_BUILD})
else
echo " WOBootstrap.jar NOT FOUND!"
echo " This build cannot run without it. Verify that WebObjects has been installed"
echo " with WOJenkins and the WOJenkins installWebObjects.sh script is using"
echo " ${FRAMEWORKS_REPOSITORY}"
echo " for its FRAMEWORKS_REPOSITORY variable."
exit 1
fi
# Link to the Frameworks that are on the classpath of this project.
# (This does not copy the frameworks, it just links to them so it is very fast)
mkdir -p ${WO_EXTENSIONS_FOR_THIS_BUILD}
echo "create symbolic link ${TB_PROJECT_JAR} to ${ROOT}/lib/ so Ant can build the TB project."
echo "mkdir -p ${ROOT}/lib"
mkdir -p ${ROOT}/lib
echo "ln -sfn ${FRAMEWORKS_REPOSITORY}/TBProject/${TB_PROJECT_JAR} ${ROOT}/lib/${TB_PROJECT_JAR}"
ln -sf ${FRAMEWORKS_REPOSITORY}/TBProject/${TB_PROJECT_JAR} ${ROOT}/lib/${TB_PROJECT_JAR}
# Setup Directories for System
echo "mkdir -p ${WO_SYSTEM_ROOT_FOR_THIS_BUILD}/Library."
mkdir -p "${WO_SYSTEM_ROOT_FOR_THIS_BUILD}/Library"
echo "ln -sfn ${WEBOBJECTS_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY} ${WO_SYSTEM_FRAMEWORKS_FOR_THIS_BUILD}"
ln -sfn ${WEBOBJECTS_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY} ${WO_SYSTEM_FRAMEWORKS_FOR_THIS_BUILD}
echo "*** Setup Directories for Local Frameworks ***"
echo "mkdir -p ${WO_LOCAL_FRAMEWORKS_FOR_THIS_BUILD}"
mkdir -p ${WO_LOCAL_FRAMEWORKS_FOR_THIS_BUILD}
# Get all the Projects that have been checked out as part of this job
echo " Get all the Projects that have been checked out as part of this job "
echo "ls ${WODKA_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY}/ into PROJUECTS variable."
PROJECTS=`ls ${WODKA_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY}/`
# Step through all wodka Frameworks and create a link
for PROJECT in $PROJECTS; do
echo "processing ${PROJECT} :"
echo " Linking: ln -sfn ${WODKA_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY}/${PROJECT}"
echo " ${WO_LOCAL_FRAMEWORKS_FOR_THIS_BUILD}"
ln -sfn ${WODKA_FRAMEWORKS_IN_FRAMEWORKS_REPOSITORY}/${PROJECT} ${WO_LOCAL_FRAMEWORKS_FOR_THIS_BUILD}
done
# Create Template Folder (WOFrameworksRepository/WOdka/Library/Templates)
echo "create and copy Compiler Templates for App's"
mkdir -p ${WORKSPACE}/${WONDEREXTENSIONSLABORATORY}/WOdkaTemplates/Templates
cp ${WODKA_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/Templates/common-framework.xml ${WORKSPACE}/${WONDEREXTENSIONSLABORATORY}/WOdkaTemplates/Templates/common-framework.xml
cp ${WODKA_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/Templates/common-app.xml ${WORKSPACE}/${WONDEREXTENSIONSLABORATORY}/WOdkaTemplates/Templates/common-app.xml
echo "create symbolic link ln -sfn ${WODKA_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/Templates/${TB_PROJECT_JAR} ${WORKSPACE}/${WONDEREXTENSIONSLABORATORY}/WOdkaTemplates/Templates/${TB_PROJECT_JAR} "
ln -sfn ${WODKA_ROOT_IN_FRAMEWORKS_REPOSITORY}/Library/Templates/${TB_PROJECT_JAR} ${WORKSPACE}/${WONDEREXTENSIONSLABORATORY}/WOdkaTemplates/Templates/${TB_PROJECT_JAR}
echo "Setup ${ROOT}/jenkins.build.properties for Ant to use for building"
cat > ${ROOT}/jenkins.build.properties << END
# DO NOT EDIT THIS FILE!!!
#
# This file was dynamically generated by
# ${WORKSPACE}/TBJenkins/setupTBAppWorkspace.sh, which was created by TBJenkins
# based on values defined in the "${JOB_NAME}" Jenkins job and will be overwritten the next time
# the job is run.
#
# Changes to the job can be made by opening ${JOB_URL}/configure in a web browser.
wo.system.root=${WO_SYSTEM_ROOT_FOR_THIS_BUILD}
wo.system.frameworks=${WO_SYSTEM_FRAMEWORKS_FOR_THIS_BUILD}
wo.local.root=${WO_LOCAL_ROOT_FOR_THIS_BUILD}
wo.local.frameworks=${WO_LOCAL_FRAMEWORKS_FOR_THIS_BUILD}
wo.extensions=${WO_EXTENSIONS_FOR_THIS_BUILD}
wo.bootstrapjar=${WO_BOOTSTRAP_JAR_FOR_THIS_BUILD}
wo.apps.root=${WO_APPS_ROOT_FOR_THIS_BUILD}
wolips.properties=${ROOT}/jenkins.build.properties
ant.build.javac.target=${JAVA_COMPATIBILITY_VERSION}
END
if [ "$BUILD_TYPE" == "Test Build" ]; then
cat ${ROOT}/jenkins.build.properties > ${ROOT}/jenkins.build.properties.temp1
cat > ${ROOT}/jenkins.build.properties.temp2 << END
embed.Local=false
embed.Project=false
embed.System=false
embed.Network=false
END
cat ${ROOT}/jenkins.build.properties.temp1 ${ROOT}/jenkins.build.properties.temp2 > ${ROOT}/jenkins.build.properties
rm ${ROOT}/jenkins.build.properties.*
fi
# Backward Compatibility!
echo "Create link for backward compatibility with old build.properties file name since old build jobs will still be pointing to it."
echo "ln -sfn ${ROOT}/jenkins.build.properties ${ROOT}/build.properties"
(ln -sfn ${ROOT}/jenkins.build.properties ${ROOT}/build.properties)