You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr swift install is a command that builds the default execuatble target in release mode, and copy the result somewhere.
The somewhere should default to a fixed location that the user can access (for example, ~/swift/bin). The user can access it directly, or add it to their PATH. This location can be overriden by a envvar, for example, $SWIFTBIN.
Why is this a great idea? Sometimes you don't want to distribute your CLI applications via a public channel such as Homebrew. Maybe it's not meant for others to use, maybe you want to control what version to use by building from source.
Imagine a in-house tool whose source is part of a repository. The tool is meant to be version locked with whatever the repo's git revision is.
A good inspiration can be Cargo (from Rust).
There, we have the same possibilities that were brought here.
Here is the help from cargo install:
➜ cargo install --help
Install a Rust binary
Usage: cargo install [OPTIONS] [CRATE[@<VER>]]...
Arguments:
[CRATE[@<VER>]]... Select the package from the given source
Options:
--version <VERSION> Specify a version to install
--index <INDEX> Registry index to install from
--registry <REGISTRY> Registry to use
--git <URL> Git URL to install the specified crate from
--branch <BRANCH> Branch to use when installing from git
--tag <TAG> Tag to use when installing from git
--rev <SHA> Specific commit to use when installing from git
--path <PATH> Filesystem path to local crate to install from
--root <DIR> Directory to install packages into
-f, --force Force overwriting existing crates or binaries
--no-track Do not save tracking information
--list List all installed packages and their versions
--message-format <FMT> Error format
--debug Build in debug mode (with the 'dev' profile) instead of release mode
-v, --verbose... Use verbose output (-vv very verbose/build.rs output)
-q, --quiet Do not print cargo log messages
--color <WHEN> Coloring: auto, always, never
--config <KEY=VALUE> Override a configuration value
-Z <FLAG> Unstable (nightly-only) flags to Cargo, see 'cargo -Z help'for details
-h, --help Print help
Description
tl;dr
swift install
is a command that builds the default execuatble target in release mode, and copy the result somewhere.The somewhere should default to a fixed location that the user can access (for example,
~/swift/bin
). The user can access it directly, or add it to theirPATH
. This location can be overriden by a envvar, for example,$SWIFTBIN
.Why is this a great idea? Sometimes you don't want to distribute your CLI applications via a public channel such as Homebrew. Maybe it's not meant for others to use, maybe you want to control what version to use by building from source.
Imagine a in-house tool whose source is part of a repository. The tool is meant to be version locked with whatever the repo's git revision is.
How does one build
great-swift-tool
and put it under./tmp/bin
today? Easy:... put that in a shell script or make target and forget it, right?
IMO this is unnecessarily complicated in 2 ways:
.build/release
With the proposed solution, this could be simplified as 1 command:
I think that'd be pretty cool.
(In the future the command can take a git repository with for a SwiftPM project as input:
swift install https://github.com/swiftlang/swift-format
)Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version && uname -a
)No response
The text was updated successfully, but these errors were encountered: