Skip to content

Fix compilation for Delphi XE6 - #51

Open
GuilhermeAlecrim7K wants to merge 2 commits into
DelphiCodeCoverage:masterfrom
GuilhermeAlecrim7K:xe6-compilation
Open

Fix compilation for Delphi XE6#51
GuilhermeAlecrim7K wants to merge 2 commits into
DelphiCodeCoverage:masterfrom
GuilhermeAlecrim7K:xe6-compilation

Conversation

@GuilhermeAlecrim7K

Copy link
Copy Markdown

Summary

  • Replace direct TNetEncoding.HTML.Encode calls in HTMLCoverageReport.pas with a new private HtmlEncode wrapper that conditionally falls back to a StringReplace-based implementation when CompilerVersion < 28.0 (pre-XE7), since System.NetEncoding seems to have been introduced in XE7.
  • Guard the System.NetEncoding uses clause with {$IF CompilerVersion >= 28.0} so XE6 builds don't fail on the missing unit.
  • Refactor inline const declaration inside a procedure body in CoverageConfigurationTest.pas into a local var, since inline constants in routine bodies are not supported by XE6.

@ekot1

ekot1 commented May 25, 2026

Copy link
Copy Markdown
Contributor

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.

@GuilhermeAlecrim7K

Copy link
Copy Markdown
Author

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.

Copilot AI lite review requested due to automatic review settings August 22, 2026 01:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.HtmlEncode wrapper with a conditional fallback implementation for pre-XE7 compilers, and guarded System.NetEncoding in the uses clause.
  • Replaced direct TNetEncoding.HTML.Encode calls with the new HtmlEncode wrapper in HTMLCoverageReport.pas.
  • Replaced an inline routine-body const with a local variable assignment in CoverageConfigurationTest.pas for 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.

Comment on lines +1521 to +1523
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants