[Emacs-ada-mode] Using GNAT Project (*.gpr) files with Ada Mode

deadlyhead deadlyhead at deadlyhead.com
Fri Aug 15 03:00:58 PDT 2008


Stephen Leake wrote:
>> A subject that's been spoken of before is the use of GNAT project files 
>> in Ada Mode. 
>>     
>
> This is supported in the current Emacs Ada mode;
> http://stephe-leake.org/emacs/ada-mode/ada-mode.html#Project-files 
>
> This will be in the Emacs 22.3 release.
>   
So, let me get this straight.  Rather than using a *.adp file, and 
simply using -Psome_file.gpr with gnatmake, Ada Mode will now allow GNAT 
Project files to be used?  Y'know, I thought I'd read that, but I 
must've skipped over it when re-reading the documentation. This is 
exactly what I'm hoping for.
>> Users of our packages can't be expected to build them with Emacs Ada
>> Mode (as nice as it is), 
>>     
>
> I'm not clear what you are talking about here; what functionality is
> missing?
>   
It's not that functionality is missing.  The issue that I have is that 
it's unreasonable to require users to use Emacs to compile an Ada 
program that I wrote.  Ideally, the user would be familiar with GNAT and 
its toolchain, so having them type `gnatmake -Pproject_name.gpr' should 
be a no-brainer.  More likely, though, the user would like to use the 
`configure make make install' method because its standard.  This can, of 
course, be used with GNAT pretty easily as all the configure script is 
is a preprocessor for the Makefiles, which are wrappers for the GNAT 
toolchain.

Requiring Emacs in that toolchain makes things a bit trickier.  I 
suppose that one could call Emacs non-interactively from a Makefile, 
invoking the commands in Ada Mode to compile the package, but this seems 
to add an unnecessary level. The fact that Ada Mode uses its own form of 
project files means that as I'm developing in Emacs, I am maintaining 
*.adp files for my own benefit. However, for distribution I have to 
maintain another set of project files, *.gpr files, for the users' 
benefit.  Either that, or have the user build my package with Emacs.  Or 
compile, run and debug outside of Emacs when I'm developing.  Any of 
these are scenarios are a burden to somebody, one way or another.

Of course, if I can just tell Ada Mode that my projects are defined 
using *.gpr files and GNAT Project syntax with all the bells and 
whistles, I only have to maintain one set of files for myself as well as 
for the users. That's a pretty significant benefit, whether it provides 
extra functionality or not.
>> so using Emacs to develop and test the .gpr files would be
>> incredibly valuable. 
>>     
>
> I do this all the time; the .gpr files are tested by using them with
> GNAT to compile the Ada code.
>   
Well, yes.  I mean, that does test them, but if I have to use a shell to 
run gnatmake so I can use my *.gpr files, then I don't get all the 
features of Ada Mode, such as jumping to the lines an error occurs on.
>> In fact, just having Ada Mode utilize the .gpr files to organize
>> itself would be best, as you're always developing with what you're
>> distributing, making sure it always works.
>>     
>
> If by "orgainize itself" you mean "set the Emacs Ada mode project
> variables", that is currently supported.
>   
Maybe ``organize itself'' was not the best choice of words.  What I'd 
like is to have Ada Mode base all of its compilation commands off of the 
.gpr files, no .adp files needed.  Basically, using .gpr files exactly 
as it uses .adp files (in the version of ada-*.el that I have). I guess 
that would mean that it'd just call gnatmake -Psomething.gpr from the 
correct directory whenever it does a build.  Unfortunately, I tried 
setting this switch in my *.adp file, and it tells me that it can't find 
the file.  Guess I'm doing it wrong.
>> <snip>  It may help turn more free software projects onto Ada + 
>> Emacs, which is the best programming environment I've used.
>>     
>
> That, I agree with :)
Glad I'm in such good company.



More information about the Emacs-ada-mode mailing list