From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d084d53a77fc8e59,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!news.swapon.de!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: GPR: project hierarchy and file names Date: Thu, 19 Aug 2010 05:23:47 +0200 Organization: Ada At Home Message-ID: NNTP-Posting-Host: Fm6yFlaQ123yo2ThPIeWHA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.61 (Win32) Xref: g2news1.google.com comp.lang.ada:13498 Date: 2010-08-19T05:23:47+02:00 List-Id: I wanted to attempt to try something seducing to me: using project = hierarchy matching packages hierarchy, but with tricky part, as much = seducing to me, which is to use only to inner package name as the file = name. Let me explain, and just imagine there are more files than the following= = example shows. Let Application Models Models.Object1 Models.Object2 Views Views.Object1 Views.Object2 be some package. The common way to name these would be (just to give spe= c = file names, would be the same for body) application.ads models.ads models-object1.ads models-object2.ads views.ads views-object1.ads views-object2.ads The seducing idea I wanted to attempt is the following. Have a directory hierarchy like this application models views each ones holding their packages, just with shorten file names (using on= ly = the inner name) application |- application.ads | +- models | |- object1.ads | |- object2.ads | +- views |- object1.ads |- object2.ads then, for each, a project file application |- application.gpr |- application.ads | +- models | |- models.gpr | |- object1.ads | |- object2.ads | +- views |- views.gpr |- object1.ads |- object2.ads (the real case hierarchy ranges from 1 to 4 levels) I followed this step: * Created the directory hierarchy * Dispatched files to directories depending on their position in the packages hierarchy * Renamed files to remove the package hierarchy path prefix and just keep the proper package name for file names (obviously, the source style says =E2=80=9Cpackage Parent.Child is=E2=80=9D for an example) * Created the GPR project files files with a simple =E2=80=9Cfor Source_Dirs use (".");=E2=80=9D * Added a With clause for the parent project in each child project (like =E2=80=9Cwith "../application.gpr";=E2= =80=9D in both models.gpr and views.gpr) * Added a Limited With clause for each subproject in parent projects (there is only one in the example: =E2=80=9Climited with "models/models.gpr";=E2=80=9D and =E2=80=9Climited with "views/views.gpr";=E2=80=9D in application.gpr); This was looking fine for me except it seems I got clashes. Let go to th= e = GNAT documentation a moment. http://www.adacore.com/wp-content/files/auto_update/gnat-unw-docs/html/g= nat_ugn_12.html#SEC132 It says, about the project manager: << One very important aspect of a project hierarchy is that a given source can only belong to one project (otherwise the project manager would not know which settings apply to it and when to recompile it). It means that different project files do not usual= ly share source directories or when they do, they need to specify precisely which project owns which sources using attribute Source_Fi= les or equivalent. By contrast, 2 projects can each own a source with th= e same base file name as long as they live in different directories. >> When it says that a given source must only belongs to a single project, = if = does not mention directly or indirectly nor it does mention With vs = Limited With. At least, when a project A import a project B which import= s = a project C, then files of C can be used in both A and B. So I suppose I= = have to understand =E2=80=9Csource can only directly belong to one proje= ct=E2=80=9D. And = it days two projects can own files with same base name, as long are they= = are not in the same directory (obvious). So the above should be OK, but it fails. When I open any project in a similar hierarchy, I got tons of = red-highlighted message from GPS, which talks about units which can belo= ng = to only one project. It seems to be related to base file name, as if I (= in = the context of the above example) rename object1.ads so that they both = have a different name in the Views and Models directories, there is no = more error message about object1 unit. Well, this kind of organization is not formally required, this is just I= = feel it nice, and it is ever possible to make it successed (or something= = similar), I would like to use this one (would ease view of sibling = hierarchies dependencies, as well as handy in GPS and in any GUI file = system explorer). Is this layout or similar, feasible with GPR project files or it is a = totally excluded idea ? Note: I wanted to try to use gnatname and Naming package (in GPR files),= = but this does allow directories, it works only with base names.