diff options
| author | mo khan <mo.khan@gmail.com> | 2020-06-05 15:12:56 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-06-05 15:12:56 -0600 |
| commit | 55d3e5288826e21286054ed7cbaaec15e037f1dd (patch) | |
| tree | f853dc1c8601fb4222908f2ce8d4e03880367db3 /run.sh | |
| parent | 2c93d56d5b4d296e00e9007497aa465c2418a8b6 (diff) | |
Extract function to prepare java and python
Diffstat (limited to 'run.sh')
| -rwxr-xr-x | run.sh | 39 |
1 files changed, 23 insertions, 16 deletions
@@ -65,6 +65,26 @@ function prepare_dotnet() { [[ $(ls ./*.sln 2> /dev/null) ]] && RECURSIVE="--recursive" } +function prepare_java() { + if [ -n "$LM_JAVA_VERSION" ]; then + switch_to java "adopt-openjdk-${LM_JAVA_VERSION}" + elif [ -n "$ASDF_JAVA_VERSION" ]; then + switch_to_exact java "$ASDF_JAVA_VERSION" + else + switch_to java "adopt-openjdk-8" + fi +} + +function prepare_python() { + if [ -n "$LM_PYTHON_VERSION" ]; then + switch_to python "$(major_version_from "$LM_PYTHON_VERSION")" + elif [ -n "$ASDF_PYTHON_VERSION" ]; then + switch_to_exact python "$ASDF_PYTHON_VERSION" + else + switch_to python "3" + fi +} + function prepare_tools() { if ! asdf current 2> >(grep -q 'is not installed'); then echo "Installing missing tools…" @@ -73,6 +93,9 @@ function prepare_tools() { } function prepare_project() { + prepare_java + prepare_python + if [[ -z ${SETUP_CMD:-} ]]; then prepare_tools || true prepare_dotnet || true @@ -84,22 +107,6 @@ function prepare_project() { fi } -if [ -n "$LM_JAVA_VERSION" ]; then - switch_to java "adopt-openjdk-${LM_JAVA_VERSION}" -elif [ -n "$ASDF_JAVA_VERSION" ]; then - switch_to_exact java "$ASDF_JAVA_VERSION" -else - switch_to java "adopt-openjdk-8" -fi - -if [ -n "$LM_PYTHON_VERSION" ]; then - switch_to python "$(major_version_from "$LM_PYTHON_VERSION")" -elif [ -n "$ASDF_PYTHON_VERSION" ]; then - switch_to_exact python "$ASDF_PYTHON_VERSION" -else - switch_to python "3" -fi - prepare_project [[ $CI_DEBUG_TRACE == 'true' ]] && debug_env |
