diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-04 16:33:12 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-04 16:33:12 -0700 |
| commit | b821ddaa71e6999518c3379f916f26fa1fd1bc13 (patch) | |
| tree | 8b42278587d1438406fd71ee3e5aeab5d4b074d4 | |
| parent | df5c2cebd4bd4c3c526a33fcd0991aaba165250f (diff) | |
Switch python/java version in run.sh
| -rw-r--r-- | config/.bashrc | 25 | ||||
| -rwxr-xr-x | run.sh | 139 |
2 files changed, 81 insertions, 83 deletions
diff --git a/config/.bashrc b/config/.bashrc index f9eed24..466fbee 100644 --- a/config/.bashrc +++ b/config/.bashrc @@ -1,17 +1,5 @@ #!/bin/bash -BUNDLE_JOBS="$(nproc)" -export BUNDLE_JOBS -export BUNDLE_PATH="vendor/bundle" -export BUNDLE_WITHOUT="development test" -export DOTNET_CLI_TELEMETRY_OPTOUT=1 -export HISTFILESIZE=0 -export HISTSIZE=0 -export RUBY_GC_HEAP_INIT_SLOTS=800000 -export RUBY_GC_MALLOC_LIMIT=79000000 -export RUBY_HEAP_FREE_MIN=100000 -export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 -export RUBY_HEAP_SLOTS_INCREMENT=400000 alias nuget='mono /usr/local/bin/nuget.exe' function inflate() { @@ -51,16 +39,3 @@ inflate /usr/share/dotnet.tar.zst /usr/share while IFS= read -r line; do asdf global "$line" done < "$HOME/.tool-versions" - -if [ -n "$LM_PYTHON_VERSION" ]; then - MAJOR_VERSION=$(echo "$LM_PYTHON_VERSION" | cut -d'.' -f1) - switch_to python "$MAJOR_VERSION" - python --version - pip --version - export LICENSE_FINDER_PYTHON_VERSION="--python-version=$MAJOR_VERSION" -fi - -switch_to java "adopt-openjdk-${LM_JAVA_VERSION:-8}" -# shellcheck source=/dev/null -. "$ASDF_DATA_DIR/plugins/java/set-java-home.sh" -env | sort @@ -2,70 +2,93 @@ set -e -function scan_project() { - APP_PATH=$1 - cd "$APP_PATH" +BUNDLE_JOBS="$(nproc)" +export BUNDLE_JOBS +export BUNDLE_PATH="vendor/bundle" +export BUNDLE_WITHOUT="development test" +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export HISTFILESIZE=0 +export HISTSIZE=0 +export RUBY_GC_HEAP_INIT_SLOTS=800000 +export RUBY_GC_MALLOC_LIMIT=79000000 +export RUBY_HEAP_FREE_MIN=100000 +export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 +export RUBY_HEAP_SLOTS_INCREMENT=400000 - asdf list - asdf current - if [[ -z "${SETUP_CMD}" ]]; then - asdf install - if test -f package.json; then - if [ -f package-lock.json ] && [ ! -f yarn.lock ] ; then - echo "Installing npm packages with npm ci" - npm ci - fi - if [ ! -d node_modules ]; then - echo "Installing yarn packages" - yarn install --ignore-engines --ignore-scripts - fi - skip_prepare=true - fi - if find . -name "*.go" -printf "found" -quit | grep found > /dev/null; then - if [[ ( ! -f glide.lock ) && ( ! -f vendor/manifest ) && (! -f Gopkg.lock ) && (! -f go.mod ) ]]; then - # Only install deps if not using glide, govendor or dep - # Symlink the project into GOPATH to allow fetching dependencies. - ln -sf "$(realpath "$APP_PATH")" /gopath/src/app - pushd /gopath/src/app > /dev/null - go get || true - skip_prepare=true - fi +if [ -n "$LM_PYTHON_VERSION" ]; then + MAJOR_VERSION=$(echo "$LM_PYTHON_VERSION" | cut -d'.' -f1) + switch_to python "$MAJOR_VERSION" + python --version + pip --version + export LICENSE_FINDER_PYTHON_VERSION="--python-version=$MAJOR_VERSION" +fi + +switch_to java "adopt-openjdk-${LM_JAVA_VERSION:-8}" +# shellcheck source=/dev/null +. "$ASDF_DATA_DIR/plugins/java/set-java-home.sh" + +env | sort +APP_PATH=$2 +cd "$APP_PATH" + +asdf list +asdf current + +if [[ -z "${SETUP_CMD}" ]]; then + asdf install + if test -f package.json; then + if [ -f package-lock.json ] && [ ! -f yarn.lock ] ; then + echo "Installing npm packages with npm ci" + npm ci fi - if [ -f pom.xml ]; then - mvn install "${MAVEN_CLI_OPTS:--DskipTests}" - skip_prepare=true + if [ ! -d node_modules ]; then + echo "Installing yarn packages" + yarn install --ignore-engines --ignore-scripts fi - if [ -f build.gradle ] && [ ! -f gradlew ] ; then - gradle build "${GRADLE_CLI_OPTS:"-x test"}" + skip_prepare=true + fi + if find . -name "*.go" -printf "found" -quit | grep found > /dev/null; then + if [[ ( ! -f glide.lock ) && ( ! -f vendor/manifest ) && (! -f Gopkg.lock ) && (! -f go.mod ) ]]; then + # Only install deps if not using glide, govendor or dep + # Symlink the project into GOPATH to allow fetching dependencies. + ln -sf "$(realpath "$APP_PATH")" /gopath/src/app + pushd /gopath/src/app > /dev/null + go get || true skip_prepare=true fi - if [[ $(ls ./*.sln 2> /dev/null) ]]; then - LICENSE_FINDER_CLI_OPTS="--recursive=true $LICENSE_FINDER_CLI_OPTS" - fi - else - echo "Running '${SETUP_CMD}' to install project dependencies..." - "${SETUP_CMD[@]}" + fi + if [ -f pom.xml ]; then + mvn install "${MAVEN_CLI_OPTS:--DskipTests}" skip_prepare=true fi - - echo "Running license_finder in $PWD" - if [ "$skip_prepare" != true ]; then - prepare="--prepare-no-fail" - else - prepare="--no-prepare" + if [ -f build.gradle ] && [ ! -f gradlew ] ; then + gradle build "${GRADLE_CLI_OPTS:"-x test"}" + skip_prepare=true + fi + if [[ $(ls ./*.sln 2> /dev/null) ]]; then + LICENSE_FINDER_CLI_OPTS="--recursive=true $LICENSE_FINDER_CLI_OPTS" fi - ruby -v - gem --version - bundle --version - gem install "$LM_HOME/*.gem" - license_management ignored_groups add development - license_management ignored_groups add test - echo "Preparing JSON report..." - LICENSE_FINDER_CLI_OPTS=${LICENSE_FINDER_CLI_OPTS:-'--no-quiet'} - LICENSE_FINDER_PYTHON_VERSION=${LICENSE_FINDER_PYTHON_VERSION:-'--python-version=3'} - options=("${prepare}" '--format=json' '--save=gl-license-management-report.json' "${LICENSE_FINDER_PYTHON_VERSION}" "${LICENSE_FINDER_CLI_OPTS}") - echo license_management report "${options[@]}" - license_management report "${options[@]}" -} +else + echo "Running '${SETUP_CMD}' to install project dependencies..." + "${SETUP_CMD[@]}" + skip_prepare=true +fi -scan_project "$2" +echo "Running license_finder in $PWD" +if [ "$skip_prepare" != true ]; then + prepare="--prepare-no-fail" +else + prepare="--no-prepare" +fi +ruby -v +gem --version +bundle --version +gem install "$LM_HOME/*.gem" +license_management ignored_groups add development +license_management ignored_groups add test +echo "Preparing JSON report..." +LICENSE_FINDER_CLI_OPTS=${LICENSE_FINDER_CLI_OPTS:-'--no-quiet'} +LICENSE_FINDER_PYTHON_VERSION=${LICENSE_FINDER_PYTHON_VERSION:-'--python-version=3'} +options=("${prepare}" '--format=json' '--save=gl-license-management-report.json' "${LICENSE_FINDER_PYTHON_VERSION}" "${LICENSE_FINDER_CLI_OPTS}") +echo license_management report "${options[@]}" +license_management report "${options[@]}" |
