Part of #9473.
KmnCompiler now implements KeymanCompiler, including the returned
artifacts. Also establishes the common types for the compiler interfaces
and consolidates and renames various API surfaces for kmc-kmn.
Fixes#10003.
Multiple small fixes required here:
* Add .kpj as an editable file type
* Ensure that when OpenFile returns nil (which it always will for a
.kpj), that we don't crash
* Ensure that projects open in a new process rather than replacing the
current project session
Adds a TODO for New Project -- this should be opened in a new process if
we already have a project open in the current process. Will push this
into a separate PR.
Refactor the file-opening code so it can be used by Keyman Developer UI
as well as command-line, and then add support for opening files in
per-project instances from File|Open and friends.
Also moves the initialization code out of tike.dpr into
Keyman.Developer.System.Main.pas, which makes it easier to maintain and
read.
This is a bit of an omnibus commit, apologies for that. This commit
moves Keyman Developer to a proper multi-process model, where editing
files from multiple projects is handled much more cleanly, with each
project loaded in a separate process.
Files that are edited outside of a project structure are loaded into a
'temporary project' in a single process, which provides a pathway for
existing users who may have legacy files outside the normal Keyman
Developer project model.
There are several components to this:
1. Inter-process communication (Multiprocess, CopyDataHelper units and
multiprocess test project). These modules establish a method of
enumerating running Keyman Developer instances (with EnumWindow),
recording relevant metadata for each instance (by thread id) in the
registry (registry used because it manages contention without
additional effort from us), and communicating between processes with
WM_COPYDATA.
2. Command-line parsing (TikeCommandLine). Determines project ownership
(ProjectOwningFile) for each filename passed on the command-line, and
passes these over to existing instances of Keyman Developer that have
that project loaded, or starts new instances as needed.
3. Temporary project management. Mostly in ProjectUI.
Also, moved GlobalProjectStateWnd management out of ProjectFile.pas and
into Project.pas, alongside other global project variables.
A follow-up will add functionality to determine if a file opened within
the Keyman Developer UI should open in the same instance or in a
separate instance (see TfrmKeymanDeveloper.OpenFileInProject). This will
use the same methodology as TikeCommandLine does now, so may involve
further refactoring.
This commit establishes the idea of 'keyman.kpj' as a future default
filename for Keyman Developer projects, but does not enable it, in
ProjectOwningFile. It is planned to introduce this fixed filename in
version 18.0 (see #10113).
Reverts some of the version 2.0 project functionality, as there are a
number of challenges around populating files for folders that don't have
project definitions, particularly if user attempts to load a folder that
is not a project folder after all but happens, e.g. to have a source
folder in it.
Fixes#10059.
Use of the unsupported and undocumented virtual key output, that doesn't
work in recent Keyman versions, at all, now results in a build warning.
Only a warning, because it did kinda work in old versions of Keyman.
- also found that kmc's validate() should have been async but wasn't, a little bit of churn because of this
- unassigned not implemented yet, but tests in place for it.
- change SectionCompiler.postValidate to only be called during the validate() run of compilation. This way messages will only show once.
For: #9446
For the Project view, the Distribution tab now shows file relative
paths, which helps with organization. Have opted _not_ to show the
relative paths in the other tabs, because that information is visible
when the file details are expanded, and because those files should
always be in SourcePath anyway.
Restricts enumeration of files for the project to the project folder and
the SourcePath folder. This prevents problems where a project may be in
a folder with many subfolders which would take a long time to enumerate,
and avoids confusion where there are source-type files in other folders.
At the same time, sorts out forward slash vs backslash in paths. While
forward slash works in many scenarios, there are several filename
manipulation functions, such as ExpandFileName, which would build valid
but non-optimal paths when forward slashes were encountered, which
cascaded into files appearing to be different and presentation issues.
Relates to #9948.
While the schema validation does check the version already, it gives a
fairly obtuse message, and we can do better.
Found a secondary issue with a iterator type guard needed in
kpj-file-reader when preparing unit test, which was probably masked in
other tests by not verifying all messages generated, so updated all
infrastructure message tests to verify the full set of messages
generated.
Relates to #9948.
When upgrading a project to v2.0, it is important that all source files
are in the same folder. This change makes the upgrade process verify
that this is the case and blocks the upgrade if there are source files
in multiple folders.
Source files are .kmn, .xml (ldml keyboard), .kps, and .model.ts.
For batch builds (e.g. project/compile all) of v2.0 projects, we only
want to build files that are listed in the project's $SOURCEPATH, so
that the project can contain extra folders with source file types that
won't break a project-level build.
Any source file types in extra folders can still be built one-by-one,
which is helpful for investigation and test for keyboard authors, but
will not be built if project build is selected.
This commit also formalizes the source/ SourcePath for upgraded projects
which contain a source/ folder. If the project to be upgraded does not
contain the source/ folder, then no SourcePath is assigned, and any
source file in any folder will be built.