Giter Site home page Giter Site logo

Comments (6)

Gankra avatar Gankra commented on June 9, 2024

The current support for binaries with requires features is for you to use features/all-features/default-features in workspace.metadata.dist/package.metadata.dist (same syntax as cargo dependencies): https://opensource.axo.dev/cargo-dist/book/reference/config.html#features

from cargo-dist.

Gankra avatar Gankra commented on June 9, 2024

Also to be clear here, required-features is a Cargo feature that can only disable a binary being built. It sadly does not tell Cargo "hey if I try to build this binary, flip on these features". I misunderstood it so the comments I made in that issue are unhelpful.😿

from cargo-dist.

Gankra avatar Gankra commented on June 9, 2024

(We could read required-features config and flip on features by default but I'm a bit skittish about confusing things happening if we do that automagically.)

from cargo-dist.

LDeakin avatar LDeakin commented on June 9, 2024

Also to be clear here, required-features is a Cargo feature that can only disable a binary being built. It sadly does not tell Cargo "hey if I try to build this binary, flip on these features"

Yes precisely, this is a mechanism to disable including a binary. If the binary feature is not part of the default features, I would expect cargo-dist to not try and package it.

We could read required-features config and flip on features by default

Definitely not, cargo dist should respect the features requested.

from cargo-dist.

Gankra avatar Gankra commented on June 9, 2024

Yes precisely, this is a mechanism to disable including a binary. If the binary feature is not part of the default features, I would expect cargo-dist to not try and package it.

Oh I see you want cargo-dist to auto-hide binaries that lack sufficient features. That's... interesting. My impulse is that cargo-dist should definitely error if you require features and it's not specified. I would however be inclined to still require you to manually opt them out of cargo-dist (basically making you say the same thing twice either way to make sure you understand what you're saying, since required-features causes a ton of confusion).

INTERESTING

from cargo-dist.

LDeakin avatar LDeakin commented on June 9, 2024

My impulse is that cargo-dist should definitely error if you require features and it's not specified

I'm not sure if developers would be surprised if a binary isn't packaged if its required features are not enabled, because that would be analogous to the behaviour of cargo itself.

If you are really concerned about it, perhaps a parameter could be added to cargo-dist like:

[workspace.metadata.dist]
# Targets with required-features are not packaged if their features are not enabled.
skip_disabled_targets = true

Though this seems like a hurdle to me. Because if it is false, cargo dist requires that all targets must be packaged and any required features required must be manually specified (the current behaviour).

from cargo-dist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.