Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tarballing is hard to add to projects #1

Open
epage opened this issue Feb 17, 2018 · 3 comments
Open

Tarballing is hard to add to projects #1

epage opened this issue Feb 17, 2018 · 3 comments

Comments

@epage
Copy link
Contributor

epage commented Feb 17, 2018

I'm starting to work on https://github.com/crate-ci/example-bin but finding teaching this annoying.

From the shell scripts, we have no idea what the crate name is, the bin name, or the target. The last is the most invasive for people get working.

Proposal

stager

Create a crate for staging files for tarballs or package managers

  • struct
    • source glob
      • Support templating (like {{ target_dir }}
        • What variables matter?
        • Should expressions be supported?
    • dest dir
      • Support templating?
        • What variables matter?
    • rename?
      • What variables matter?
      • Should expressions be supported?
    • permissions?

cargo-tarball

The source is a Cargo.toml like:

[[metadata.tarball.my_bin]]
bin=true
rustflags="-C lto"

[metadata.tarball.my_bin.content]
"{{ target_dir}}/my_bin.bash" = "completions"
"*.md" = "docs"
  • metadata.tarball.my_bin: Is the name to use when wanting to build a specific tarball (cargo tarball mybin).
    • default is what will be built of nothing is named on the command line
    • This allows different configurations for different platforms, creating tarballs of subsets of your binaries, etc
  • bin=true: This is short hand for build all bins
    • bin="bin_name" would build and include a specific one
    • bin=["bin1, "bin2"] will build and include a group of them
  • metadata.tarball.my_bin.content: this table is for adding additional files
    • "{{ target_dir}}/my_bin.bash" = "completions": This uses a variable to find completions and put them in a directory
    • "*.md" = "docs": This uses globs to grab all documentation in the root
    • These are using short hands. "*.md" = "docs" expands to ``"*.md" = { dest= "docs" }.
@epage
Copy link
Contributor Author

epage commented Apr 8, 2018

Started stager

Other relevant crate work

@kornelski
Copy link

kornelski commented Apr 21, 2018

I make a tarball and a zip with Mac and Windows binaries + Linux packages together:

  • README
  • LICENSE
  • win/
    • app.exe
  • linux/
    • app.deb
  • mac/
    • app

This is important for me, because I can have a single "Download" link on a static website and it works for everyone.

So I'm afraid that's a bit too much to explain to Cargo using TOML syntax, and in general I can't imagine one run of cargo being able to compile and package for 3 platforms at once (and I still haven't managed to even set up cross-compilation).

I do like how npm allows running arbitrary scripts with npm run script-name where script-name is defined in package.json, so I can stuff my build steps there.

@epage
Copy link
Contributor Author

epage commented Apr 21, 2018

I make a tarball and a zip with Mac and Windows binaries + Linux packages together:
This is important for me, because I can have a single "Download" link on a static website and it works for everyone.

I'm assuming this approach is a minority case and from that, I think I'm going to say its outside of the scope of being handled by this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants