View Issue Details

IDProjectCategoryView StatusLast Update
0037353LazarusCompilerpublic2020-08-13 21:45
Reporterjosiasmat Assigned ToJuha Manninen  
Status assignedResolutionopen 
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 21: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 21: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.

Issue History

Date Modified Username Field Change
2020-07-14 22:10 josiasmat New Issue
2020-08-13 17:05 Juha Manninen Assigned To => Juha Manninen
2020-08-13 17:05 Juha Manninen Status new => assigned
2020-08-13 21:11 Juha Manninen Note Added: 0124856
2020-08-13 21:12 Juha Manninen Status assigned => feedback
2020-08-13 21:12 Juha Manninen LazTarget => -
2020-08-13 21:45 josiasmat Note Added: 0124858
2020-08-13 21:45 josiasmat Status feedback => assigned