alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
288 stars 49 forks source link

Alire builds crate that is not available on current OS #769

Closed onox closed 2 years ago

onox commented 3 years ago

My orka_egl crate's alire.toml file contains:

[available.'case(os)']
linux = true
'...' = false

Yet, it happily runs alr build on windows-latest (with ce2021 compiler) during GitHub Actions. It compiles with no errors, but then fails with ld.exe: cannot find -lEGL (which is why the crate is not available on windows).

Shouldn't alr just do nothing if available.'case(os)' says it's not available?

mosteo commented 3 years ago

Hi onox. Crates are usually properly skipped when they're unavailable in a OS. Do you have a GHA run where I can check more details?

onox commented 3 years ago

This is the GHA run with the problem: https://github.com/onox/orka/runs/2975156460?check_suite_focus=true

mosteo commented 3 years ago

Alright, I understand. I was for some reason thinking that this was happening in our crate tests for the index.

Indeed you're right that we should at least show a warning or recoverable error in this case. Although the crate is unavailable, since the user is commanding the build I guess we should do something and not merely silently succeed doing nothing. It is counterintuitive to me that a build is commanded (even if by mistake) and we silently return success while not attempting the build.

So what about:

onox commented 3 years ago

--skip-unavailable would work for me.

Would it help to only allow it to be used for the current crate and not for any dependencies that happen to be unavailable? If you command crate A to build, but it has a dependency B that is unavailable for some reason, crate A's alire.toml file should simply not depend on B in that case.

mosteo commented 3 years ago

I was thinking only about the root crate, for the reason you state.