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

feat(developer): kmc generate #11014

Merged
merged 30 commits into from
Nov 8, 2024
Merged

feat(developer): kmc generate #11014

merged 30 commits into from
Nov 8, 2024

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Mar 16, 2024

Fixes: #10712
Fixes: #10509

kmc-generate is a tool that will replace most aspects of kmconvert (Windows-only). The remaining functionality in kmconvert is importing keyboards from Windows DLLs, which currently requires a running Windows environment (anticipate replacement of this last piece of functionality with something in epic/kmc-convert (#12191))..

kmc-generate follows the same patterns as other kmc modules. All functions are accessible from the kmc command-line tool, and also scriptable with the standalone npm module.

Usage:

kmc generate keyman-keyboard my_kmn_keyboard [options]
kmc generate ldml-keyboard my_ldml_keyboard [options]
kmc generate lexical-model my.en.lexical_model_uniq [options]

Options vary from generator-to-generator. At this point, the generation tooling is largely template-based, which does limit a little what this tool can do. Renaming keyboards and other functionality will emerge in a future kmc module.

Note: TODO list moved to #12641.

User Testing

The purpose of the test here is to verify that the generate command creates a template project for a keyboard or lexical model with appropriate basic metadata.

For each command, run kmc generate <command> --help, to list options for generating the project. Include as many of the options as possible in your next command to generate a template project with them, and give it a sensible name e.g. generated_project.

TEST_KEYMAN_KEYBOARD: For the keyman-keyboard command, follow the instructions above to generate a basic Keyman keyboard. Then use kmc build generated_project to verify that the keyboard builds. Install the resulting .kmp and verify that it installs without error. View the source of the files, and verify that the contents of the generated files look correct and match the parameters you provided.

TEST_LDML_KEYBOARD: For the ldml-keyboard command, follow the instructions above to generate a basic LDML .xml keyboard (e.g. using id generated_ldml_keyboard). Then use kmc build generated_ldml_keyboard to verify that the keyboard builds. Install the resulting .kmp and verify that it installs without error. View the source of the files, and verify that the contents of the generated files look correct and match the parameters you provided.

TEST_LEXICAL_MODEL: For the lexical-model command, follow the instructions above to generate a basic lexical model (e.g. using id generated.en.model). Then use kmc build generated.en.model to verify that the lexical model builds. Install the resulting .kmp on an Android phone and verify that it installs without error. View the source of the files, and verify that the contents of the generated files look correct and match the parameters you provided.

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Mar 16, 2024
@keymanapp-test-bot keymanapp-test-bot bot added this to the B17S4 milestone Mar 16, 2024
@mcdurdin mcdurdin force-pushed the feat/developer/kmc-generate branch 2 times, most recently from 3d22452 to 027ebfa Compare March 17, 2024 00:52
@mcdurdin mcdurdin modified the milestones: B17S4, B17S5 Mar 30, 2024
@darcywong00 darcywong00 modified the milestones: B17S5, B17S6 Apr 12, 2024
@darcywong00 darcywong00 modified the milestones: B17S6, A18S1 Apr 28, 2024
@darcywong00 darcywong00 modified the milestones: A18S1, A18S2 May 11, 2024
@mcdurdin mcdurdin modified the milestones: A18S2, A18S3 May 24, 2024
@mcdurdin mcdurdin modified the milestones: A18S3, A18S4 Jun 7, 2024
@darcywong00 darcywong00 modified the milestones: A18S4, A18S5 Jun 21, 2024
mcdurdin added 4 commits June 26, 2024 06:45
Plenty of todo items left but this is a mostly-functional module for the
kmc generate command for automatically creating keyboard and model
projects.
Cleanup various todo items for kmc generate. Outstanding TODO item is
icon generation for .kmn.
Note: these are more e2e than unit tests. It may be difficult to convert
them into solid unit tests due to the way that kmc-generate works based
on templates.
@mcdurdin mcdurdin force-pushed the feat/developer/kmc-generate branch from 5ccabea to a45abe4 Compare June 25, 2024 20:47
@darcywong00 darcywong00 modified the milestones: A18S11, A18S12 Sep 28, 2024
@dinakaranr
Copy link

Test Results

I tested this issue with the attached "Keyman 18.0.118-alpha-test-11014" build on Windows 10 and 11. I'm sharing my observation here.
Created a new folder under the download folder.
Open the command prompt in this folder.
Executed below commands to generate keyman keyboards.

kmc generate keyman-keyboard kmnkeyboard
kmc generate ldml-keyboard ldml_keyboard
kmc generate lexical-model en.lexicalmodeluniq

Verified that the keyboard folder was created with the specified name

  • TEST_KEYMAN_KEYBOARD (Passed):
  1. Go to the folder that had keyboards.
  2. Open the command prompt in this folder.
  3. Execute the "kmc build keyboard_folder_name" command.
  4. Verified that the build folder was created inside the keyboard's folder.
  5. Verified that the *.kmp file was created inside the build folder.
  6. Install the *.kmp file in Windows 10 or 11
  7. Verified that tha keyboard was added under "English"
  8. Go to the source folder.
  9. Verified that the generated files.
  • TEST_LDML_KEYBOARD (Passed):
  1. Go to the folder that had keyboards.
  2. Open the command prompt in this folder.
  3. Execute the "kmc build keyboard_folder_name" command.
  4. Verified that the build folder was created inside the keyboard's folder.
  5. Verified that the *.kmp file was created inside the build folder.
  6. Install the *.kmp file in Windows 10 or 11
  7. Verified that the keyboard was added under "English"
  8. Go to the source folder.
  9. Verified that the generated files.
  • TEST_LEXICAL_MODEL (Passed):
  1. Go to the folder that had keyboards.
  2. Open the command prompt in this folder.
  3. Execute the "kmc build keyboard_folder_name" command.
  4. Verified that the build folder was created inside the keyboard's folder.
  5. Verified that the *.kmp file was created inside the build folder.
  6. Install the *.kmp file on an Android 12 mobile device.
  7. Verified that the keyboard was added under "English."
  8. Go to the source folder.
  9. Verified that the generated files.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Sep 30, 2024
@darcywong00 darcywong00 modified the milestones: A18S12, A18S13 Oct 11, 2024
@srl295 srl295 self-requested a review October 14, 2024 13:35
@darcywong00 darcywong00 modified the milestones: A18S13, A18S14 Oct 26, 2024

<keys>
<import base="cldr" path="45/keys-Zyyy-punctuation.xml"/>
<import base="cldr" path="45/keys-Zyyy-currency.xml"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the standard import for all LDML keyboards? (vs generator referencing files in a 45/ path)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question @srl295

Copy link
Member Author

Choose a reason for hiding this comment

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

Pinging @srl295 on this query

Is this the standard import for all LDML keyboards? (vs generator referencing files in a 45/ path)

<keys>
  <import base="cldr" path="45/keys-Zyyy-punctuation.xml"/>
  <import base="cldr" path="45/keys-Zyyy-currency.xml"/>

@darcywong00
Copy link
Contributor

whew - I've made 1 pass through all the files

Copy link
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

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

lgtm

@mcdurdin mcdurdin merged commit b80c124 into master Nov 8, 2024
21 checks passed
@mcdurdin mcdurdin deleted the feat/developer/kmc-generate branch November 8, 2024 04:13
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.138-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
4 participants