Re: Lancement de script à la fin de la c ompilation avec Gprbuild dans GNATStudio

David SAUVAGE - AdaLabs Ltd via Ada-france <[email protected]> Thu, 21 Oct 2021 10:42:29 +0400
Newsgroups gmane.comp.lang.ada.france
Message-ID <[email protected]>
On 10/20/21 22:01, Stéphane Rivière via Ada-france wrote:
> 
> Merci pour ta réponse, entre îliens :)
> 

un exemple de script en pièce jointe

Cheers

_______________________________________________
Ada-france mailing list
[email protected]
https://mail.ada-france.org/cgi-bin/mailman/listinfo/ada-france
gprbuild (text/plain, 1.1 KB)
#!/bin/bash
# About
#######
# Superseeds gprbuild driver to execute specific commands on successful build success
#
# HowTo
#######
# cp gprbuild ~/bin
# chmod +x ~/bin/gprbuild
# export PATH=~/bin:$PATH
#
# Dependencies
######
# bash
# gnatgpr
# beep (or alsa-utils if using aplay)
# orage (for the wav file)

DESTINATION=/tmp
DRIVER=/opt/gnat-gpl-2020/bin/gprbuild

PARAMETERS=$@
PROJECT=`echo $PARAMETERS | sed -e 's/.* -P\([^ ]*\.gpr\) .*/\1/'`

$DRIVER $PARAMETERS
STATUS=$?

if [ $STATUS -eq 0 ]; then
   if [[ $PARAMETERS == *"-u"* || $PARAMETERS == *"-c"* ]]; then
      true
   else
      # code below could be executed asynchronously to avoid blocking this execution flow,
      # so that gnatstudio will not be blocked by the specific commands execution.

      for exe in `gnatgpr -b $PROJECT`;do cp $exe $DESTINATION;done
      # package dependencies (gnatgpr)
      # direct references to be made to the project binaries without gnatgpr

      beep -f 300.7 -r 2 -d 100 -l 400
      # package dependencies (beep)

      # aplay /usr/share/orage/sounds/Phone.wav
      # package dependencies (alsa-utils, orage)
   fi
fi
(exit $STATUS)