LazIDEIntf: How to force a complete build on next compile/run lazarus / 13-General ---------------------------------------------------------------------- Pascal · 2017-11-14 07:50 For an IDE addon i need to force a complete build on next compile/run. What is the best an esiest way to do so? - changing timestamp of evey file - add pfAlwaysBuild to project flag How can i set the whole project to be modified? Pascal ---------------------------------------------------------------------- Thaddy · 2017-11-14 08:06 Do it from the command line: make useride FPCOPT='-B' ---------------------------------------------------------------------- Thaddy · 2017-11-14 08:10 Quote from: Thaddy on November 14, 2017, 09:06:51 amrebuild it from the command line: make useride FPCOPT='-B' And on unix use the touch utility to change file datetime. (Also downloadable for windows: https://sourceforge.net/projects/touchforwindows/ ---------------------------------------------------------------------- Pascal · 2017-11-14 08:31 Thanks Thaddy, but i need to force a rebuild of the currently active project inside the IDE, so no comandline there. ---------------------------------------------------------------------- balazsszekely · 2017-11-14 09:03 Hi Pascal, If you're inside the IDE, you can do something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses LazIDEIntf, CompOptsIntf;//...if LazarusIDE.ActiveProject <> nil then   LazarusIDE.DoBuildProject(crBuild, [pbfCompileDependenciesClean], True); regards, GetMem ---------------------------------------------------------------------- Pascal · 2017-11-14 09:49 Thanks GetMem, i know that, but what i want to achieve is that the active project will be rebuild when the user runs or compiles the project. So some kind of marking the project as dirty/modified. Background: For my One-Click-Profiler IDE addon i add a new menu item to the run menu. When clicked i backup the original sources and generate instrumented ones. I call BuildProject and RunProjectWithoutDebugging. When run finished i restore the original sources. What now happens is that the ide does not recognized that the sources have changed. When the user now clicks run, the current exe with the profiling code gets started. And that's not what i want. So i need a way to convince the ide to rebuild the whole project on next run or compile. ---------------------------------------------------------------------- balazsszekely · 2017-11-14 10:05 @Pascal OK. I see know. Please check if pfAlwaysBuild flag helps? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses LazIDEIntf, CompOptsIntf, ProjectIntf; if LazarusIDE.ActiveProject <> nil then    LazarusIDE.ActiveProject.Flags := LazarusIDE.ActiveProject.Flags + [pfAlwaysBuild]; ---------------------------------------------------------------------- Pascal · 2017-11-14 10:33 Yes, works. But i have to restore old Flags after forced rebuild. Any other idea? I thought of setting LastCompilerParams to 'force rebuild' as it is checked, but unfortunately it's not in ProjectIntf.TLazProject. ---------------------------------------------------------------------- taazz · 2017-11-14 11:31 Quote from: Pascal on November 14, 2017, 11:33:25 amYes, works. But i have to restore old Flags after forced rebuild. Any other idea? I thought of setting LastCompilerParams to 'force rebuild' as it is checked, but unfortunately it's not in ProjectIntf.TLazProject. how about run a delete *.o, *.ppu on the "unit output directory" after the compile? that will force a recompile next time for sure. ---------------------------------------------------------------------- Pascal · 2017-11-14 12:41 Quote from: taazz on November 14, 2017, 12:31:29 pmhow about run a delete *.o, *.ppu on the "unit output directory" after the compile? that will force a recompile next time for sure. Yes, also a good idea, but pfAlwaysBuild seems to work quite well and it is not set by the ide itself.