Skip to content

Commit

Permalink
Merge pull request #112 from brson/next
Browse files Browse the repository at this point in the history
V2 manifests
  • Loading branch information
brson committed Mar 8, 2016
2 parents 90d5fff + b3da396 commit 6ec590e
Show file tree
Hide file tree
Showing 8 changed files with 2,425 additions and 1,081 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*~
dist/
build/
tmp/
tmp-v1/
tmp-v2/
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi

sh src/rust-installer/gen-installer.sh \
--product-name=multirust \
--package-name=multirust-0.7.0 \
--package-name=multirust-0.8.0 \
--rel-manifest-dir=rustlib \
--success-message=Get-ready-for-Maximum-Rust. \
--image-dir=./build/image \
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

installer=build/work/multirust-0.7.0/install.sh
installer=build/work/multirust-0.8.0/install.sh

if [ ! -e "$installer" ]; then
echo 'run ./build.sh first'
Expand Down
77 changes: 76 additions & 1 deletion src/multirust
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# list-toolchains List all installed toolchains
# remove-override Remove an override, for current directory unless specified
# remove-toolchain Uninstall a toolchain
# list-available-targets
# List targets available to install
# add-target Add additional compilation targets to an existing toolchain
# run Run a command in an environment configured for a toolchain
# delete-data Delete all user metadata, including installed toolchains
# upgrade-data Upgrade the ~/.multirust directory from previous versions
Expand Down Expand Up @@ -190,6 +193,25 @@
#
# </help-remove-toolchain>

# <help-list-available-targets>
#
# List the targets available to an installed toolchain
#
# Usage:
# multirust add-target <toolchain>
#
# </help-list-available-targets>

# <help-add-target>
#
# Adds the standard library for a given platform to an existing
# installation.
#
# Usage:
# multirust add-target <toolchain> <triple>
#
# </help-add-target>

# <help-run>
#
# Usage: multirust run <toolchain> <command> [arguments]
Expand Down Expand Up @@ -266,7 +288,7 @@ set_globals() {
assert_nz "$0" "\$0 is undefined"

# Some constants
version=0.7.0
version=0.8.0
# NB: This will be replaced by the build script
commit_version=
metadata_version=2
Expand Down Expand Up @@ -445,6 +467,7 @@ handle_command_line_args() {
list-toolchains
remove-override
remove-toolchain
list-available-toolchains
run
upgrade-data
delete-data
Expand Down Expand Up @@ -539,6 +562,23 @@ handle_command_line_args() {
remove_toolchain "$2"
;;

list-available-targets)
if [ -z "${2-}" ]; then
err 'unspecified toolchain. try `multirust help list-available-targets`'
fi
list_available_targets "$2"
;;

add-target)
if [ -z "${2-}" ]; then
err 'unspecified toolchain. try `multirust help add-target`'
fi
if [ -z "${3-}" ]; then
err 'unspecified target. try `multirust help add-target`'
fi
add_target "$2" "$3"
;;

run)
if [ -z "${2-}" ]; then
err 'unspecified toolchain. try `multirust help run`'
Expand Down Expand Up @@ -901,6 +941,41 @@ get_toolchain_dir() {
RETVAL="$toolchains_dir/$_toolchain"
}

list_available_targets() {
local _toolchain="$1"

get_toolchain_dir "$_toolchain"
local _dir="$RETVAL"

if [ ! -e "$_dir" ]; then
err "toolchain '$_toolchain' is not installed"
exit 1
fi

call_rustup --prefix="$_dir" --list-available-targets
if [ $? != 0 ]; then
exit 1
fi
}

add_target() {
local _toolchain="$1"
local _target="$2"

get_toolchain_dir "$_toolchain"
local _dir="$RETVAL"

if [ ! -e "$_dir" ]; then
err "toolchain '$_toolchain' is not installed"
exit 1
fi

call_rustup --prefix="$_dir" --add-target="$_target"
if [ $? != 0 ]; then
exit 1
fi
}


# Custom toolchain installation

Expand Down
2 changes: 1 addition & 1 deletion src/rustup
Loading

0 comments on commit 6ec590e

Please sign in to comment.