Recent

Author Topic: [solved] file projectintf.pas does not work anymore like it did.  (Read 924 times)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
[solved] file projectintf.pas does not work anymore like it did.
« on: February 27, 2023, 12:02:16 pm »
Good day, with help of PascalDragon I've managed to patch some Lazarus files for my own needs.
As of today I got Lazarus 2.3.0 (rev main-2_3-2889-g1b9d3d4cbf) FPC 3.2.2 x86_64-win64-win32/win64 installed.
In above mentioned file I did modified source to this:
Code: Pascal  [Select][+][-]
  1. function TFileDescPascalUnitWithResource.GetInterfaceSource(const Filename,
  2.   SourceName, ResourceName: string): string;
  3. const
  4.   LE = LineEnding;
  5. begin
  6.   Result:=
  7.      'type'+LE
  8.     +'  T'+ResourceName+' = class('+ResourceClass.ClassName+')'+LE
  9.     +'  strict private'+LE
  10.     +'  private'+LE
  11.     +LE
  12.     +'  public'+LE
  13.     +LE
  14.     +'  end;'+LE
  15.     +LE;
  16.  
  17.   if DeclareClassVariable then
  18.     Result := Result +
  19.      'var'+LE
  20.     +'  '+ResourceName+': T'+ResourceName+';'+LE
  21.     +LE;
  22. end;
After I rebuild the IDE it does not apply my patch anymore, what is needed that it work again please?
(I wanted to have "strict private" line added by default, nothing more nothing less)
« Last Edit: March 05, 2023, 10:49:40 pm by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
Re: file projectintf.pas does not work anymore like it did.
« Reply #1 on: March 05, 2023, 08:55:38 pm »
suggestions, anyone?
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

GetMem

  • Hero Member
  • *****
  • Posts: 4072
Re: file projectintf.pas does not work anymore like it did.
« Reply #2 on: March 05, 2023, 09:39:10 pm »
suggestions, anyone?
What is the exact issue? After I made the necessary adjustments to projectintf.pas and rebuild the IDE, the following line is inserted:
Code: Pascal  [Select][+][-]
  1.   //...
  2.   TForm1 = class(TForm)
  3.   strict private  //<- this one
  4.   private
  5.  
  6.   public
  7.  
  8.   end;
  9.  

Is not what are you after?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4214
  • I like bugs.
Re: file projectintf.pas does not work anymore like it did.
« Reply #3 on: March 05, 2023, 09:46:54 pm »
After I rebuild the IDE it does not apply my patch anymore, what is needed that it work again please?
Does not apply your patch anymore?
Do you mean it does not work as expected after your change + rebuild?
I just tested and here it works. The modified contents show when I create a new form (File -> New Form).
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
Re: file projectintf.pas does not work anymore like it did.
« Reply #4 on: March 05, 2023, 09:50:01 pm »
What is the exact issue?
I guess I was not clear enough.
My issue is:
After I rebuild the IDE it does not apply my patch anymore, what is needed that it work again please?
Before I did updated my Lazarus to current (or above mentioned) trunk version, when I pressed on new project, selected "Application (LCL)", it added by default the "strict private" line.
Now is doesnt do that anymore and I do wonder why or what I've did wrong, or did Lazarus changed that I need to patch it somewhere else?
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
Re: file projectintf.pas does not work anymore like it did.
« Reply #5 on: March 05, 2023, 09:51:37 pm »
Do you mean it does not work as expected after your change + rebuild?
Yes, it is like, I've done no change to source at all  :-X
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

GetMem

  • Hero Member
  • *****
  • Posts: 4072
Re: file projectintf.pas does not work anymore like it did.
« Reply #6 on: March 05, 2023, 10:11:45 pm »
@KodeZwerg
Quote
Before I did updated my Lazarus to current (or above mentioned) trunk version, when I pressed on new project, selected "Application (LCL)", it added by default the "strict private" line.
Now is doesnt do that anymore and I do wonder why or what I've did wrong, or did Lazarus changed that I need to patch it somewhere else?
(if I understood it correctly)
You made the changes to your local copy of Lazarus, this does not affect the official gitlab version called Lazarus main. If you wish the changes to be permanent, you have to create a bugreport/new suggestion. Once your changes are approved, one of the developers will push the modified source file(s) to Lazarus main. This particular suggestion most likely will be rejected.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
Re: file projectintf.pas does not work anymore like it did.
« Reply #7 on: March 05, 2023, 10:23:28 pm »
Thanks so far for your help, but we having a miscommunication and I try again step by step what I have done.

1. I did used FPCUPDELUXE app to upgrade my installed lazarus copy. (prior it was also installed by fpcpudeluxe)
2. I applied my patch to projectintf.pas inside \lazarus\components\buildintf\ folder.
3. I opened Lazarus and press on rebuild.
4. I test it by creating a new project.
5. I open my webbrowser, writing here that my patch is not getting applied and asking for help.

I really hope that this is clear enough this time  :D
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8851
  • Debugger - SynEdit - and more
    • wiki
Re: file projectintf.pas does not work anymore like it did.
« Reply #8 on: March 05, 2023, 10:23:33 pm »
Assuming you did modify the right file, recompiled clean, and all the usual pitfalls....


Well, don't know what happens. But I know how to find out... the long way though.

- Go back to the IDE were it did work.
- build entire IDE with -gw3
- debug the IDE (open ide/lazarus.lpi // exe must be prebuild via tools menu)
- set breakpoint in your code addition / in GetInterfaceSource
- look at the callstack. (copy and save it)

Now you know what called your code.

Repeat above with the new IDE, and see if your code is still called or not.
Then go to each entry of the callstack, and compare the new vs the old IDE's source. Somewhere has to be a difference.


KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
Re: file projectintf.pas does not work anymore like it did.
« Reply #9 on: March 05, 2023, 10:49:03 pm »
recompiled clean
Thank you mister, that was it.
Earlier I never did need to enter the rebuild option screen, I was able to just press on rebuild and it rebuilded like expected.
Using option shown in attachment helped me to fix my issue.

Case closed, thanks all for help!
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4214
  • I like bugs.
Re: file projectintf.pas does not work anymore like it did.
« Reply #10 on: March 06, 2023, 10:11:49 pm »
recompiled clean
Thank you mister, that was it.
I wonder why compiling clean was needed. I did not compile clean but the change was included in my IDE.
Does FPCUPDELUXE screw things up somehow? It should not. Once you have Lazarus sources copied into your computer, FPC decides what needs to be compiled.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1395
  • Fifty shades of code.
    • Delphi & FreePascal
Re: [solved] file projectintf.pas does not work anymore like it did.
« Reply #11 on: March 07, 2023, 12:26:54 am »
As told, before I've updated to newest trunk, a normal rebuild was all I needed to do.
Folder \lazarus\components\buildintf\units\x86_64-win64\ also just showed me filedates from when I've upgraded, but a basic rebuild did not rebuild my changed file.

The reason is for me a mystery aswell.
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8851
  • Debugger - SynEdit - and more
    • wiki
Re: [solved] file projectintf.pas does not work anymore like it did.
« Reply #12 on: March 07, 2023, 10:22:34 am »
As told, before I've updated to newest trunk, a normal rebuild was all I needed to do.

More importantly you probably updated "from a more distant version".
(And now that you have done the full rebuild, if you change your patch, then you likely will be fine with a normal rebuild too)

While Juha just did update in small steps. And likely (like me) at some point in the past couple of month has also done a full rebuild.

 

TinyPortal © 2005-2018