Skip to content

feat(dict_compiler): rebuild packs on demand#816

Merged
ksqsf merged 2 commits into
rime:masterfrom
ksqsf:feat/pack-rebuild
Feb 13, 2024
Merged

feat(dict_compiler): rebuild packs on demand#816
ksqsf merged 2 commits into
rime:masterfrom
ksqsf:feat/pack-rebuild

Conversation

@ksqsf
Copy link
Copy Markdown
Member

@ksqsf ksqsf commented Feb 11, 2024

Pull request

Issue tracker

Fixes will automatically close the related issue

Fixes #

Feature

Rebuild packs if the pack source dict file is updated, even if the primary table is not updated.

Previously, packs are only rebuilt after the primary table is rebuilt.

Unit test

  • Done

Manual test

  • Done

Tested with:

  • no packs
  • one pack, build successful, able to use words in the pack
  • one pack, unmodified, won't rebuild
  • one pack, remove source file, able to use the prebuilt table
  • one pack, modified, can rebuild automatically
  • multiple packs, remove one source file, the other can still be used
  • multiple packs, only modified pack gets rebuilt
  • modified primary dict, all packs will be rebuilt except those lacking source files (I'm not sure if this is safe, but the current design of dictionary packs is also vulnerable to this kind of problem.)

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

To test, create two dict.yaml files:

# Rime dict
---
name: sample_pack1
version: '1.0'
sort: original
use_preset_vocabulary: false
...

粗鄙之語	cu bi zhi yu
---
name: sample_pack2
version: '1.0'
sort: original
use_preset_vocabulary: false
...

粗鄙之語児	cu bi zhi yu er

Edit luna_pinyin.schema.yaml so the packs can be built and loaded:

translator:
  #...
  packs:
    - sample_pack1
    - sample_pack2
image

Rebuild packs if the pack source dict file is updated, even if the
primary table is not updated.

Previously, packs are only rebuilt after the primary table is updated.
@ksqsf ksqsf force-pushed the feat/pack-rebuild branch from 38831b4 to f17ebbf Compare February 11, 2024 17:49
@ksqsf ksqsf requested a review from lotem February 12, 2024 08:49
Copy link
Copy Markdown
Member

@lotem lotem left a comment

Choose a reason for hiding this comment

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

强强强

@ksqsf ksqsf merged commit 28d1e7e into rime:master Feb 13, 2024
graphemecluster pushed a commit to TypeDuck-HK/librime that referenced this pull request Mar 18, 2024
Rebuild packs if the pack source dict file is updated, even if the
primary table is not updated.

Previously, packs are only rebuilt after the primary table is updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants