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

How to locally solve dependency before checking index? #1393

Closed Heziode closed 1 year ago

Heziode commented 1 year ago

I trying to create the Alire package for AdaControl, but AdaControl depends on ASIS. I know that ASIS is available on the Alire Index, but I want to use the local installed (in the installation directory of GNAT, like /usr/gnat/share/gpr) if exists, notably for GNATPro users that have a more up to date version (fixed) version of ASIS.

How can I do this?

If I attempt to use a pins, this will fails the resolution if the user does not have ASIS on the correct path, and if I only use asis = "*" in depends-on, then it will find it in the Alire index.

Fabien-Chouteau commented 1 year ago

I think the best way is probably not to have asis in the alire.toml dependencies. gprbuild will pick the one installed.

Heziode commented 1 year ago

Ok, I see. So I will just add a note into the description to inform users to have ASIS somewhere.

Or maybe adding a post-fetch to made a alr with asis if asis.gpr is not found in GPR_PROJECT_PATH?

mosteo commented 1 year ago

The ASIS in the Alire index is I think not usable right now since its corresponding compiler isn't available.

The way to go is as Fabien says, and rely on the environment compiler + asis.

If there's a way to detect the asis in the environment (I don't know its details), we could likely add an external definition, and then it would make more sense to have asis as an explicit dependency of your crate. As of now, you'll gain nothing by explicitly having a dependency on asis.