-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild
More file actions
executable file
·56 lines (45 loc) · 1.14 KB
/
Copy pathbuild
File metadata and controls
executable file
·56 lines (45 loc) · 1.14 KB
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
#!/usr/bin/env bash
set -eo pipefail
shopt -s expand_aliases
layers_dir=$1
plan_path=$3
# shellcheck source=/dev/null
. generate-project.sh "${layers_dir}"
# shellcheck source=/dev/null
. generate-layers.sh "${layers_dir}"
generate_deps_layer build-deps
generate_deps_layer run-deps
# 2. install go
generate_stack_layer java "${plan_path}" true
# shellcheck source=/dev/null
. init-stack
# 3. MAKE CACHE LAYER, RUN BUILD
# 1. GET ARGS
bp_dir=$(
cd "$(dirname "$0")"/..
pwd
)
build_choice="maven"
if [ -f mvnw ] && [ -f gradlew ]; then
if [[ -f .build-choice ]]; then
build_choice=$(tr <.build-choice -d '[:space:]')
fi
elif [ -f mvnw ]; then
build_choice="maven"
elif [ -f gradlew ]; then
build_choice="gradle"
fi
target_layer_dir="${layers_dir}/target"
mkdir -p "${target_layer_dir}"/profile.d
if [ "${build_choice}" == "maven" ]; then
"$bp_dir/lib/maven_build" "${layers_dir}" "${target_layer_dir}"
elif [ "${build_choice}" == "gradle" ]; then
"$bp_dir/lib/gradle_build" "${layers_dir}" "${target_layer_dir}"
fi
cat >"${target_layer_dir}.toml" <<EOL
[types]
cache = false
build = true
launch = true
EOL
generate-launch.sh "${layers_dir}"