Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 944x 41x | /**
* ADR-049: a target name to its description, from the target catalog
* (`targets/targets.cnx`), read on each call (#1444 removed the per-port
* cache, which #1452 box 4 forbids under a pass root). Nothing here holds a second
* list of targets, and nothing here decides a run's target -- 1.4 Resolve
* settles that once, from every file's pragmas and the target option.
*/
import type ITargetDescription from "../types/ITargetDescription";
import TargetCatalogFile from "../PARSE/1-Discover/TargetCatalogFile";
import type IFileSystem from "../types/IFileSystem";
class TargetResolver {
/**
* The catalog's description for a named target, or undefined when the name
* is unknown. Names match exactly (ADR-049): `TEENSY41` is not `teensy41`.
*/
static byName(
name: string | undefined,
fs: IFileSystem,
): ITargetDescription | undefined {
return name ? TargetCatalogFile.targets(fs).get(name) : undefined;
}
/** Every name the catalog defines, aliases included */
static names(fs: IFileSystem): string[] {
return [...TargetCatalogFile.targets(fs).keys()];
}
}
export default TargetResolver;
|