Recent

Author Topic: LazIDEIntf: How to force a complete build on next compile/run  (Read 3398 times)

Pascal

  • Hero Member
  • *****
  • Posts: 932
LazIDEIntf: How to force a complete build on next compile/run
« on: November 14, 2017, 08:50:16 am »
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
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #1 on: November 14, 2017, 09:06:51 am »
Do it from the command line:
make useride FPCOPT='-B'
Specialize a type, not a var.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #2 on: November 14, 2017, 09:10:40 am »
rebuild 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/
Specialize a type, not a var.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #3 on: November 14, 2017, 09:31:07 am »
Thanks Thaddy,

but i need to force a rebuild of the currently active project inside the IDE, so no comandline there.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

balazsszekely

  • Guest
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #4 on: November 14, 2017, 10:03:09 am »
Hi Pascal,

If you're inside the IDE, you can do something like this:
Code: Pascal  [Select][+][-]
  1. uses LazIDEIntf, CompOptsIntf;
  2. //...
  3. if LazarusIDE.ActiveProject <> nil then  
  4.   LazarusIDE.DoBuildProject(crBuild, [pbfCompileDependenciesClean], True);

regards,
GetMem
« Last Edit: November 14, 2017, 10:09:00 am by GetMem »

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #5 on: November 14, 2017, 10:49:14 am »
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.
« Last Edit: November 14, 2017, 10:51:13 am by Pascal »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

balazsszekely

  • Guest
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #6 on: November 14, 2017, 11:05:07 am »
@Pascal
OK. I see know. Please check if pfAlwaysBuild flag helps?

Code: Pascal  [Select][+][-]
  1. uses LazIDEIntf, CompOptsIntf, ProjectIntf;
  2.  
  3. if LazarusIDE.ActiveProject <> nil then  
  4.   LazarusIDE.ActiveProject.Flags := LazarusIDE.ActiveProject.Flags + [pfAlwaysBuild];

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #7 on: November 14, 2017, 11:33:25 am »
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.
« Last Edit: November 14, 2017, 12:07:54 pm by Pascal »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #8 on: November 14, 2017, 12:31:29 pm »
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.
how about run a delete *.o, *.ppu on the "unit output directory" after the compile? that will force a recompile next time for sure.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazIDEIntf: How to force a complete build on next compile/run
« Reply #9 on: November 14, 2017, 01:41:42 pm »
how 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.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

 

TinyPortal © 2005-2018