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): Support blank or missing .model_info/.keyboard_info 🎺 #9351

Closed
75 of 86 tasks
Tracked by #9235
mcdurdin opened this issue Jul 26, 2023 · 4 comments
Closed
75 of 86 tasks
Tracked by #9235

Comments

@mcdurdin
Copy link
Member

mcdurdin commented Jul 26, 2023

With license from kps:Options/LicenseFile == LICENSE.md, and all other data from package/keyboard sources and binaries

Generated fields that don't need change.

The following fields are reliably automatically generated, and we should avoid modifying the code for these:

  • id: from folder name
  • name: from .kmp (or from .js?)
  • authorName: from .kmp
  • authorEmail: from .kmp
  • lastModifiedDate: when .keyboard_info is generated
  • packageFilename: from .kmp
  • packageFileSize: from .kmp
  • jsFilename: from .js
  • jsFileSize: from .js
  • isRTL: from .js or .kmp
  • encodings: 'unicode'
  • packageIncludes: from .kmp
  • version: from .kmp, .js
  • minKeymanVersion: from .kmp, .js
  • helpLink: from folder data (id/source/help/id.php existence)
  • platformSupport: from .kmp, .js
  • sourcePath: generated from the path in keyboards repo
  • deprecated: always generated by deprecation references in links

Have verified that all release/ and experimental/ keyboards have a .kmp file. This means we can deprecate or even remove the .js parsing, I think, as long as all fields are represented in the .kmp.

General tasks

Schema cleanup

The following fields are not available from .kmp, or only partially available. Suggested action:

license field

Action: Add to .kps as LicenseFile, then source that.

description field

Action: Add to .kps, <Info><Description/></Info> and kmp.json. Must be Markdown, not HTML, and no HTML embed is supported.

languages field

This was partially generated from .kps. This is the most complex object.

font, oskFont fields

Action: We will need new a metadata field in the package to support these -- because we cannot necessarily read it all automatically:

  • family: from .kmp
  • source[]: read from .kmp, always make it an array
  • size: remove from .keyboard_info, unused

examples[]{.keys,.text,.note} field

Action:

  • convert into metadata array in .kps / kmp.json:
    <Examples><Example Text="..." Note="..." Keys="Ctrl+Shift+X A B" /></Examples>,
    "examples": [{ "text": "...", "note": "...", "keys": "Ctrl+Shift+X A B"}]

displayName, languageName, scriptName, regionName fields

No change -- always generated automatically from BCP 47

links field

Action:: Only 11 uses, plus some empty arrays. Suggest not supporting in .kps.

related field

Action: on deprecates and note subfields

  • deprecates: add to .kps, a list of ids in <RelatedKeyboards><RelatedKeyboard Id="id" Deprecates="True" /></RelatedKeyboards>
  • note: only used in sil_ipa to ref ipa93_km5, so effectively unused; remove it.

legacyId field

Action: only in legacy keyboards, never generated. Remove altogether as obsolete.

documentationFilename field

Action:: only used in legacy/ keyboards, remove it

documentationFileSize field

Action: only used in legacy/ keyboards, remove it


Should not require changes to end-user apps, although they could benefit from some of the additional metadata in the future, e.g. showing key sequence to type a sample string in the keyboard.

e.g. see keymanapp/keyboards#2308 (comment)

@mcdurdin mcdurdin changed the title Support blank or missing .model_info/.keyboard_info with inferred license from LICENSE.md and all other data from package/keyboard sources and binaries feat(common): Support blank or missing .model_info/.keyboard_info Jul 26, 2023
@mcdurdin mcdurdin changed the title feat(common): Support blank or missing .model_info/.keyboard_info feat(developer): Support blank or missing .model_info/.keyboard_info Jul 26, 2023
@mcdurdin mcdurdin added this to the A17S19 milestone Jul 26, 2023
@darcywong00
Copy link
Contributor

Would this also flag if the .model_info or .keyboard_info doesn't match the package ID? e.g. the fix needed in keymanapp/keyboards#2319

@mcdurdin
Copy link
Member Author

mcdurdin commented Aug 3, 2023

Would this also flag if the .model_info or .keyboard_info doesn't match the package ID? e.g. the fix needed in keymanapp/keyboards#2319

Well, it just wouldn't find the .model_info or .keyboard_info so it would build defaults. It would mean it wouldn't "go wrong" in the deployment like it did for that PR, but the results still may not be what the dev expected because the misspelled .keyboard_info would still be ignored.

mcdurdin added a commit that referenced this issue Aug 11, 2023
Removes the following fields:
* legacyId
* documentationFilename
* documentationFileSize
* links
* related[].note

None of these fields are needed any longer; see #9351 for steps to
remove data.

Eliminates difference between keyboard_info source and distribution,
renaming to keyboard_info.schema.json, and updating the required members
of the json accordingly.

Will have corresponding commits in keyman.com, api.keyman.com,
help.keyman.com, and keyboards repositories.
mcdurdin added a commit to keymanapp/keyman.com that referenced this issue Aug 11, 2023
mcdurdin added a commit to keymanapp/api.keyman.com that referenced this issue Aug 11, 2023
mcdurdin added a commit to keymanapp/keyboards that referenced this issue Aug 11, 2023
Relates to keymanapp/keyman#9351.

Removes:
* links --> details moved into description field
* legacyId --> from old Tavultesoft infrastructure, very much obsolete
  t this point
* documentationFilename, documentationFileSize --> essentially unused,
  never referenced by websites
* related[].note --> only ever used by one keyboard
@mcdurdin mcdurdin changed the title feat(developer): Support blank or missing .model_info/.keyboard_info feat(developer): Support blank or missing .model_info/.keyboard_info 🎺 Aug 11, 2023
@mcdurdin
Copy link
Member Author

In auditing the keyboards repo, I determined that we no longer have any keyboards that are only .js. All keyboards have a .kmp.

The following command lists keyboards that have no .kmp file, running e.g. from release/:

find . -mindepth 2 -maxdepth 2 -type d '!' -exec sh -c 'ls -1 "{}/build"|egrep -i -q ".kmp$"' ';' -print

It also prints an error if there is no build/ folder, e.g. if you failed to build the keyboard.


There are still many keyboards that do not have a .kmx:

  • fv/fv_anicinapemi8in
  • fv/fv_anishinaabemowin
  • fv/fv_atikamekw
  • fv/fv_australian
  • fv/fv_blackfoot
  • fv/fv_bodewadminwen
  • fv/fv_cree_latin
  • fv/fv_dakota_mb
  • fv/fv_dakota_sk
  • fv/fv_denesuline
  • fv/fv_dene_dzage
  • fv/fv_dene_mb
  • fv/fv_dene_nt
  • fv/fv_dene_zhatie
  • fv/fv_dexwlesucid
  • fv/fv_dine_bizaad
  • fv/fv_eastern_canadian_inuktitut
  • fv/fv_goyogohono
  • fv/fv_hulquminum
  • fv/fv_ilnu_innu_aimun
  • fv/fv_inuvialuktun
  • fv/fv_isga_iabi
  • fv/fv_kashogotine_yati
  • fv/fv_klahoose
  • fv/fv_lakota
  • fv/fv_lunaapeewi_huluniixsuwaakan
  • fv/fv_maori
  • fv/fv_moose_cree
  • fv/fv_nakoda
  • fv/fv_naskapi
  • fv/fv_neeaandeg
  • fv/fv_neeaaneegn
  • fv/fv_nexwslayemucen
  • fv/fv_nlha7kapmxtsin
  • fv/fv_northern_east_cree
  • fv/fv_nuxalk
  • fv/fv_ojibwa
  • fv/fv_onayotaaka
  • fv/fv_onodagega_onondagega
  • fv/fv_onodowaga
  • fv/fv_plains_cree
  • fv/fv_sahugotine_yati
  • fv/fv_severn_ojibwa
  • fv/fv_shihgotine_yati
  • fv/fv_skaru_re
  • fv/fv_skicinuwatuwewakon
  • fv/fv_skwxwumesh_snichim
  • fv/fv_southern_carrier
  • fv/fv_swampy_cree
  • fv/fv_tlicho_yatii
  • fv/fv_tsuutina
  • fv/fv_uummarmiutun
  • fv/fv_wendat
  • fv/fv_wobanakiodwawogan
  • gff/gff_amharic_classic
  • gff/gff_harege_fidelat
  • gff/gff_mesobe_fidelat
  • i/inuktitut_latin
  • i/inuktitut_pirurvik
  • nrc/nrc_crk_cans
  • t/tohono_oodham

For these, we will get as much as we can from the .kmp and fallback to .js for the few fields which are not yet available in the package.

mcdurdin added a commit that referenced this issue Aug 16, 2023
Relates to #9351.

Adds support for building a .keyboard_info file without having source
.keyboard_info file:

* Constructs a default source .keyboard_info in memory
* Hints if license is missing
* If LICENSE.md is present, verifies it matches the MIT license text
* Adds project option to turn on or off metadata generation. This will
  default to False for version 1.0 projects, and to True for version 2.0
  projects. This means that the keyboard repository will need a PR to
  enable metadata generation for existing projects in the repository,
  but this is important to avoid breaking builds for existing projects
  that are not in the repository.
* Turns on additional c8 coverage for kmc projects
@mcdurdin
Copy link
Member Author

Remaining TODO items are tracked in #9235, as this is getting too unwieldy and there are overlapping items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants