|
|
@@ -3,6 +3,7 @@
|
|
3
|
3
|
TRACK=java
|
|
4
|
4
|
TRACK_REPO="$TRACK"
|
|
5
|
5
|
TRACK_SRC_EXT="java"
|
|
|
6
|
+CPU_CORES=`getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`
|
|
6
|
7
|
|
|
7
|
8
|
on_exit() {
|
|
8
|
9
|
echo ">>> on_exit()"
|
|
|
@@ -96,6 +97,14 @@ get_cpu_architecture() {
|
|
96
|
97
|
esac
|
|
97
|
98
|
}
|
|
98
|
99
|
|
|
|
100
|
+get_optimal_amount_of_jobs() {
|
|
|
101
|
+ if [ "$CPU_CORES" -gt "1" ]; then
|
|
|
102
|
+ echo $((CPU_CORES-1))
|
|
|
103
|
+ else
|
|
|
104
|
+ echo 1
|
|
|
105
|
+ fi
|
|
|
106
|
+}
|
|
|
107
|
+
|
|
99
|
108
|
download_exercism_cli() {
|
|
100
|
109
|
local os="$1"
|
|
101
|
110
|
local arch="$2"
|
|
|
@@ -162,7 +171,7 @@ make_local_trackler() {
|
|
162
|
171
|
cp -r ${track_root}/exercises tracks/${TRACK}
|
|
163
|
172
|
|
|
164
|
173
|
gem install bundler
|
|
165
|
|
- bundle install
|
|
|
174
|
+ bundle install --jobs $(get_optimal_amount_of_jobs)
|
|
166
|
175
|
gem build trackler.gemspec
|
|
167
|
176
|
|
|
168
|
177
|
# Make *this* the gem that x-api uses when we build x-api.
|
|
|
@@ -179,7 +188,7 @@ start_x_api() {
|
|
179
|
188
|
pushd $xapi_home
|
|
180
|
189
|
|
|
181
|
190
|
gem install bundler
|
|
182
|
|
- bundle install
|
|
|
191
|
+ bundle install --jobs $(get_optimal_amount_of_jobs)
|
|
183
|
192
|
RACK_ENV=development rackup &
|
|
184
|
193
|
xapi_pid=$!
|
|
185
|
194
|
sleep 5
|
|
|
@@ -267,18 +276,24 @@ main() {
|
|
267
|
276
|
|
|
268
|
277
|
clean "${build_dir}"
|
|
269
|
278
|
|
|
270
|
|
- # Make a local version of trackler that includes the source from this repo.
|
|
271
|
|
- git_clone "x-api" "${xapi_home}"
|
|
272
|
|
- git_clone "trackler" "${trackler_home}"
|
|
273
|
|
- assert_ruby_installed "${trackler_home}"
|
|
|
279
|
+ # Download everything we need in parallel
|
|
|
280
|
+ git_clone "x-api" "${xapi_home}" &
|
|
|
281
|
+ git_clone "trackler" "${trackler_home}" &
|
|
|
282
|
+ download_exercism_cli $(get_operating_system) $(get_cpu_architecture) "${exercism_home}" &
|
|
|
283
|
+ wait
|
|
|
284
|
+
|
|
|
285
|
+ # Check and install the ruby stuff we need in parallel
|
|
|
286
|
+ assert_ruby_installed "${trackler_home}" &
|
|
|
287
|
+ assert_ruby_installed "${xapi_home}" &
|
|
|
288
|
+ wait
|
|
|
289
|
+
|
|
|
290
|
+ # Make a local version of trackler
|
|
274
|
291
|
make_local_trackler "${trackler_home}" "${xapi_home}"
|
|
275
|
292
|
|
|
276
|
|
- # Stand-up a local instance of x-api so we can fetch the exercises through it.
|
|
277
|
|
- assert_ruby_installed "${xapi_home}"
|
|
|
293
|
+ # Start-up a local instance of x-api so we can fetch the exercises through it.
|
|
278
|
294
|
start_x_api "${xapi_home}"
|
|
279
|
295
|
|
|
280
|
296
|
# Create a CLI install and config just for this build; this script does not use your CLI install.
|
|
281
|
|
- download_exercism_cli $(get_operating_system) $(get_cpu_architecture) "${exercism_home}"
|
|
282
|
297
|
configure_exercism_cli "${exercism_home}" "${exercism_configfile}" "${xapi_port}"
|
|
283
|
298
|
|
|
284
|
299
|
solve_all_exercises "${exercism_home}" "${exercism_configfile}"
|