How to organize an Ada project in directories?

How to download two packages with the same name, but in separate folders?

Example:

/src/alpha/foopackage.ads /src/beta/foopackage.ads 

Then I would like to use foopackages using:

 with alpha.foopackage; with beta.foopackage; 

Also, if you have other tips for organizing projects in Ada, please write. Information about the organization of the project in Ada is not available on the network.

+4
source share
2 answers

You have already solved the problem!

src / alpha / foopackage.ads contains:

 package alpha.foopackage is ... end alpha.foopackage; 

while src / beta / foopackage.ads contains:

 package beta.foopackage is ... end beta.foopackage; 

You will now run into a temporary problem if you use GNAT and the default naming convention. This naming convention requires the files to be named alpha-foopackage.ads and beta-foopackage.ads, respectively.

If you insist on using foopackage.ads as file names, this convention can be bypassed. With a mosquito, see Handling Arbitrary File Naming with gnatname , Using Other File Names or Alternative File Naming Schemes .

+4
source

This is almost a duplicate of the question that led to this answer .

However, is there another naming issue that GNAT (I think you use GNAT?) Has a default file naming convention (there are ways to override this convention, but you need a good mind to worry about).

So, your source files, no matter what directory you want to place in them, should be named alpha-foopackage.ads and beta-foopackage.ads respectively.

+4
source

Source: https://habr.com/ru/post/1480345/


All Articles