axodotdev / cargo-dist

📦 shippable application packaging
https://axodotdev.github.io/cargo-dist/
Apache License 2.0
1.47k stars 66 forks source link

Packages with no binaries + publish = false + dist = false are still built #1117

Closed arlyon closed 3 months ago

arlyon commented 3 months ago

Hi! I am setting up cargo-dist for use in my repo (https://github.com/arlyon/litehouse) but have hit an issue. I have libraries that are only intended to be bundled as wasm packages that are still included in the build when running cargo dist build, despite the repo only having a single binary.

I would expect from this section in the documentation that 'each Package that doesn't define binaries is wholly irrelevant and ignored' but that doesn't seem to be the case. As of right now it looks like if you have a single package that cannot be built on your target platform, the entire build fails despite it being irrelevant to the package you are actually trying to bundle.

See this build for the example: https://github.com/arlyon/litehouse/actions/runs/9428238688/job/25973328621. None of the plugins should be included but since they are, and a few of them can't build on this target, it fails. In this commit I added publish = false and dist = false since I thought that perhaps because they are cdylibs they might be included but no dice https://github.com/arlyon/litehouse/commit/001e464f231cfcfd6765bf0b865281921fef4b3a

I think I am able to work around it for now, but worth bringing to your attention anyways.

Thanks for this otherwise excellent tool! Cheers

Alex

arlyon commented 3 months ago

I think we can fix this in my particular case by not doing a workspace build iff there is only one package. That seems to be a general win for everyone regardless of workspace structure. We also need a setting to be able to opt out of a workspace build if you do have packages that cannot be built.

Gankra commented 3 months ago

I believe you want precise-builds = true, which also documents why we default like we do.

arlyon commented 3 months ago

Thanks for this, and your timely responses. All the best, Alex