Skip to content

Conversation

@andrevfarias
Copy link
Contributor

This PR introduces initial compatibility for Delphi 10.2 Tokyo by adding a dedicated client build and a Tokyo-specific tool window implementation. It addresses the request to support older Delphi IDEs, motivated by issue #14.

Summary of changes

  • New Tokyo tool frame:
    • Added DelphiLint.ToolFrame.Tokyo.pas/.dfm, using TListView and TWebBrowser (SHDocVw) instead of newer components that are not available on 10.2.
  • New 10.2 Tokyo client projects:
    • Added client/source/DelphiLintClient250.dpk, DelphiLintClient250.dproj, and group project client/DelphiLintClientProjects250.groupproj.
    • Added test project client/test/DelphiLintClientTest250.dpr/.dproj.
  • Conditional compilation for older IDEs:
    • DelphiLint.Plugin.pas selects DelphiLint.ToolFrame.Tokyo when CompilerVersion < 33.0.
    • DelphiLint.IDEContext.pas uses IOTAIDEThemingServices250 where required.
  • Build and packaging:
    • scripts/build.ps1 updated to support version 250 (Tokyo), map registry version 19.0, and use DCC_UseMSBuildExternally=true to avoid long command-line issues.
  • Minor compatibility tweaks across units (Analyzer, HtmlGen, Server, Settings, etc.) to compile and run on Tokyo.
  • No behavior changes for Alexandria/Athens; newer IDEs continue using the existing frame and WebView2.

Why

  • Many teams still use Delphi 10.2 Tokyo, and the main client relies on components not available there. This PR provides a safe, isolated implementation for Tokyo without impacting newer Delphi versions. See issue #14.

Build notes

  • Use the existing build pipeline with the 250 target (e.g., build.ps1 250).

Impact

  • Adds 10.2 support with a separate UI implementation; maintains current behavior for Delphi 11/12.

Copy link
Collaborator

@fourls fourls left a comment

Choose a reason for hiding this comment

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

Hi @andrevfarias, thank you for the PR! It mostly looks good and I'm happy to accept most of its changes to improve compatibility with older Delphi versions.

I have made some comments. Because I do not have Tokyo installed, I will not be able to test it or ensure any quality guarantees.

Many teams still use Delphi 10.2 Tokyo, and the main client relies on components not available there.

I'm not super comfortable with how specific this change is to 10.2. Many teams still use Delphi 7, XE3, etc, but that doesn't seem like a reason to require a separate tool frame for each of those versions as well. Could we reframe this as a more general "legacy tool frame" instead of something specific to a minor release of the compiler?

Also, the build script should not be updated to build unsupported versions of Delphi. The purpose of the build script is for packaging and release, which won't need to be done for unsupported versions. There's also nothing special about 10.2 that necessitates it being added to the build script, and it implies a guarantee that it will be compatible (which there is not).

The script doesn't do anything fancy, so if you'd like to compile an unsupported version's BPL it can just be compiled in the IDE / via MSBuild / whatever approach is best for your setup. Or by making the changes to the build script locally.


if not TFile.Exists(FLogPath) then begin
FreeAndNil(TFile.Create(FLogPath));
TFile.Create(FLogPath).Free;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of these changes?

Hook.Free;
end;
FreeAndNil(FPopupHooks);
FreeAndNil(FPopupHooks); // Remover?
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this comment mean?


function TRuleHtmlGenerator.BuildHtmlPage(BodyHtml: string; BodyClass: string): string;

function GetLegacyScript: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Webpack/Babel can polyfill for old IE versions (see client/jslib/webpack.config.js) so there's no need to include it ourselves. Could you identify the IE version you want to support and try configuring webpack to bundle for that version?

Comment on lines +362 to +366
{$IF CompilerVersion < 33.0}
(BorlandIDEServices as IOTAIDEThemingServices250).RegisterFormClass(FormClass);
{$ELSE}
(BorlandIDEServices as IOTAIDEThemingServices).RegisterFormClass(FormClass);
{$ENDIF}
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to do the ifdef here, just change to 250 if it's a compatibility issue. Newer Delphi versions also have the 250 version.

begin
LintContext.IDEServices.ApplyTheme(Self);
WindowColor := StyleServices(Self).GetSystemColor(clWindow);
WindowColor := StyleServices.GetSystemColor(clWindow);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this trailing whitespace.

begin
LintContext.IDEServices.ApplyTheme(Self);
WindowColor := StyleServices(Self).GetSystemColor(clWindow);
WindowColor := StyleServices.GetSystemColor(clWindow);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this trailing whitespace.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please

  • Translate comments to English
  • Remove Tokyo-specific references
  • Include this unit in all DelphiLintClient dprojs

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please revert this change. As stated previously, we will not be officially supporting building for versions of Delphi before Delphi 11, especially not specifically for 10.2.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this change?

Comment on lines +110 to +112
if (properties.containsKey("sonar.sourceEncoding")) {
return Charset.forName(properties.get("sonar.sourceEncoding"));
} else if (properties.containsKey("sonar.encoding")) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, this seems like a legitimate bug, thanks for picking this up. Could you move this out into a separate commit?

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.

2 participants