From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!fx10.ams1.POSTED!not-for-mail Subject: Re: Suggestion about best practice with .gpr files Newsgroups: comp.lang.ada References: From: Per Sandberg User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@usenet.se NNTP-Posting-Date: Mon, 31 May 2021 20:14:45 UTC Organization: usenet.se Date: Mon, 31 May 2021 22:14:44 +0200 X-Received-Bytes: 3159 Xref: reader02.eternal-september.org comp.lang.ada:62065 List-Id: Well that's the way I have been doing it for 20+ years with some small twists. GPR_PROJECT_PATH points here: !foolib/ !...| !...+-- foolib.gpr !...+-- src/ !........|foolib.ads !...+-- lib/ !...+-- .obj/ !...+-- test/ !..........| !..........+--foolib-test.gpr !..........+-- .obj/ !..........+-- bin/ !..........+-- src/ !................| !...............+-- foolib-tests-test_1.adb !...............+-- foolib-tests-test_2.adb !...............+-- foolib-tests-test_3.adb !foxlib/ !application1/ !application2/ Then the experience i quite similar to what you get with an "eclipse workspace". But with the capability to a lot of other structural exercises, such as having a baseline ReadOnly workspace and then using GPR_PROJECT_PATH to point first to a private workspace and then the baseline. /Persan On 30/05/2021 19:37, mockturtle wrote: > Dear.all, > I have a problem that I solved in a fairly acceptable way, but I would like to hear from you if there are some kind of "better practices" that I could use. > > The problem is this: sometimes, while writing some software, I develop some packages that could be used elsewhere, so I "extract" them in a library of their own with their own project file that is "with-ed" inside the project file of the larger software. > > When I "isolate" the package into its own library, I like also to add some testing code. The problem is that if I declare the project to be a library project (which is just natural) I cannot have an executable. > > In the past, I solved this problem by declaring the project to be a non-library one; nowadays I declare it to be a library project and then add a folder test/ with its src/ folder with the test programs and a specific project file that "with-s" the library project. > > Let me try drawing a picture relative to a library "foo" > > foolib/ > ...| > ...+-- foolib.gpr > ...+-- src/ > ...+-- obj/ > ...+-- test/ > ..........| > ..........+--foolib_test.gpr > ..........+--obj/ > ..........+--src/ > ................| > ...............+-- foo_test_1.adb > ...............+-- foo_test_2.adb > ...............+-- foo_test_3.adb > > I hope you got the idea. > > Do you have any suggestion about a different organization? Do there exist some kind of "best practice" for this? > > Thank you in advance for your help > > Riccardo >