Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(developer): Project upgrade messages now show in Messages panel 🦕 #9969

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions developer/src/tike/main/UfrmMessages.pas
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ procedure TfrmMessages.memoMessageDblClick(Sender: TObject);
mi := FMessageItems[line] as TMessageItem;
FFilename := mi.FileName;

if FFileName = FGlobalProject.FileName then
begin
frmKeymanDeveloper.ShowProject;
Exit;
end;

frm := frmKeymanDeveloper.FindEditorByFileName(FFileName);
if not Assigned(frm) then
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,17 +984,6 @@ procedure TProject.PopulateFolder(const path: string);
end;
end;

{
function IsLMDLKeyboardFile(filename: string): Boolean;
if EndsText('.xml', filename) then
begin
Result := Pos('ldmlKeyboard3.dtd', ReadUtf8FileText(ff)) > 0;
end
else
Result := False;
end;
}

function TProject.CanUpgrade: Boolean;
var
i: Integer;
Expand All @@ -1015,12 +1004,12 @@ function TProject.CanUpgrade: Boolean;
if Options.BuildPath.Contains('$SOURCEPATH') then
begin
Result := False;
FUpgradeMessages.Add('The BuildPath option contains "$SOURCEPATH"');
FUpgradeMessages.Add('The BuildPath project setting contains the "$SOURCEPATH" tag, which is no longer supported');
end;
if Options.BuildPath.Contains('$VERSION') then
begin
Result := False;
FUpgradeMessages.Add('The BuildPath option contains "$VERSION"');
FUpgradeMessages.Add('The BuildPath project setting contains the "$VERSION" tag, which is no longer supported');
end;

for i := 0 to Files.Count - 1 do
Expand All @@ -1037,7 +1026,7 @@ function TProject.CanUpgrade: Boolean;
Continue;
end;

FUpgradeMessages.Add('File '+Files[i].FileName+' is outside the project folder');
FUpgradeMessages.Add('File '+Files[i].FileName+' is outside the project folder. All primary source files must be in the same folder as the project file, or in a subfolder.');
Result := False;
end;
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ function TryUpgradeProject(Project: TProject): TUpgradeResult;
implementation

uses
System.Classes,
System.UITypes,
Vcl.Controls,
Vcl.Dialogs,

UfrmMessages,
Keyman.Developer.System.Project.ProjectLog,
KeymanDeveloperOptions;

function TryUpgradeProject(Project: TProject): TUpgradeResult;
var
msg: string;
begin
Result := urNoAction;

Expand All @@ -29,22 +34,32 @@ function TryUpgradeProject(Project: TProject): TUpgradeResult;
Exit;
end;

{ if not FKeymanDeveloperOptions.PromptForProjectUpgrade then
{ TODO:
if not FKeymanDeveloperOptions.PromptForProjectUpgrade then
begin
// User wishes to stick with v1.0 projects
Exit;
end;}
end;
}

frmMessages.Clear;

if not Project.CanUpgrade then
begin
// Project has restrictions, such as files in wrong folders, so
// we cannot upgrade. Show a message for the user
ShowMessage('The current project cannot be upgraded to v2.0. The following errors were encountered:'#13#10+
Project.UpgradeMessages.Text);
for msg in Project.UpgradeMessages do
begin
Project.Log(plsError, Project.FileName, msg, 0, 0);
end;
MessageDlg('Some issues must be addressed before the current project can '+
'be upgraded to Keyman Developer 17 format. '+
Copy link
Contributor

Choose a reason for hiding this comment

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

l.61 calls it "Keyman Developer 17.0 format".
Do we future-proof with Keyman Developer 17.0+ ....?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it but I think it's a Developer 17 file format and 18 may have a new format. I'm okay with keeping it as is 😁

'Details of the issues are listed in the Messages panel.', mtError, [mbOk], 0);
Exit;
end;

case MessageDlg('The current project can be upgraded to Keyman Developer 17.0 format. Do you wish to upgrade it (recommended)?'#13#10#13#10+
case MessageDlg('The current project can be upgraded to Keyman Developer 17.0 format. '+
'Do you wish to upgrade it (recommended)?'#13#10#13#10+
'Note: upgraded projects will not be readable by older versions of Keyman Developer.',
mtConfirmation, mbYesNoCancel, 0) of
mrNo: Exit;
Expand Down