bazelbuild / bazelbuild/bazelisk

Universal shell scripts to run baselisk

Open
#84 3 comments 12 reactions 0 assignees View on GitHub
P3 type: feature request
Dominant language
Go
Stars
2.7k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

What do you think about having files with native shell scripts like [gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) have? Somthing like this:

```bash
#!/usr/bin/env sh

##############################################################################
##
## Bazel start up script for UN*X (based on gradlew script from gradle wrapper project)
##
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="bazelisk"
APP_BASE_NAME=`basename "$0"`

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

## Determine OS.
darwin=false
linux=false

case "`uname`" in
Darwin* )
darwin=true
;;
Linux* )
linux=true
;;
esac

BINARY_PATH=""
if $darwin; then
BINARY_PATH=bazelisk-darwin-amd64
elif $linux; then
BINARY_PATH=bazelisk-linux-amd64
else
die "UNSUPPORTED OS! Command 'uname' says: `uname`. 'darwin' = $darwin and 'linux' = $linux"
fi

exec "$APP_HOME/bazelisk/$BINARY_PATH" "$@"
```

while having bazelisk binaries inside VCS repo?

Contributor guide

Open the contributing guide

Research direction

Start with the proposed Unix shell script and the linked Gradle wrapper documentation. Compare that approach with Bazelisk’s launcher and binary layout. Done means the project has a settled scope for native shell launchers and for how the Bazelisk binaries are kept in or obtained from version control.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.