View Issue Details

IDProjectCategoryView StatusLast Update
0037353LazarusCompilerpublic2020-09-03 07:05
Reporterjosiasmat Assigned ToJuha Manninen  
Status resolvedResolutionunable to reproduce 
Platformx86-64OSWindows 10 
Product Version2.0.8 
Summary0037353: Do 'Execute before' command before loading resource files
DescriptionCurrently, when you compile a project in Lazarus (Windows), it first locates the resource files to be embedded into the executable, and after this it runs the 'Execute before' command (this can be set in the Project Options dialog).

I think the correct behaviour should be the inverse: first run the 'Execute before' command, and then load the resource files.

This has implications for my use-case: I use the 'Execute before' in one of my projects to compress some resource files, and then I load the compressed resources into my executable file. But, if I change one of my resources, and then compile my project in Lazarus, it will run the compress command only after loading the existent file. So to have the updated file I need compress it manually before, or instruct Lazarus to compile two times.
TagsNo tags attached.
Fixed in Revision
Attached Files


Juha Manninen

2020-08-13 19:11

developer   ~0124856

@josiasmat, I need some way to reproduce the issue. Please get Lazarus trunk (development version) to test.

The code in function TMainIDE.DoBuildProject() looks correct. It is a long method but most of it is validation and error checking.
Line 7037 has the "execute before" call.
Line 7086 compiles, TheCompiler.Compile(...).
Dependent packages are built before the "execute before" stuff but it should be ok.
The compiler, FPC, embeds resources into the executable. Are you saying that it uses some old version of your resource even you have changed it in "execute before" call?
Could it be a disk cache issue?


2020-08-13 19:45

reporter   ~0124858

@JuhaManninen, on "execute before" I actually call a command that (re)creates the resources. So, what happens is, if the resource file does not exist yet, the IDE throws an error message.

I will try to make a sample project here and attach here that reproduces this.

Juha Manninen

2020-08-14 09:24

developer   ~0124871

> So, what happens is, if the resource file does not exist yet, the IDE throws an error message.

It means you can verify the "execute before" was run correctly by deleting the file beforehand. Compilation will succeed only if the file was created before it.

Juha Manninen

2020-08-20 11:55

developer   ~0125015

@josiasmat, please give more information. Otherwise this will be resolved as "unable to reproduce".


2020-08-20 12:04

reporter   ~0125017

Yes I will make a sample project, but currently I'm a little busy with other projects, please give me some days! Thanks!

Juha Manninen

2020-09-03 07:05

developer   ~0125334

Resolving now. Please reopen if you find ways to reproduce.

Issue History

Date Modified Username Field Change
2020-07-14 20:10 josiasmat New Issue
2020-08-13 15:05 Juha Manninen Assigned To => Juha Manninen
2020-08-13 15:05 Juha Manninen Status new => assigned
2020-08-13 19:11 Juha Manninen Note Added: 0124856
2020-08-13 19:12 Juha Manninen Status assigned => feedback
2020-08-13 19:12 Juha Manninen LazTarget => -
2020-08-13 19:45 josiasmat Note Added: 0124858
2020-08-13 19:45 josiasmat Status feedback => assigned
2020-08-14 09:24 Juha Manninen Note Added: 0124871
2020-08-20 11:55 Juha Manninen Status assigned => feedback
2020-08-20 11:55 Juha Manninen Note Added: 0125015
2020-08-20 12:04 josiasmat Note Added: 0125017
2020-08-20 12:04 josiasmat Status feedback => assigned
2020-09-03 07:05 Juha Manninen Status assigned => resolved
2020-09-03 07:05 Juha Manninen Resolution open => unable to reproduce
2020-09-03 07:05 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2020-09-03 07:05 Juha Manninen Note Added: 0125334