quarto-dev / quarto-dev/quarto-cli
platform arch refactor
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 6k
- Forks
- 458
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 41
Beschreibung
In working on #237 getting arm logic added in will take some interface redesign:
The existing Dependency interface is as such:
dependencies.ts
export interface Dependency {
name: string;
version: string;
"darwin"?: PlatformDependency;
"linux"?: PlatformDependency;
"windows": PlatformDependency;
}
which is used by say the esBuild (and dart/pandoc) resolvers:
return {
name: "esbuild javscript bundler",
version,
"windows": esBuildRelease("windows-64"),
"linux": esBuildRelease("linux-64"),
"darwin": esBuildRelease("darwin-64"),
};
these then are used in configure.ts as kDependencies
// Download dependencies
info("Downloading dependencies");
for (const dependency of kDependencies) {
info(`Preparing ${dependency.name}`);
const platformDep = dependency[Deno.build.os];
if (platformDep) {
info(`Downloading ${dependency.name}`);
const targetFile = await downloadBinaryDependency(platformDep, config);
info(`Configuring ${dependency.name}`);
await platformDep.configure(targetFile);
info(`Cleaning up`);
Deno.removeSync(targetFile);
}
info(`${dependency.name} complete.\n`);
}
APIs to consider:
nested archs - Deno.build.arch can be "x86_64" | "aarch64" making it easy to use as a key
export interface Dependency {
name: string;
version: string;
"aarch64": {
"darwin"?: PlatformDependency;
"linux"?: PlatformDependency;
"windows"?: PlatformDependency;
};
"x86_64": {
"darwin"?: PlatformDependency;
"linux"?: PlatformDependency;
"windows"?: PlatformDependency;
};
}
which would essentially result in dl resolution code changing to:
-const platformDep = dependency[Deno.build.os];
+const platformDep = dependency[Deno.build.arch][Deno.build.os];
or some flatter designs:
- x86 default:
- darwin + darwin-aarch64
- no default (my preference given a flat structure):
- darwin-x86_64 + darwin-x86_64
and do something like
-const platformDep = dependency[Deno.build.os];
+const platformDep = dependency[`${Deno.build.os}-${Deno.build.arch}`];
Secondarily, the other implication to consider in the surrounding code is that arm builds are still generally not as first-class. While it seems everything has x86 builds in place, even for misc dev versions, arm versions are more hit or miss. As such, the general codebase could potentially use a little love to make more informative where its hitting problems and potentially more aggressively halt. The existing code just tries to dl if it exists and regardless will print info(${dependency.name} complete.\n);
@dragonstyle any particular preferences or other interface designs come to mind?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start with dependencies.ts and configure.ts, including the kDependencies loop and its use of Deno.build.os; review the existing resolver examples for esBuild, dart, and pandoc. Done means the project has a settled interface for OS and architecture selection and dependency setup reports missing or unsuccessful downloads instead of unconditionally printing completion.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- deno, typescript
- Bereich
- build-system, tooling
- Issue-Typ
- Refactoring
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100