libchecker-chart-rules
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChart rule contribution guide
LibChecker图表规则贡献指南
This directory contains the declarative statistics shown on LibChecker's chart
page. A rule describes the data that LibChecker should inspect, the condition
that produces a match, and the labels and icon shown to the user.
Rules cannot execute scripts or arbitrary code. LibChecker owns all APK, DEX,
manifest, and native-file traversal. A rule can only use evidence and operators
that the installed app already implements.
本目录包含LibChecker图表页面展示的声明式统计规则。一条规则定义了LibChecker需要检查的数据、匹配条件,以及展示给用户的标签和图标。
规则无法执行脚本或任意代码。LibChecker全权负责APK、DEX、清单文件和原生文件的遍历。规则只能使用已安装应用已实现的证据和运算符。
Before you start
开始之前
Answer these questions before writing JSON:
- What does the chart measure, and why is it useful to LibChecker users?
- Which installed-app evidence proves a match?
- Can an app produce one yes/no result, or can it match several capabilities?
- Is there a primary HTTPS source that explains the technology or capability?
- Can you test the rule against both matching and non-matching APKs?
Schema v1 supports only the evidence listed in Evidence reference.
If your rule needs another source, such as a DEX field, resource-table entry,
native symbol, certificate property, or arbitrary file content, propose a
generic evidence provider in the LibChecker app first. Do not encode a
workaround in the rule.
New rules should normally start with . Move
them to only after the preview bundle has been tested with a compatible
LibChecker build.
"releaseChannel": "preview-only"stable编写JSON前,请先回答以下问题:
- 该图表衡量什么?对LibChecker用户有何用处?
- 哪些已安装应用的证据可以证明匹配?
- 应用只能产生是/否结果,还是可以匹配多种能力?
- 是否有权威HTTPS来源解释该技术或能力?
- 能否针对匹配和不匹配的APK测试该规则?
Schema v1仅支持证据参考中列出的证据。如果你的规则需要其他来源,比如DEX字段、资源表条目、原生符号、证书属性或任意文件内容,请先在LibChecker应用中提出通用证据提供者的需求,不要在规则中编写变通方案。
新规则通常应从开始。只有在预览bundle通过兼容的LibChecker版本测试后,才能将其移至通道。
"releaseChannel": "preview-only"stableContribution workflow
贡献工作流
- Fork the repository and create a topic branch.
- Choose the closest example in :
rules/- for exact native-library detection.
flutter.json - for exact APK entries with a DEX fallback.
reactivex.json - for facets, recursive conditions, DEX queries, and manifest receiver actions.
itgsa.json - The predicate example below for a numeric comparison.
- Add one UTF-8 JSON file under . Use four-space indentation and name the file after the final segment of the rule ID.
rules/ - Add the referenced SVG under .
icons/ - Update the tests that enumerate rule IDs, icons, catalog size, and stable channel contents. Add focused assertions for the new detection data.
- Run the unit tests and build a preview bundle in a temporary directory.
- Test the preview rule with known matching and non-matching apps.
- Regenerate and
cloud/v1/chart.bundlewith the bundle version and minimum app version agreed for the target branch.cloud/v1/manifest.json - Submit the source rule, icon, tests, generated bundle, and manifest in one pull request. Include your evidence source and manual test results in the PR description.
Run commands from the repository root:
shell
python3 -m unittest chart.tools.test_build_bundle
python3 chart/tools/build_bundle.py \
--bundle-version 12 \
--channel preview \
--minimum-app-version-code 2731 \
--output-dir /tmp/libchecker-chart-previewThe numbers above are examples. Read and the
target branch before choosing a bundle version or minimum app version.
chart/cloud/v1/manifest.json- Fork仓库并创建主题分支。
- 在中选择最接近的示例:
rules/- :用于精确检测原生库。
flutter.json - :用于精确检测APK条目,同时支持DEX fallback。
reactivex.json - :用于多维度规则、递归条件、DEX查询以及清单接收器动作。
itgsa.json - 下方的谓词示例:用于数值比较。
- 在下添加一个UTF-8编码的JSON文件。使用4空格缩进,文件名与规则ID的最后一段一致。
rules/ - 在下添加引用的SVG图标。
icons/ - 更新枚举规则ID、图标、目录大小和稳定通道内容的测试,为新的检测数据添加针对性断言。
- 运行单元测试,并在临时目录中构建预览bundle。
- 使用已知匹配和不匹配的应用测试预览规则。
- 针对目标分支,使用约定的bundle版本和最低应用版本重新生成和
cloud/v1/chart.bundle。cloud/v1/manifest.json - 在一个Pull Request中提交源规则、图标、测试、生成的bundle和清单文件。在PR描述中包含你的证据来源和手动测试结果。
从仓库根目录运行以下命令:
shell
python3 -m unittest chart.tools.test_build_bundle
python3 chart/tools/build_bundle.py \
--bundle-version 12 \
--channel preview \
--minimum-app-version-code 2731 \
--output-dir /tmp/libchecker-chart-preview以上数字仅为示例。在选择bundle版本或最低应用版本前,请先查看和目标分支。
chart/cloud/v1/manifest.jsonRepository layout
仓库结构
| Path | Purpose |
|---|---|
| Reviewed source definitions, one JSON file per statistic. |
| SVG assets referenced by source rules. |
| Machine-readable schema for source rules. |
| Machine-readable schema for the generated manifest. |
| Validator and deterministic bundle generator. |
| Source validation and bundle regression tests. |
| Generated catalog and icons consumed by LibChecker. |
| Generated version, compatibility, size, and checksum metadata. |
| 路径 | 用途 |
|---|---|
| 已审核的源规则定义,每个统计对应一个JSON文件。 |
| 源规则引用的SVG资源。 |
| 源规则的机器可读schema。 |
| 生成的清单文件的机器可读schema。 |
| 验证器和确定性bundle生成工具。 |
| 源规则验证和bundle回归测试。 |
| LibChecker使用的生成目录和图标。 |
| 生成的版本、兼容性、大小和校验和元数据。 |
Minimal rule
最简规则示例
This is a complete single-predicate rule:
json
{
"id": "official.example-sdk",
"revision": 1,
"source": "official",
"releaseChannel": "preview-only",
"title": {
"translations": {
"en": "Example SDK",
"zh-Hans": "示例 SDK"
}
},
"details": {
"description": {
"translations": {
"en": "Example SDK provides a documented capability for Android apps.",
"zh-Hans": "示例 SDK 为 Android 应用提供一项有公开文档的能力。"
}
},
"referenceUrl": "https://example.com/android-sdk"
},
"icon": {
"asset": "icons/example-sdk.svg",
"renderMode": "monochrome",
"tintRole": "on_surface"
},
"calculation": {
"kind": "predicate",
"predicate": {
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libexample.so"
},
"matchedTitle": {
"translations": {
"en": "Example SDK apps",
"zh-Hans": "示例 SDK 应用"
}
},
"unmatchedTitle": {
"translations": {
"en": "Other apps",
"zh-Hans": "其他应用"
}
}
}
},
"fingerprint": "artifact"
}以下是一个完整的单谓词规则:
json
{
"id": "official.example-sdk",
"revision": 1,
"source": "official",
"releaseChannel": "preview-only",
"title": {
"translations": {
"en": "Example SDK",
"zh-Hans": "示例 SDK"
}
},
"details": {
"description": {
"translations": {
"en": "Example SDK provides a documented capability for Android apps.",
"zh-Hans": "示例 SDK 为 Android 应用提供一项有公开文档的能力。"
}
},
"referenceUrl": "https://example.com/android-sdk"
},
"icon": {
"asset": "icons/example-sdk.svg",
"renderMode": "monochrome",
"tintRole": "on_surface"
},
"calculation": {
"kind": "predicate",
"predicate": {
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libexample.so"
},
"matchedTitle": {
"translations": {
"en": "Example SDK apps",
"zh-Hans": "示例 SDK 应用"
}
},
"unmatchedTitle": {
"translations": {
"en": "Other apps",
"zh-Hans": "其他应用"
}
}
}
},
"fingerprint": "artifact"
}Top-level fields
顶层字段
The source schema does not allow unknown fields. The following fields are
available to official online rules.
| Field | Required | Type or allowed values | Meaning |
|---|---|---|---|
| Yes | String matching | Permanent identity of the statistic. |
| Yes | Integer, minimum | Version of this rule definition. |
| Yes | | Online rules in this repository are official rules. |
| Yes | Translated text | Chart title shown by LibChecker. |
| Yes | Object | In-app description and primary reference URL. |
| Yes | Object | Bundled SVG and its rendering behavior. |
| Yes | | How apps are classified. |
| No | | Controls which generated bundle includes the rule. Defaults to |
| No | | Availability gate. Schema v1 online rules only support |
| No | Boolean | Hides the chart until feature initialization finishes. Defaults to |
| No | Empty array only | Online controls are not supported in schema v1. |
| No | | Online dashboard integrations are not supported in schema v1. |
| No | | Selects the app-data fingerprint used to invalidate cached chart results. |
JSON Schema values document client defaults. The bundle builder does
not insert missing optional fields into the generated catalog.
default源schema不允许未知字段。以下字段适用于官方在线规则。
| 字段 | 是否必填 | 类型或允许值 | 含义 |
|---|---|---|---|
| 是 | 匹配 | 统计规则的永久标识。 |
| 是 | 整数,最小值为 | 该规则定义的版本。 |
| 是 | | 本仓库中的在线规则均为官方规则。 |
| 是 | 多语言文本 | LibChecker展示的图表标题。 |
| 是 | 对象 | 应用内描述和主参考URL。 |
| 是 | 对象 | 打包的SVG及其渲染行为。 |
| 是 | | 应用分类方式。 |
| 否 | | 控制该规则包含在哪个生成的bundle中,默认值为 |
| 否 | | 可用性限制。Schema v1在线规则仅支持 |
| 否 | 布尔值 | 控制图表是否在功能初始化完成后显示,默认值为 |
| 否 | 仅允许空数组 | Schema v1不支持在线控件。 |
| 否 | | Schema v1不支持在线仪表盘集成。 |
| 否 | | 选择用于使缓存图表结果失效的应用数据指纹类型。 |
JSON Schema的值记录了客户端默认值。bundle构建器不会将缺失的可选字段插入到生成的目录中。
defaultid
idid
idThe ID must match:
text
^official\.[a-z0-9]+(?:[.-][a-z0-9]+)*$Examples:
- Valid: ,
official.flutter,official.android-api-level.official.vendor.capability - Invalid: ,
flutter,official.Flutter.official_target_sdk
Use a specific, technology-neutral ID. Once a rule has been published, never
reuse its ID for a different statistic. The source filename should match the
last ID segment, such as in .
official.flutterflutter.jsonID必须匹配以下格式:
text
^official\.[a-z0-9]+(?:[.-][a-z0-9]+)*$示例:
- 有效:、
official.flutter、official.android-api-level。official.vendor.capability - 无效:、
flutter、official.Flutter。official_target_sdk
使用具体、技术中立的ID。规则发布后,请勿将其ID重新用于其他统计规则。源文件名应与ID的最后一段一致,例如对应。
official.flutterflutter.jsonrevision
revisionrevision
revisionStart a new rule at revision . Increase the revision whenever a published
rule changes its matching logic, titles, description, icon, calculation type,
or other presentation metadata. A change to repository documentation alone
does not require a rule revision.
1The revision belongs to one rule. It is independent of the generated bundle's
.
bundleVersion新规则从版本开始。每当已发布的规则更改匹配逻辑、标题、描述、图标、计算类型或其他展示元数据时,需递增版本号。仅修改仓库文档不需要更新规则版本。
1版本号属于单个规则,与生成bundle的独立。
bundleVersionsource
sourcesource
sourceEvery rule submitted to this repository must use:
json
"source": "official"The builder rejects other values.
提交到本仓库的所有规则必须使用:
json
"source": "official"构建器会拒绝其他值。
Translated text
多语言文本
titledetails.descriptionjson
{
"translations": {
"en": "English text",
"zh-Hans": "简体中文文本"
}
}titledetails.descriptionjson
{
"translations": {
"en": "English text",
"zh-Hans": "简体中文文本"
}
}Translated-text parameters
多语言文本参数
| Parameter | Type | Required | Allowed values and limits | Meaning |
|---|---|---|---|---|
| Object | Yes | 2 to 16 locale entries; must include | Maps locale tags to the text shown by LibChecker. |
| String | Yes for each declared locale | Non-empty; 80 characters for chart and group titles, 40 for facet titles and short titles, 1,500 for descriptions | Localized value for one BCP 47-style locale tag. |
| Locale key | Allowed | Meaning |
|---|---|---|
| Required | English text and runtime fallback. |
| Required | Simplified Chinese text. |
| Rejected | These tags are intentionally not accepted; use |
| Other schema-compatible tags | Optional | Additional translations, for example |
Rules for translations:
- and
enare required. English is the runtime fallback.zh-Hans - Use for Simplified Chinese.
zh-Hansandzhare rejected.zh-CN - A translated object must contain 2 to 16 locales.
- Locale keys use BCP 47-style tags accepted by the schema, such as ,
en,zh-Hans, orpt-BR.es-419 - Each translation must be a non-empty string.
- ,
title, andmatchedTitleallow up to 80 characters.unmatchedTitle - A facet and
titleallow up to 40 characters.shortTitle - allows up to 1,500 characters.
details.description - Keep equivalent meaning across locales. Do not add claims to one language that are absent from another.
Use short labels for chart and group titles. The matched and unmatched titles
name the two result groups, for example and .
Flutter appsOther apps| 参数 | 类型 | 是否必填 | 允许值和限制 | 含义 |
|---|---|---|---|---|
| 对象 | 是 | 2到16个区域条目;必须包含 | 映射区域标签到LibChecker展示的文本。 |
| 字符串 | 是(每个声明的区域) | 非空;图表和组标题最多80字符,维度标题和短标题最多40字符,描述最多1500字符 | 单个BCP 47格式区域标签的本地化值。 |
| 区域键 | 是否允许 | 含义 |
|---|---|---|
| 必填 | 英文文本,作为运行时 fallback。 |
| 必填 | 简体中文文本。 |
| 拒绝 | 这些标签不被接受,请使用 |
| 其他兼容schema的标签 | 可选 | 额外的翻译,例如 |
翻译规则:
- 必须包含和
en,英文作为运行时 fallback。zh-Hans - 使用表示简体中文,拒绝
zh-Hans和zh。zh-CN - 多语言对象必须包含2到16个区域。
- 区域键使用schema接受的BCP 47格式标签,例如、
en、zh-Hans或pt-BR。es-419 - 每个翻译必须是非空字符串。
- 、
title和matchedTitle最多允许80字符。unmatchedTitle - 维度和
title最多允许40字符。shortTitle - 最多允许1500字符。
details.description - 保持不同语言的含义一致,不要在一种语言中添加另一种语言没有的声明。
图表和组标题使用简短标签。匹配和不匹配标题用于命名两个结果组,例如和。
Flutter appsOther appsDetails and reference URL
详情和参考URL
detailsjson
"details": {
"description": {
"translations": {
"en": "A neutral introduction to the technology.",
"zh-Hans": "对该技术的中性介绍。"
}
},
"referenceUrl": "https://project.example/documentation"
}detailsjson
"details": {
"description": {
"translations": {
"en": "A neutral introduction to the technology.",
"zh-Hans": "对该技术的中性介绍。"
}
},
"referenceUrl": "https://project.example/documentation"
}Details parameters
详情参数
| Parameter | Type | Required | Allowed values and limits | Meaning |
|---|---|---|---|---|
| Translated text | Yes | | Neutral in-app introduction to the technology or capability. |
| String | Yes | HTTPS URL, valid host, no credentials or whitespace, maximum 512 characters | Primary source opened from the introduction dialog. |
Write a short, neutral description of the technology or capability. Do not say
that the currently selected app matches the rule. LibChecker appends the actual
analysis result at runtime. Faceted rules also list the matched facet titles.
referenceUrl- use HTTPS;
- contain a valid host;
- contain no username, password, or whitespace;
- be no longer than 512 characters;
- point to a primary project, standards body, vendor, or platform document.
Do not use tracking links, URL shorteners, affiliate links, search results, or
an unreviewed third-party summary.
| 参数 | 类型 | 是否必填 | 允许值和限制 | 含义 |
|---|---|---|---|---|
| 多语言文本 | 是 | 包含 | 对技术或能力的中性应用内介绍。 |
| 字符串 | 是 | HTTPS URL,包含有效主机,无凭据或空白字符,最多512字符 | 从介绍对话框打开的主来源。 |
编写简短、中性的技术或能力描述。不要说明当前选中的应用是否匹配规则,LibChecker会在运行时追加实际分析结果。多维度规则还会列出匹配的维度标题。
referenceUrl- 使用HTTPS;
- 包含有效主机;
- 不包含用户名、密码或空白字符;
- 长度不超过512字符;
- 指向项目、标准机构、厂商或平台的官方文档。
请勿使用跟踪链接、短链接、联盟链接、搜索结果或未审核的第三方摘要。
Icons
图标
Every online rule references one repository asset:
json
"icon": {
"asset": "icons/example-sdk.svg",
"renderMode": "monochrome",
"tintRole": "on_surface"
}每个在线规则引用一个仓库资源:
json
"icon": {
"asset": "icons/example-sdk.svg",
"renderMode": "monochrome",
"tintRole": "on_surface"
}Icon fields
图标字段
| Field | Required | Allowed values | Meaning |
|---|---|---|---|
| Yes | | Repository-relative path included in the bundle. |
| No | | Whether LibChecker applies a theme tint. Defaults to |
| No | | Theme color used for a monochrome icon. Defaults to |
Use only when the original brand colors carry meaning. LibChecker
does not apply to an icon. Use for a shape
that should adapt to the active theme.
originaltintRoleoriginalmonochrome| 字段 | 是否必填 | 允许值 | 含义 |
|---|---|---|---|
| 是 | | 仓库相对路径,会被包含在bundle中。 |
| 否 | | LibChecker是否应用主题色调,默认值为 |
| 否 | | 单色图标的主题颜色,默认值为 |
仅当原始品牌颜色具有特殊含义时使用。LibChecker不会对图标应用。对于需要适配当前主题的形状,使用。
originaloriginaltintRolemonochromeSVG requirements
SVG要求
An SVG must:
- use a viewBox;
0 0 1024 1024 - keep the artwork approximately within a centered area so that icons have consistent optical size;
800 x 800 - remain below 64 KiB;
- be valid UTF-8;
- contain no scripts, styles, text nodes, linked images, entities, external
references, or content.
url(...)
The validator rejects , , , ,
, , , , , , and .
Convert text to paths and inline any required fill colors.
<!doctype<!entity<?xml-stylesheet<script<foreignObject<image<style<texthref=xlink:url(SVG必须满足:
- 使用的viewBox;
0 0 1024 1024 - 图形大致位于居中的区域内,确保图标视觉大小一致;
800 x 800 - 大小不超过64 KiB;
- 为有效的UTF-8编码;
- 不包含脚本、样式、文本节点、链接图片、实体、外部引用或内容。
url(...)
验证器会拒绝、、、、、、、、、和。将文本转换为路径,并内联所有必要的填充颜色。
<!doctype<!entity<?xml-stylesheet<script<foreignObject<image<style<texthref=xlink:url(Choosing a calculation type
选择计算类型
Use when every app belongs to one of two groups. Use when
one app can match several named capabilities and the UI should show each match
as a chip.
predicatefacets| Question | Use |
|---|---|
| Does the app target SDK 35 or newer? | |
Does the app contain | |
| Which ITGSA capabilities does the app implement? | |
当每个应用只能属于两个组之一时,使用。当一个应用可以匹配多个命名能力,且UI需要将每个匹配显示为标签时,使用。
predicatefacets| 问题 | 使用类型 |
|---|---|
| 应用的目标SDK是否为35或更高? | |
应用是否包含 | |
| 应用实现了哪些ITGSA能力? | |
Calculation parameters
计算参数
| Parameter | Type | Required | Possible values | Meaning |
|---|---|---|---|---|
| String | Yes | | Selects the calculation object that must accompany it. |
| Object | Required when | See Predicate calculations | Produces matched and unmatched groups from one condition. |
| Object | Required when | See Facet calculations | Produces matched and unmatched groups plus per-app capability chips. |
Only the object selected by is allowed. Online rules cannot use the
client's built-in calculation type.
kindnativeFacets are for overlapping capabilities. Do not use them for mutually
exclusive buckets or numeric distributions. Schema v1 has no online
calculation type for those cases.
Predicate calculations
谓词计算
A predicate requires , , and exactly one complete
condition. For a single evidence leaf, put , , and
directly in :
matchedTitleunmatchedTitleevidenceoperatorvaluepredicate| Parameter | Type | Required | Possible values and limits | Meaning |
|---|---|---|---|---|
| Translated text | Yes | 1 to 80 characters per locale | Label for apps whose condition evaluates to true. |
| Translated text | Yes | 1 to 80 characters per locale | Label for apps whose condition evaluates to false. |
| String | Required for direct-leaf form | | Evidence provider used by the leaf. |
| String | Required for direct-leaf form | Depends on | Comparison applied to the evidence. |
| Object | Required for direct-leaf form | Exactly one value variant compatible with | Expected value for the comparison. |
| Condition | Required for recursive form | One leaf, | Recursive condition used instead of the three direct-leaf fields. |
json
"calculation": {
"kind": "predicate",
"predicate": {
"evidence": "target_sdk",
"operator": "greater_than_or_equal",
"value": {
"integer": 35
},
"matchedTitle": {
"translations": {
"en": "Target SDK 35 or newer",
"zh-Hans": "Target SDK 35 及以上"
}
},
"unmatchedTitle": {
"translations": {
"en": "Target SDK 34 or older",
"zh-Hans": "Target SDK 34 及以下"
}
}
}
}For logical composition, replace the direct leaf fields with one :
conditionjson
"predicate": {
"condition": {
"any": [
{
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libexample.so"
}
},
{
"evidence": "manifest_receiver_action",
"operator": "contains_any",
"value": {
"strings": [
"com.example.ACTION_READY"
]
}
}
]
},
"matchedTitle": {
"translations": {
"en": "Example apps",
"zh-Hans": "示例应用"
}
},
"unmatchedTitle": {
"translations": {
"en": "Other apps",
"zh-Hans": "其他应用"
}
}
}Do not provide both the direct fields and . Partial direct tuples
are also rejected.
condition谓词需要、和一个完整的条件。对于单个证据节点,直接在中设置、和:
matchedTitleunmatchedTitlepredicateevidenceoperatorvalue| 参数 | 类型 | 是否必填 | 可能值和限制 | 含义 |
|---|---|---|---|---|
| 多语言文本 | 是 | 每个区域1到80字符 | 条件为真的应用标签。 |
| 多语言文本 | 是 | 每个区域1到80字符 | 条件为假的应用标签。 |
| 字符串 | 直接节点形式必填 | | 节点使用的证据提供者。 |
| 字符串 | 直接节点形式必填 | 取决于 | 应用于证据的比较方式。 |
| 对象 | 直接节点形式必填 | 与 | 比较的预期值。 |
| 条件 | 递归形式必填 | 单个节点、 | 替代三个直接节点字段的递归条件。 |
json
"calculation": {
"kind": "predicate",
"predicate": {
"evidence": "target_sdk",
"operator": "greater_than_or_equal",
"value": {
"integer": 35
},
"matchedTitle": {
"translations": {
"en": "Target SDK 35 or newer",
"zh-Hans": "Target SDK 35 及以上"
}
},
"unmatchedTitle": {
"translations": {
"en": "Target SDK 34 or older",
"zh-Hans": "Target SDK 34 及以下"
}
}
}
}对于逻辑组合,将直接节点字段替换为一个:
conditionjson
"predicate": {
"condition": {
"any": [
{
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libexample.so"
}
},
{
"evidence": "manifest_receiver_action",
"operator": "contains_any",
"value": {
"strings": [
"com.example.ACTION_READY"
]
}
}
]
},
"matchedTitle": {
"translations": {
"en": "Example apps",
"zh-Hans": "示例应用"
}
},
"unmatchedTitle": {
"translations": {
"en": "Other apps",
"zh-Hans": "其他应用"
}
}
}请勿同时提供直接字段和,部分直接元组也会被拒绝。
conditionFacet calculations
维度计算
A facet calculation contains 1 to 8 ordered items:
| Parameter | Type | Required | Possible values and limits | Meaning |
|---|---|---|---|---|
| Translated text | Yes | 1 to 80 characters per locale | Chart label for apps matching at least one facet. |
| Translated text | Yes | 1 to 80 characters per locale | Chart label for apps matching no facets. |
| Array | Yes | 1 to 8 facet objects | Ordered capability definitions. |
| String | Yes | Lowercase rule-local ID matching the documented pattern; unique within the rule | Stable internal identity of a facet. |
| Translated text | Yes | 1 to 40 characters per locale | Full facet label used in detailed result surfaces and chart chips. |
| Translated text | No | 1 to 40 characters per locale | Compact label used in matched-facet summaries; falls back to |
| Condition | Yes | One leaf, | Determines whether this facet matches an app. |
json
"calculation": {
"kind": "facets",
"facets": {
"matchedTitle": {
"translations": {
"en": "Example capability apps",
"zh-Hans": "示例能力应用"
}
},
"unmatchedTitle": {
"translations": {
"en": "Other apps",
"zh-Hans": "其他应用"
}
},
"items": [
{
"id": "service-kit",
"title": {
"translations": {
"en": "Service Kit",
"zh-Hans": "服务套件"
}
},
"shortTitle": {
"translations": {
"en": "Kit",
"zh-Hans": "套件"
}
},
"condition": {
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libexample_service.so"
}
}
}
]
}
}Each item requires:
- a rule-local matching
id;^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$ - a unique, stable ID within the rule;
- a translated of at most 40 characters per locale;
title - an optional translated of at most 40 characters per locale;
shortTitle - exactly one .
condition
An app enters the matched chart group when at least one facet matches. All
matching facet titles are shown as chips in the order declared by .
Compact matched-facet summaries use when present and otherwise
fall back to .
Do not duplicate facet conditions in a separate root expression.
itemsshortTitletitleany维度计算包含1到8个有序条目:
| 参数 | 类型 | 是否必填 | 可能值和限制 | 含义 |
|---|---|---|---|---|
| 多语言文本 | 是 | 每个区域1到80字符 | 至少匹配一个维度的应用的图表标签。 |
| 多语言文本 | 是 | 每个区域1到80字符 | 不匹配任何维度的应用的图表标签。 |
| 数组 | 是 | 1到8个维度对象 | 有序的能力定义。 |
| 字符串 | 是 | 符合文档格式的小写规则本地ID;在规则内唯一 | 维度的稳定内部标识。 |
| 多语言文本 | 是 | 每个区域1到40字符 | 详细结果界面和图表标签中使用的完整维度标签。 |
| 多语言文本 | 否 | 每个区域1到40字符 | 匹配维度摘要中使用的紧凑标签;省略时回退到 |
| 条件 | 是 | 单个节点、 | 确定该维度是否匹配应用。 |
json
"calculation": {
"kind": "facets",
"facets": {
"matchedTitle": {
"translations": {
"en": "Example capability apps",
"zh-Hans": "示例能力应用"
}
},
"unmatchedTitle": {
"translations": {
"en": "Other apps",
"zh-Hans": "其他应用"
}
},
"items": [
{
"id": "service-kit",
"title": {
"translations": {
"en": "Service Kit",
"zh-Hans": "服务套件"
}
},
"shortTitle": {
"translations": {
"en": "Kit",
"zh-Hans": "套件"
}
},
"condition": {
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libexample_service.so"
}
}
}
]
}
}每个条目需要:
- 符合的规则本地
^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$;id - 规则内唯一的稳定ID;
- 每个区域最多40字符的多语言;
title - 可选的每个区域最多40字符的多语言;
shortTitle - 一个。
condition
当应用至少匹配一个维度时,进入匹配图表组。所有匹配的维度标题会按照声明的顺序显示为标签。紧凑的匹配维度摘要会使用(如果存在),否则回退到。请勿在单独的根表达式中重复维度条件。
itemsshortTitletitleanyConditions
条件
A condition is either one typed evidence leaf or one logical operator.
Additional properties are rejected.
条件可以是一个类型化的证据节点,也可以是一个逻辑运算符。额外的属性会被拒绝。
Condition object parameters
条件对象参数
| Parameter | Type | Required | Possible values and limits | Meaning |
|---|---|---|---|---|
| String | Required for a leaf | | Selects the app data to inspect. |
| String | Required for a leaf | | Selects the comparison. |
| Object | Required for a leaf | Exactly one of | Supplies the expected value. |
| Array of conditions | Required for an | 1 to 16 children | True when every child is true. |
| Array of conditions | Required for an | 1 to 16 children | True when at least one child is true. |
| Condition | Required for a | One child object | Inverts the child result. |
Exactly one operation is allowed. A leaf must contain all of ,
, and ; a logical node must contain only , , or
.
evidenceoperatorvalueallanynot| 参数 | 类型 | 是否必填 | 可能值和限制 | 含义 |
|---|---|---|---|---|
| 字符串 | 节点必填 | | 选择要检查的应用数据。 |
| 字符串 | 节点必填 | | 选择比较方式。 |
| 对象 | 节点必填 | | 提供预期值。 |
| 条件数组 | | 1到16个子条件 | 所有子条件为真时为真。 |
| 条件数组 | | 1到16个子条件 | 至少一个子条件为真时为真。 |
| 条件 | | 一个子条件对象 | 反转子条件的结果。 |
仅允许一个操作。节点必须包含、和;逻辑节点必须仅包含、或。
evidenceoperatorvalueallanynotValue object parameters
值对象参数
| Parameter | Type | Used by | Allowed values and limits | Meaning |
|---|---|---|---|---|
| Integer | | Any JSON integer | Numeric comparison target. |
| String | | 1 to 160 safe filename characters | Exact native-library filename. |
| Array of strings | | 1 to 16 values, each 1 to 160 safe characters for its evidence type | Exact archive entries or receiver actions; any listed value may match. |
| Array of DEX class queries | | 1 to 16 queries | Class queries; any query may match. |
| Manifest attribute query | | One | Exact application-manifest Boolean attribute and expected value. |
One value object must contain exactly one of these parameters.
| 参数 | 类型 | 适用场景 | 允许值和限制 | 含义 |
|---|---|---|---|---|
| 整数 | | 任意JSON整数 | 数值比较目标。 |
| 字符串 | | 1到160个安全文件名字符 | 精确的原生库文件名。 |
| 字符串数组 | | 1到16个值,每个值对应证据类型为1到160个安全字符 | 精确的归档条目或接收器动作;列出的任意值均可匹配。 |
| DEX类查询数组 | | 1到16个查询 | 类查询;任意查询均可匹配。 |
| 清单属性查询 | | 一个 | 精确的应用清单布尔属性及其预期值。 |
一个值对象必须仅包含上述参数中的一个。
Evidence leaf
证据节点
json
{
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libflutter.so"
}
}All three fields are required and must use a compatible combination from the
evidence table below.
json
{
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libflutter.so"
}
}三个字段均为必填项,且必须使用下方证据表中的兼容组合。
Logical operators
逻辑运算符
| Operator | Value | Result |
|---|---|---|
| Array of 1 to 16 conditions | Matches when every child matches. |
| Array of 1 to 16 conditions | Matches when at least one child matches. |
| One condition object | Inverts the child result. |
Example:
json
{
"all": [
{
"evidence": "target_sdk",
"operator": "greater_than_or_equal",
"value": {
"integer": 35
}
},
{
"not": {
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "liblegacy.so"
}
}
}
]
}| 运算符 | 值 | 结果 |
|---|---|---|
| 1到16个条件的数组 | 所有子条件匹配时匹配。 |
| 1到16个条件的数组 | 至少一个子条件匹配时匹配。 |
| 一个条件对象 | 反转子条件的结果。 |
示例:
json
{
"all": [
{
"evidence": "target_sdk",
"operator": "greater_than_or_equal",
"value": {
"integer": 35
}
},
{
"not": {
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "liblegacy.so"
}
}
}
]
}Condition limits
条件限制
- Maximum nesting depth: 8, with the root condition at depth 1.
- Maximum condition nodes: 64 per predicate calculation. A facet rule shares the same 64-node budget across all facet conditions.
- Maximum children in one or
all: 16.any - A condition object must define exactly one operation. It cannot mix a leaf
with ,
all, orany.not
Prefer the narrowest condition that is supported by reliable evidence. A long
condition is not necessarily a more accurate condition.
- 最大嵌套深度:8,根条件为深度1。
- 最大条件节点:每个谓词计算64个。维度规则的所有维度条件共享64个节点的预算。
- 单个或
all的最大子条件数:16。any - 条件对象必须仅定义一个操作,不能将节点与、
all或any混合。not
优先选择可靠证据支持的最窄条件。长条件不一定更准确。
Evidence reference
证据参考
| Evidence | Operator | Value object | Match behavior |
|---|---|---|---|
| | | Compares the app's target SDK value. |
| | | Matches an exact native-library filename. |
| | | Matches when any exact entry exists in the base or split APKs. |
| | | Matches when any query matches one DEX class. |
| | | Matches when any listed action is declared by a manifest receiver. |
| | | Matches an explicitly declared application-manifest Boolean attribute. |
| 证据 | 运算符 | 值对象 | 匹配行为 |
|---|---|---|---|
| | | 比较应用的目标SDK值。 |
| | | 匹配精确的原生库文件名。 |
| | | 当基础APK或拆分APK中存在任意精确条目时匹配。 |
| | | 当任意查询匹配一个DEX类时匹配。 |
| | | 当清单接收器声明了任意列出的动作时匹配。 |
| | | 匹配显式声明的应用清单布尔属性。 |
target_sdk
target_sdktarget_sdk
target_sdkThe integer is compared with the target API recorded for the installed app.
The schema does not impose an API-level range, but the value should represent a
real Android API level.
json
{
"evidence": "target_sdk",
"operator": "less_than_or_equal",
"value": {
"integer": 34
}
}Use or omit for a rule that only depends
on target SDK metadata.
fingerprint: standardfingerprint整数与已安装应用记录的目标API级别比较。Schema不限制API级别范围,但值应代表真实的Android API级别。
json
{
"evidence": "target_sdk",
"operator": "less_than_or_equal",
"value": {
"integer": 34
}
}对于仅依赖目标SDK元数据的规则,使用或省略。
fingerprint: standardfingerprintnative_library
native_librarynative_library
native_libraryThe value is an exact filename, not a path and not a regular expression.
LibChecker checks extracted libraries and libraries packaged in the APK.
.sojson
{
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libflutter.so"
}
}The string must be 1 to 160 characters and may contain ASCII letters, digits,
periods, underscores, plus signs, and hyphens. Use .
fingerprint: artifact值为精确的文件名,不是路径或正则表达式。LibChecker会检查提取的库和APK中打包的库。
.sojson
{
"evidence": "native_library",
"operator": "contains",
"value": {
"string": "libflutter.so"
}
}字符串必须为1到160字符,可包含ASCII字母、数字、句点、下划线、加号和连字符。使用。
fingerprint: artifactarchive_entry
archive_entryarchive_entry
archive_entryThis evidence checks exact ZIP entry names across the base and split APKs. It
does not read file contents and does not support prefixes, globs, or regular
expressions.
json
{
"evidence": "archive_entry",
"operator": "contains_any",
"value": {
"strings": [
"META-INF/example.properties"
]
}
}The list must contain 1 to 16 entry names. Each name must be 1 to 160
characters, use only ASCII letters, digits, periods, underscores, plus signs,
hyphens, and slashes, and must not end in a slash or contain or path
segments. Use .
...fingerprint: artifact该证据检查基础APK和拆分APK中的精确ZIP条目名称。它不读取文件内容,不支持前缀、通配符或正则表达式。
json
{
"evidence": "archive_entry",
"operator": "contains_any",
"value": {
"strings": [
"META-INF/example.properties"
]
}
}列表必须包含1到16个条目名称。每个名称必须为1到160字符,仅使用ASCII字母、数字、句点、下划线、加号、连字符和斜杠,且不能以斜杠结尾或包含或路径段。使用。
...fingerprint: artifactmanifest_receiver_action
manifest_receiver_actionmanifest_receiver_action
manifest_receiver_actionThis evidence reads actions from manifest-declared broadcast receivers across
the base and split APKs. It matches when at least one supplied action is found.
json
{
"evidence": "manifest_receiver_action",
"operator": "contains_any",
"value": {
"strings": [
"com.example.ACTION_TRIM",
"com.example.ACTION_KILL"
]
}
}The list must contain 1 to 16 strings. Each action must be 1 to 160 characters
and may contain ASCII letters, digits, underscores, periods, and hyphens. Use
.
fingerprint: artifact该证据读取基础APK和拆分APK中清单声明的广播接收器的动作。当找到任意提供的动作时匹配。
json
{
"evidence": "manifest_receiver_action",
"operator": "contains_any",
"value": {
"strings": [
"com.example.ACTION_TRIM",
"com.example.ACTION_KILL"
]
}
}列表必须包含1到16个字符串。每个动作必须为1到160字符,可包含ASCII字母、数字、下划线、句点和连字符。使用。
fingerprint: artifactmanifest_attribute
manifest_attributemanifest_attribute
manifest_attributeThis evidence reads an explicitly declared Boolean attribute from the APK's
manifest element. A missing attribute does not match, even when
the Android platform supplies the same value as a runtime default.
applicationjson
{
"evidence": "manifest_attribute",
"operator": "equal",
"value": {
"manifestAttribute": {
"element": "application",
"name": "android:enableOnBackInvokedCallback",
"boolean": true
}
}
}The attribute name must use the namespace followed by an ASCII
letter and up to 79 ASCII letters, digits, or underscores. Schema v1 supports
only the element and Boolean values. Resource-backed Boolean
attributes are compared after resource resolution. Use .
android:applicationfingerprint: artifact该证据读取APK的清单元素中显式声明的布尔属性。即使Android平台在运行时提供相同的默认值,缺失的属性也不会匹配。
applicationjson
{
"evidence": "manifest_attribute",
"operator": "equal",
"value": {
"manifestAttribute": {
"element": "application",
"name": "android:enableOnBackInvokedCallback",
"boolean": true
}
}
}属性名必须使用命名空间,后跟一个ASCII字母和最多79个ASCII字母、数字或下划线。Schema v1仅支持元素和布尔值。资源支持的布尔属性会在资源解析后进行比较。使用。
android:applicationfingerprint: artifactdex_class
dex_classdex_class
dex_classdex_classdexClassesjson
{
"evidence": "dex_class",
"operator": "contains_any",
"value": {
"dexClasses": [
{
"name": {
"operator": "starts_with",
"value": "Lcom/example/sdk/"
},
"stringConstants": [
"com.example.ACTION_READY"
],
"methodReferences": [
{
"definingClass": "Landroid/content/IntentFilter;",
"name": "addAction",
"parameterTypes": [
"Ljava/lang/String;"
]
}
]
}
]
}
}Each query may contain , , , or a
combination of them. At least one field is required.
namestringConstantsmethodReferencesdex_classdexClassesjson
{
"evidence": "dex_class",
"operator": "contains_any",
"value": {
"dexClasses": [
{
"name": {
"operator": "starts_with",
"value": "Lcom/example/sdk/"
},
"stringConstants": [
"com.example.ACTION_READY"
],
"methodReferences": [
{
"definingClass": "Landroid/content/IntentFilter;",
"name": "addAction",
"parameterTypes": [
"Ljava/lang/String;"
]
}
]
}
]
}
}每个查询可包含、、或它们的组合。至少需要一个字段。
namestringConstantsmethodReferencesDEX class query parameters
DEX类查询参数
| Parameter | Type | Required | Allowed values and limits | Meaning |
|---|---|---|---|---|
| Object | No | | Restricts the class descriptor. |
| Array of strings | No | 1 to 16 strings, each 1 to 160 characters without control characters | Matches if the class references any listed string. |
| Array of method-reference objects | No | 1 to 16 references | Matches if the class references any listed method. |
At least one query parameter is required. If several parameters are present,
all parameter categories must match the same class.
The fields inside one query are AND categories and must be satisfied by the
same DEX class:
- , when present, must match that class.
name - , when present, succeeds if the class references any string in the list.
stringConstants - , when present, succeeds if the class references any method in the list.
methodReferences
For example, a query containing both and
requires one class that contains at least one listed string and at least one
listed method reference. The matching instructions do not have to appear in
the same method. Use separate entries in when the evidence may be
found in different classes.
stringConstantsmethodReferencesdexClassesUse for every DEX rule.
fingerprint: artifact| 参数 | 类型 | 是否必填 | 允许值和限制 | 含义 |
|---|---|---|---|---|
| 对象 | 否 | | 限制类描述符。 |
| 字符串数组 | 否 | 1到16个字符串,每个字符串1到160字符,无控制字符 | 如果类引用了任意列出的字符串,则匹配。 |
| 方法引用对象数组 | 否 | 1到16个引用 | 如果类引用了任意列出的方法,则匹配。 |
至少需要一个查询参数。如果存在多个参数,所有参数类别必须匹配同一个类。
一个查询中的字段为AND关系,必须由同一个DEX类满足:
- 如果存在,必须匹配该类。
name - 如果存在,当类引用列表中的任意字符串时成功。
stringConstants - 如果存在,当类引用列表中的任意方法时成功。
methodReferences
例如,同时包含和的查询需要一个类,该类至少包含一个列出的字符串和一个列出的方法引用。匹配的指令不需要出现在同一个方法中。当证据可能存在于不同类中时,使用中的单独条目。
stringConstantsmethodReferencesdexClasses每个DEX规则都使用。
fingerprint: artifactClass names
类名
DEX class names use descriptors, not Java or Kotlin dotted names.
| Goal | Operator | Example |
|---|---|---|
| Match one class | | |
| Match a package or nested prefix | | |
| Name parameter | Type | Required | Possible values and limits | Meaning |
|---|---|---|---|---|
| String | Yes | | Exact descriptor match or descriptor-prefix match. |
| String | Yes | DEX class descriptor pattern beginning with | Descriptor or prefix to match. |
equalstarts_withLDEX类名使用描述符,而不是Java或Kotlin的点分隔名称。
| 目标 | 运算符 | 示例 |
|---|---|---|
| 匹配单个类 | | |
| 匹配包或嵌套前缀 | | |
| 名称参数 | 类型 | 是否必填 | 可能值和限制 | 含义 |
|---|---|---|---|---|
| 字符串 | 是 | | 精确描述符匹配或描述符前缀匹配。 |
| 字符串 | 是 | 以 | 要匹配的描述符或前缀。 |
equalstarts_withLString constants
字符串常量
stringConstantsstringConstantsMethod references
方法引用
A method reference requires and :
definingClassnamejson
{
"definingClass": "Landroid/content/IntentFilter;",
"name": "<init>",
"parameterTypes": [
"Ljava/lang/String;"
]
}| Field | Required | Constraint |
|---|---|---|
| Yes | Full DEX class descriptor ending in |
| Yes | DEX method name, 1 to 80 characters. |
| No | Exact parameter descriptor list, at most 16 entries. |
Omit to match any overload with the same defining class and
method name. Provide it to require an exact parameter list. An empty array
matches a zero-parameter method.
parameterTypesPrimitive descriptors are (boolean), (byte), (short), (char),
(int), (long), (float), and (double). Prefix a descriptor with
for each array dimension. Object types use full descriptors such as
.
ZBSCIJFD[Ljava/lang/String;方法引用需要和:
definingClassnamejson
{
"definingClass": "Landroid/content/IntentFilter;",
"name": "<init>",
"parameterTypes": [
"Ljava/lang/String;"
]
}| 字段 | 是否必填 | 约束 |
|---|---|---|
| 是 | 完整的DEX类描述符,以 |
| 是 | DEX方法名,1到80字符。接受 |
| 否 | 精确的参数描述符列表,最多16个条目。 |
省略以匹配具有相同定义类和方法名的任意重载。提供该参数以要求精确的参数列表。空数组匹配零参数方法。
parameterTypes原始类型描述符为(布尔值)、(字节)、(短整型)、(字符)、(整型)、(长整型)、(浮点型)和(双精度浮点型)。为每个数组维度添加前缀。对象类型使用完整描述符,例如。
ZBSCIJFD[Ljava/lang/String;Optional metadata
可选元数据
releaseChannel
releaseChannelreleaseChannel
releaseChannel- is the default and is included in both preview and stable bundles.
stable - is included only when the builder uses
preview-only.--channel preview
The builder removes from the generated catalog. It is a
repository publication control, not runtime chart metadata.
releaseChannel- 为默认值,包含在预览和稳定bundle中。
stable - 仅在构建器使用
preview-only时包含。--channel preview
构建器会从生成的目录中移除。它是仓库发布控制,不是运行时图表元数据。
releaseChannelavailability
availabilityavailability
availabilitySchema v1 online rules only accept , which is also the default. Omit
this field unless a future schema adds a supported online availability gate.
alwaysSchema v1在线规则仅接受,这也是默认值。除非未来schema添加支持的在线可用性限制,否则省略该字段。
alwaysrequiresFeatureInitialization
requiresFeatureInitializationrequiresFeatureInitialization
requiresFeatureInitializationWhen , LibChecker hides the chart until its feature initialization has
finished. Current online evidence types do not require feature data, so new
online rules should normally omit this field or use .
truefalse当为时,LibChecker会在功能初始化完成后才显示图表。当前在线证据类型不需要功能数据,因此新的在线规则通常应省略该字段或设置为。
truefalsecontrols
controlscontrols
controlsSchema v1 allows no online chart controls. Omit this field. An explicit empty
array is valid but adds no behavior.
Schema v1不允许在线图表控件。省略该字段。显式的空数组是有效的,但不会添加任何行为。
dashboard
dashboarddashboard
dashboardSchema v1 online rules only accept , which is the default. Omit it.
noneSchema v1在线规则仅接受,这也是默认值。省略该字段。
nonefingerprint
fingerprintfingerprint
fingerprintThe fingerprint controls when LibChecker discards cached chart results after
installed-app data changes. It does not grant access to additional evidence.
| Value | Use |
|---|---|
| Metadata-based rules such as |
| Rules that inspect native libraries, archive entries, DEX, or manifest contents. |
| Rules that depend on LibChecker's initialized feature data. No schema v1 online evidence currently needs it. |
Choose the fingerprint that covers every evidence leaf in the rule. A rule
that combines target SDK with DEX evidence should use .
artifact指纹控制LibChecker在已安装应用数据更改时何时丢弃缓存的图表结果。它不授予访问额外证据的权限。
| 值 | 用途 |
|---|---|
| 基于元数据的规则,例如 |
| 检查原生库、归档条目、DEX或清单内容的规则。 |
| 依赖LibChecker初始化功能数据的规则。目前没有Schema v1在线证据需要它。 |
选择覆盖规则中所有证据节点的指纹。结合目标SDK和DEX证据的规则应使用。
artifactValidation and tests
验证和测试
Run:
shell
python3 -m unittest chart.tools.test_build_bundleThe JSON Schema defines the complete object shape and field constraints. The
Python builder performs additional semantic validation. It rejects incompatible
evidence/operator/value combinations, unsafe URLs, unsafe icon paths and SVG
content, duplicate IDs, duplicate facet IDs, and complexity-limit violations.
When adding a rule, update the existing assertions in
:
chart/tools/test_build_bundle.py- Add the ID in sorted order to .
test_source_rules_are_valid - Add a new icon path in sorted archive order and update the expected catalog
count in .
test_bundle_is_deterministic_and_contains_only_expected_files - Update according to the rule's release channel.
test_stable_bundle_excludes_preview_only_rules - Add one focused test that asserts the important detection values, condition ordering, icon render mode, details URL, or another property that reviewers should not accidentally change.
- Add negative validation tests when you introduce a new schema capability or validator branch.
Do not weaken limits or delete regression assertions only to make a new rule
pass.
运行:
shell
python3 -m unittest chart.tools.test_build_bundleJSON Schema定义了完整的对象结构和字段约束。Python构建器会执行额外的语义验证,拒绝不兼容的证据/运算符/值组合、不安全的URL、不安全的图标路径和SVG内容、重复ID、重复维度ID以及违反复杂度限制的内容。
添加规则时,更新中的现有断言:
chart/tools/test_build_bundle.py- 将ID按排序顺序添加到中。
test_source_rules_are_valid - 按归档顺序添加新的图标路径,并在中更新预期的目录计数。
test_bundle_is_deterministic_and_contains_only_expected_files - 根据规则的发布通道更新。
test_stable_bundle_excludes_preview_only_rules - 添加一个针对性测试,断言重要的检测值、条件顺序、图标渲染模式、详情URL或其他评审人员不应意外更改的属性。
- 当引入新的schema功能或验证分支时,添加负向验证测试。
请勿为了让新规则通过而削弱限制或删除回归断言。
Bundle generation
Bundle生成
For a local preview, write to a temporary directory so that validation does not
modify tracked generated files:
shell
python3 chart/tools/build_bundle.py \
--bundle-version 12 \
--channel preview \
--minimum-app-version-code 2731 \
--output-dir /tmp/libchecker-chart-previewFor the final branch artifact, omit to write to :
--output-dirchart/cloud/v1/shell
python3 chart/tools/build_bundle.py \
--bundle-version 12 \
--channel preview \
--minimum-app-version-code 2731Builder arguments:
| Argument | Required | Meaning |
|---|---|---|
| Yes | Positive, monotonically increasing publication version for the target branch. |
| No | |
| No | First LibChecker version code that can safely load every rule in the bundle. Defaults to |
| No | Destination directory. Defaults to |
If the rule uses only evidence and calculation features already supported by
the published app, retain the branch's compatible minimum app version. If it
depends on a new client capability, coordinate the app change first and set the
exact first compatible version code. Do not guess this number.
The builder:
- validates every source rule and referenced SVG;
- sorts rules by ID and icons by path;
- writes a deterministic ZIP containing and referenced icons;
catalog.json - limits the bundle to 64 rules and 2 MiB;
- computes and
bundleSha256;bundleSize - writes with schema, publication, and compatibility metadata.
manifest.json
Commit and together. A checksum or size from one
generation cannot be paired with a bundle from another generation.
chart.bundlemanifest.json对于本地预览,写入临时目录,以便验证不会修改已跟踪的生成文件:
shell
python3 chart/tools/build_bundle.py \
--bundle-version 12 \
--channel preview \
--minimum-app-version-code 2731 \
--output-dir /tmp/libchecker-chart-preview对于最终分支工件,省略以写入:
--output-dirchart/cloud/v1/shell
python3 chart/tools/build_bundle.py \
--bundle-version 12 \
--channel preview \
--minimum-app-version-code 2731构建器参数:
| 参数 | 是否必填 | 含义 |
|---|---|---|
| 是 | 目标分支的正整数、单调递增的发布版本。 |
| 否 | 默认值为 |
| 否 | 可以安全加载bundle中所有规则的第一个LibChecker版本号。默认值为 |
| 否 | 目标目录。默认值为 |
如果规则仅使用已发布应用支持的证据和计算功能,请保留分支的兼容最低应用版本。如果它依赖新的客户端功能,请先协调应用变更,然后设置确切的第一个兼容版本号。请勿猜测该数字。
构建器会:
- 验证每个源规则和引用的SVG;
- 按ID排序规则,按路径排序图标;
- 写入包含和引用图标的确定性ZIP;
catalog.json - 将bundle限制为64个规则和2 MiB;
- 计算和
bundleSha256;bundleSize - 写入包含schema、发布和兼容性元数据的。
manifest.json
同时提交和。一次生成的校验和或大小不能与另一次生成的bundle配对。
chart.bundlemanifest.jsonManual verification
手动验证
Automated validation proves that a rule is well-formed. It does not prove that
the evidence identifies the intended apps.
Before requesting stable publication:
- Install a compatible LibChecker build that reads the preview branch.
- Check at least one known matching app and one known non-matching app.
- For facets, verify every facet independently and confirm that an app matching several facets shows all expected chips in rule order.
- Check the chart title, group titles, description, reference link, icon size, colors, light theme, and dark theme.
- Record the app versions or sample APKs used for testing in the PR description.
- Rebuild with and inspect the catalog before publishing. Every
--channel stablerule must be absent.preview-only
自动化验证只能证明规则格式正确,不能证明证据能识别预期的应用。
请求稳定发布前,请执行以下操作:
- 安装兼容的LibChecker版本,使其读取预览分支。
- 检查至少一个已知匹配的应用和一个已知不匹配的应用。
- 对于维度规则,独立验证每个维度,并确认匹配多个维度的应用会按规则顺序显示所有预期标签。
- 检查图表标题、组标题、描述、参考链接、图标大小、颜色、浅色主题和深色主题。
- 在PR描述中记录用于测试的应用版本或示例APK。
- 使用重新构建,并在发布前检查目录。所有
--channel stable规则必须不存在。preview-only
Pull request checklist
Pull Request检查清单
- The rule solves one clearly described statistic.
- The ID and filename are stable and follow the naming rules.
- A new rule starts at revision ; an edited published rule increments its revision.
1 - All text includes equivalent and
entranslations.zh-Hans - The description is neutral and the HTTPS reference is primary.
- The calculation uses only supported evidence and compatible operators.
- DEX queries use descriptors and preserve same-class matching semantics.
- The SVG passes the safety and viewBox requirements.
- The release channel and fingerprint match the rule's maturity and evidence.
- Focused tests cover the important matching data and channel behavior.
- Unit tests pass.
- Matching and non-matching apps were checked with a compatible LibChecker build.
- The generated bundle and manifest were rebuilt and committed together.
- 规则解决一个清晰描述的统计需求。
- ID和文件名稳定,符合命名规则。
- 新规则从版本开始;已发布的编辑规则递增版本号。
1 - 所有文本包含等效的和
en翻译。zh-Hans - 描述中立,HTTPS参考为权威来源。
- 计算仅使用支持的证据和兼容的运算符。
- DEX查询使用描述符,保留同类匹配语义。
- SVG通过安全和viewBox要求。
- 发布通道和指纹与规则的成熟度和证据匹配。
- 针对性测试覆盖重要的匹配数据和通道行为。
- 单元测试通过。
- 使用兼容的LibChecker版本检查了匹配和不匹配的应用。
- 重新生成并同时提交了bundle和清单文件。
Recovery after a bad publication
错误发布后的恢复
Do not reuse an older bundle version. Restore the last known-good source rules
and generated contents, then publish them with a higher .
Compatible LibChecker clients retain their cached bundle when a download,
checksum, schema, or minimum-version check fails.
bundleVersion请勿重用旧的bundle版本。恢复最后一个已知良好的源规则和生成内容,然后使用更高的发布。当下载、校验和、schema或最低版本检查失败时,兼容的LibChecker客户端会保留其缓存的bundle。
bundleVersion