spiegel-keyman/developer/src/tike/project/Keyman.Developer.System.Project.modelTsProjectFileAction.pas
Marc Durdin 6f6e07975b chore(developer): remove compile.pas and CompileErrorCodes.pas
Fixes #9923.

These are no longer used because we now use kmc for builds. This also
means that the kmcomp-x64-structures test is no longer required, because
that was used to keep the Delphi and C++ structures in sync.

There are some minor details around error message identifiers that are
still present in a handful of places, but they are work for another
time.
2023-11-02 13:12:28 +07:00

76 lines
2.1 KiB
ObjectPascal

unit Keyman.Developer.System.Project.modelTsProjectFileAction;
interface
uses
System.SysUtils,
Keyman.Developer.System.Project.modelTsProjectFile,
Keyman.Developer.System.Project.ProjectFile,
Keyman.Developer.System.Project.ProjectFiles,
Keyman.Developer.System.Project.ProjectFileType,
Keyman.Developer.System.Project.ProjectLog,
UKeymanTargets;
type
TmodelTsProjectFileAction = class(TmodelTsProjectFile)
private
procedure CheckFilenameConventions;
public
function CompileModel: Boolean;
function Clean: Boolean;
end;
implementation
uses
System.Classes,
System.StrUtils,
System.Variants,
Winapi.Windows,
Keyman.System.LexicalModelUtils,
Keyman.Developer.System.KmcWrapper,
Keyman.Developer.System.LexicalModelCompile,
VisualKeyboard;
function TmodelTsProjectFileAction.Clean: Boolean;
begin
CleanFile(TargetFileName);
Result := True;
end;
procedure TmodelTsProjectFileAction.CheckFilenameConventions;
begin
if not OwnerProject.Options.CheckFilenameConventions then
Exit;
if not TLexicalModelUtils.DoesTSFilenameFollowLexicalModelConventions(FileName) then
begin
HasCompileWarning := True;
Log(plsWarning, Format(TLexicalModelUtils.SModelFileNameDoesNotFollowConventions_Message, [ExtractFileName(FileName)]), CERR_WARNING, 0);
end;
end;
function TmodelTsProjectFileAction.CompileModel: Boolean;
begin
HasCompileWarning := False; // I4706
CheckFilenameConventions;
Log(plsInfo, Format('Compiling ''%s''%s...', [Filename, IfThen(IsDebug, ' with debug symbols ', '')]), 0, 0);
//compile the model
ForceDirectories(ExtractFileDir(TargetFileName));
Result := CompileModelFile(Self, FileName, TargetFileName, IsDebug);
if HasCompileWarning and (WarnAsError or OwnerProject.Options.CompilerWarningsAsErrors) then Result := False; // I4706
if Result
then Log(plsSuccess, Format('''%s'' was compiled successfully to ''%s''.', [FileName, TargetFileName]), 0, 0) // I4504
else Log(plsFailure, Format('''%s'' was not compiled successfully.', [FileName]), 0, 0); // I4504
end;
initialization
RegisterProjectFileType('.ts', TmodelTsProjectFileAction);
end.