Skip to content

shards build in release/production mode #363

@Darwinnn

Description

@Darwinnn

If we look at the shards --help output, it says that we can pas <options> to the build argument:

build [<targets>] [<options>]  - Build the specified <targets> in `bin` path.

The options (that are defined in the same help output) are:

Options:
    --no-color                       Disable colored output.
    --version                        Print the `shards` version.
    --production                     Run in release mode. No development dependencies and strict sync between shard.yml and shard.lock.
    --local                          Don't update remote repositories, use the local cache only.
    -v, --verbose                    Increase the log verbosity, printing all debug statements.
    -q, --quiet                      Decrease the log verbosity, printing only warnings and errors.
    -h, --help                       Print usage synopsis.

It doesn't say that the build options aren't the ones that are specified in the shards --help output, so I assumed (and I'm sure many would fall in the same hole) that shard build --production would get me a release ready binary file, but it doesn't, because the correct option for that is --release and --production is never actually passed to crystal build internally.

So, my suggestions are either:

  1. Explicitly specify that the <options> in the build arg belong to crystal build options and not to shards options.
    or
  2. Pass --production arg to crystal build arguments (but of course, as --release).
    or
  3. Remove the ability to build source code thru shards (since it's just a dep manager) and advise to always use crystal build instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions