First Alire steps - where the heck is the source code?

I’m doing my first steps with Alire following the docs.
I downloaded hello and called alr run successfully. But:
Looking into src: Where the heck is the source code? This is hello.adb:

with Libhello;
procedure Hello is
begin
   Libhello.Hello_World;
end Hello;

There is no Libhello anywhere!

Libhello is a dependency:

image
(from alire.toml)

Alire works by bringing in different libraries as dependencies and storing them on the system; for example, if I need the Ada Web Server, I can run alr with aws

This will bring in the ada web server library and all of its dependencies:

Most of the time the source code for that library isn’t going to be in the project folder, but cached somewhere on your computer, probably ~/.local/share/alire/builds
(in older versions of alire it would be in the .alire folder in the project directory)

If you have vscode with the Ada Language server, it’ll load those files into the IDE:

At which point you can view it by right-clicking the function “Go to implementation”

You may also be able to do that in gnat studio.

I hope this helps!

PS: The alire docs are more concerned with making sure that alr is working, as in, it’s grabbing a project, dependencies, and running. If you’re interested in further configuring it for your editor or using it to build your own hello world, check out the docs on ada-lang.io, specifically:

For getting alire configured and

For building your first ada program.

8 Likes

Thank you for your answer - I found the source code.
I have not yet an idea how I can add the location to GPS.
When I find time, I’ll read the docs.

I use VSCode with the Ada Language Server extension, as it works best for me on MacOS, but as long as you’re launching your project using alr edit then it should show up in GNAT Studio too at least in the file tree:

If I right-click the procedure, I also get the pop-up in gps but it’s a bit bugged on MacOS so clicking it doesn’t work for me. It may work for you:

2 Likes