Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-11

Build number in my application

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

My current project is in SubVersion. I user the SubVersion revision number as my Build number in my project version. Currently I use a revision.inc file which I have to manually edit from time to time (I'm lazy doing after every commit).

Is there a way I can somehow tell Lazarus to automatically populate that file with the correct revision number *before* each compile?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Henry Vermaak
to Graeme Geldenhuys

2008/11/19 Graeme Geldenhuys :

Show quoted text 9 lines
Hi, My current project is in SubVersion. I user the SubVersion revision number as my Build number in my project version. Currently I use a revision.inc file which I have to manually edit from time to time (I'm lazy doing after every commit). Is there a way I can somehow tell Lazarus to automatically populate that file with the correct revision number *before* each compile?

before each compile, you can execute a program (see lazarus/tools/svn2revisioninc.pas) that puts the revision number in a revision.inc, or something. see the "compilation" tab of "compiler options". you can obviously use this method in a Makefile, too (like lazarus does).

henry

Reply by email

Graeme Geldenhuys
to Henry Vermaak
Henry Vermaak wrote 6 lines
before each compile, you can execute a program (see lazarus/tools/svn2revisioninc.pas) that puts the revision number in a revision.inc, or something. see the "compilation" tab of "compiler options". you can obviously use this method in a Makefile, too (like lazarus does).

I didn't know about the svn2revisioninc.pas file, but I did know about the 'compilation' tax

I added a 'getrevision.sh' in the "Execute Before" Command edit box and checked Build and Compile.

When I compile, Lazarus IDE crashed and closed without showing any error message.

I then thought maybe Lazarus IDE can't find my 'getrevision.sh' script, so I added the following in the Command edit box: $(ProjPath)/getrevision.sh

Again the same thing. When I compile Ctrl+F9 Lazarus IDE simply crashes and closes. :-(

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote
When I compile, Lazarus IDE crashed and closed without showing any error message.

Running Lazarus from the command line, I get the following output as soon as I press Ctrl+F9.

-----------------------[ begin ]-------------------------- graemeg at graeme:lazarus$ ./lazarus
TMainIDE.ParseCmdLineOptions:
PrimaryConfigPath="/home/graemeg/.lazarus"
SecondaryConfigPath="/etc/lazarus"
[TExternalToolList.Run]
CmdLine="/home/graemeg/programming/MasterMaths/M2Browser_v3/Source/tutoradmin/getrevision.sh" WorkDir="/home/graemeg/programming/MasterMaths/M2Browser_v3/Source/tutoradmin/" TOutputFilter.Execute :TProcessUTF8
TExternalToolList.Run Failed to run tool Access violation Stack trace:
$0805E595
$08069563
$0818911B TCONTROL__SETTEXT, line 3745 of ./include/control.inc $080B5412 TMAINIDE__UPDATECAPTION, line 10649 of main.pp $080C59C2 TMAINIDEBASE__SETTOOLSTATUS, line 231 of mainbase.pas $0809A137 TMAINIDE__SETTOOLSTATUS, line 3068 of main.pp $0809382C TMAINIDE__DESTROY, line 1207 of main.pp $080691F2
$08076A7D BEFOREFINALIZATION, line 1435 of forms.pp $0806CFA9
$08342899 TPROCESSUTF8__EXECUTE, line 220 of asyncprocess.pp $0836243E TOUTPUTFILTER__EXECUTE, line 8569 of outputfilter.pas $0831BD51 TEXTERNALTOOLLIST__RUN, line 372 of exttooldialog.pas $0831B5F1 TEXTERNALTOOLLIST__RUN, line 284 of exttooldialog.pas $080B394D TMAINIDE__ONRUNEXTERNALTOOL, line 10229 of main.pp $0836188E TCOMPILATIONTOOLOPTIONS__EXECUTE, line 3119 of compileroptions.pp $080B02B7 TMAINIDE__DOBUILDPROJECT, line 9258 of main.pp Xlib: sequence lost (0x13cae > 0x3cae) in reply type 0x0! The program 'lazarus' received an X Window System error. This probably reflects a bug in the program.
The error was 'BadImplementation (server does not implement operation)'. (Details: serial 15534 error_code 17 request_code 20 minor_code 0)

  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

TExternalToolList.Run Exception: there was an error Xlib: unexpected async reply (sequence 0x3eaf)!
Xlib: unexpected async reply (sequence 0x3eb8)!
The program 'lazarus' received an X Window System error. This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'. (Details: serial 16230 error_code 3 request_code 18 minor_code 0)

  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

-----------------------[ end ]-----------------------------

-----------[ getrevision.sh ]---------------
#!/bin/sh
svnversion -n > revision.inc
----------------[ end ]----------------

I can run getrevision.sh from the console without problems...

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Henry Vermaak
to Graeme Geldenhuys: On Wed, Nov 19, 2008 at 3:28 PM, Graeme Geldenhuys Running Lazarus from the command line,…

2008/11/19 Graeme Geldenhuys :

Show quoted text 8 lines
-----------[ getrevision.sh ]--------------- #!/bin/sh svnversion -n > revision.inc ----------------[ end ]---------------- I can run getrevision.sh from the console without problems...

that's because the your shell knows how to run scripts? maybe you need to put "sh getrevision.sh" in the edit box.

henry

Reply by email

Graeme Geldenhuys
to Henry Vermaak
Henry Vermaak wrote 11 lines
> > -----------[ getrevision.sh ]--------------- > #!/bin/sh > svnversion -n > revision.inc > ----------------[ end ]---------------- > > > I can run getrevision.sh from the console without problems... that's because the your shell knows how to run scripts? maybe you need to put "sh getrevision.sh" in the edit box.

No, that doesn't seem to be needed. I played around with my script file and stored the 'svnversion -n' output into a variable and then 'echo -n ....' the information out to revision.inc. All the the script obviously. And suddenly, Lazarus is happy with that an no more crashes.

I then reverted to the old script just to be sure, and Lazarus IDE crashes on demand. I have no clue what causes Lazarus to crash in one script and not in another. The both get called the same way in the Command edit box.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email