boss icon indicating copy to clipboard operation
boss copied to clipboard

DCP injection not handling conditionals

Open birbilis opened this issue 7 months ago • 1 comments

The current mechanism of injecting DCPs is problematic. Corrupts “requires” clause if there are conditional compilation expressions in it. The package can’t compile anymore after the corruption of the requires clause

More info on why I need conditionals at required clause is at (see issue description on SVGIconImageList from GetIt and last comments on CodeSite Express also from Getit) issue Delphi IDE has with adding filed to such packages (eats up the parts in the conditionals at the requires clause) https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2644

See my question on this at deepwiki: https://deepwiki.com/search/the-regex-is-buggy-it-cant-han_21bbf50d-b047-413b-91dd-fcb512d503ff

The DCP injection is analyzed here: https://deepwiki.com/HashLoad/boss/5.2-dcp-injection

The issue starts most probably with the regex used to parse the requires clause. Since BOSS can’t evaluate conditionals (unless it could ask delphi compiler to) it could at least leave parts in those unchanged, including keeping the conditionals in place

birbilis avatar May 24 '25 14:05 birbilis

the problem seems to be the regular expressions used, they also choke on comments for example:

https://github.com/Zoomicon/Zoomicon.Manipulation.FMX.Delphi/blob/f8ab031f205507ce7349411e559b2c94763c3bf0/Source/Zoomicon.Manipulation.FMX_IDE.dpk

has

requires rtl, //DesignIDE, //for DesignIntf unit Zoomicon.Manipulation.FMX; //for Zoomicon.Manipulation.FMX.* units

which will choke both at // comment found at the end of requires clause

requires

rtl,

//DesignIDE, //for DesignIntf unit

Zoomicon.Manipulation.FMX; //for Zoomicon.Manipulation.FMX.* unitsrequires Zoomicon.Generics{BOSS}, Zoomicon.Helpers.FMX{BOSS};

btw, when it chokes its seems to add empty extra rows to almost all file (apart from the lines where the {BOSS} requires entries are (wrongly) injected

birbilis avatar Oct 26 '25 02:10 birbilis