Fix compilation for Delphi XE6 - #51
Conversation
|
I don't see the reason to make it compatible with old compilers since it is not a library but a tool. Anyone can use free Community Edition Delphi to compile it with recent version. |
|
It allows for companies that have licenses only on older versions to be able to use this tool. This is specially common here in Brazil. Embarcadero doesn't allow Community Edition installations alongside with paid license installations. Besides, the changes are extremely simple. |
There was a problem hiding this comment.
Pull request overview
This PR updates the codebase to compile on Delphi XE6 by removing/guarding language and RTL features that are only available in XE7+.
Changes:
- Added a
THTMLCoverageReport.HtmlEncodewrapper with a conditional fallback implementation for pre-XE7 compilers, and guardedSystem.NetEncodingin theusesclause. - Replaced direct
TNetEncoding.HTML.Encodecalls with the newHtmlEncodewrapper inHTMLCoverageReport.pas. - Replaced an inline routine-body
constwith a local variable assignment inCoverageConfigurationTest.pasfor XE6 compatibility.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Test/CoverageConfigurationTest.pas | Removes XE7+ inline routine-body constant usage to keep the test compiling on XE6. |
| Source/HTMLCoverageReport.pas | Adds an XE6-safe HTML encoding wrapper and conditionally uses System.NetEncoding only on XE7+. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| LINCLUDE_EXCLUDE_FILES_PREFIX: string; | ||
| begin | ||
| const cINCLUDE_EXCLUDE_FILES_PREFIX = cINCLUDE_FILES_PREFIX + cEXCLUDE_FILES_PREFIX; | ||
|
|
||
| LINCLUDE_EXCLUDE_FILES_PREFIX := cINCLUDE_FILES_PREFIX + cEXCLUDE_FILES_PREFIX; |
Summary
TNetEncoding.HTML.Encodecalls inHTMLCoverageReport.paswith a new privateHtmlEncodewrapper that conditionally falls back to aStringReplace-based implementation whenCompilerVersion < 28.0(pre-XE7), sinceSystem.NetEncodingseems to have been introduced in XE7.System.NetEncodingusesclause with{$IF CompilerVersion >= 28.0}so XE6 builds don't fail on the missing unit.constdeclaration inside a procedure body inCoverageConfigurationTest.pasinto a localvar, since inline constants in routine bodies are not supported by XE6.