DIR_METADATA files are a source-focused mechanism by which owners can provide users of their code important information. They map a directory to external entities, including:
This infrastructure is overall generic. It has Chromium-specific proto fields, but their usage is not required, and overall this infra can be used by other projects as well.
DIR_METADATA files are structured text-protobuf files that are amenable to programmatic interaction. Example:
team_email: "team@chromium.org"
os: LINUX
monorail {
project: "chromium"
component: "Infra"
}
For file schema, see Metadata message.
DIR_METADATA files apply to all contents of a directory including its subdirectories. By default, individual fields are inherited by subdirectories. In the following, example, the value of monorail.project field in directory a/b is “chromium”.
a/DIR_METADATA
monorail {
project: "chromium"
component: "Component"
}
a/b/DIR_METADATA
monorail { component: "Component>Foo" }
dirmd is a tool to work with DIR_METADATA files. Features:
OWNERS files, so that metadata can migrate off of OWNERS files smoothly.The tool is deployed via depot_tools and is available as a CIPD package.
The tool also hosts implementation of the metadata-exporter builder.
Source code: ./cmd/dirmd.
Go package infra/tools/dirmd can be used work with METADATA files programmatically. The dirmd executable is a thin wrapper around it.
metadata-exporter builder contunuously exports metadata from the src.git to gs://chrome-metadata/metadata_reduced.json and gs://chrome-metadata/metadata_computed.json. metadata_reduced.json is semantic equivalent of metadata_computed.json, but it has all redundant information removed (see MappingForm.REDUCED). As of July 2020, the update latency is up to 20 min.