[215] Cycles: Bau (CI Linux/macOS) und Auslieferung (Tauri, Electron)
cycles.yml baut Cycles je Plattform (Linux x86_64, macOS arm64) und legt das Paket als Artefakt und am Gitea-Release cycles-<version> ab; release.yml lädt es vor dem App-Bau (get.sh). Mitgeliefert: Electron extraResources (resources/cycles), Tauri externalBin + resources (tauri.cycles.conf.json). Fassade src/native/cyclesRuntime.ts (cyclesAvailable, runCycles mit Fortschritt und Abbruch), Hauptprozess und Rust (cycles.rs) prüfen die Argumente und starten nur das Paketprogramm. build-macos.sh fertig, Lizenztexte im Paket, NOTICE, doc/CYCLES.md. Geprüft: vitest, rustc --test, AppImage mit Linux-Paket (test:linux-app, Fall Cycles). Nicht geprüft: Workflows, Mac, Tauri-Befehle.
This commit is contained in:
35 files changed
+1785
-58
No files matched your search
@@ -5,6 +5,10 @@
|
||||
// bekommt sie als `buildVersion` (unter Linux nur Metadaten) und `extraMetadata.dossierBuild` (package.json im Paket).
|
||||
// Über die JS-Schnittstelle, nicht `-c.…` auf der Kommandozeile: dort würde „261116.10“ zur Zahl 261116.1.
|
||||
// Optional `--version=1.2.3` (Release aus einem Tag) überschreibt die Version aus package.json.
|
||||
// Cycles ([215]): liegt ein Paketordner mit dem Programm `cycles` bereit, kommt er als `extraResources` (Ordner `cycles/`) ins
|
||||
// AppImage. Reihenfolge: `--cycles=ORDNER`, Umgebungsvariable DOSSIER_CYCLES_DIR (lokaler Ordner statt CI-Download, z. B. ein
|
||||
// frisch gebautes `dist/` von scripts/cycles/build-linux.sh), sonst `build/cycles` (scripts/cycles/get.sh). Ohne: Paket ohne Cycles
|
||||
// (Warnung); mit DOSSIER_REQUIRE_CYCLES=1 (Release-CI) ist das ein Fehler.
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const { BUILD_RE } = require("./build-number.cjs");
|
||||
@@ -20,11 +24,28 @@ function readDistBuild(distDir) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Konfiguration für electron-builder: erbt `electron-builder.yml`, ergänzt Buildnummer (als Zeichenkette) und ggf. Version. */
|
||||
function packConfig(build, version) {
|
||||
/** Konfiguration für electron-builder: erbt `electron-builder.yml`, ergänzt Buildnummer (als Zeichenkette), ggf. Version und Cycles. */
|
||||
function packConfig(build, version, cyclesDir) {
|
||||
const extraMetadata = { dossierBuild: String(build) };
|
||||
if (version) extraMetadata.version = String(version);
|
||||
return { extends: "./electron-builder.yml", buildVersion: String(build), extraMetadata };
|
||||
const config = { extends: "./electron-builder.yml", buildVersion: String(build), extraMetadata };
|
||||
if (cyclesDir) config.extraResources = [{ from: cyclesDir, to: "cycles" }];
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycles-Paketordner fürs AppImage ([215]) oder `null`. Wirft, wenn ein ausdrücklich genannter Ordner kein Programm `cycles` enthält
|
||||
* oder `DOSSIER_REQUIRE_CYCLES=1` gesetzt ist und nichts da ist.
|
||||
*/
|
||||
function resolveCyclesDir(root, argv, env) {
|
||||
const arg = argv.find((a) => a.startsWith("--cycles="));
|
||||
const explicit = arg ? arg.slice("--cycles=".length) : env.DOSSIER_CYCLES_DIR || "";
|
||||
const dir = explicit ? path.resolve(explicit) : path.join(root, "build", "cycles");
|
||||
const ok = fs.existsSync(path.join(dir, "cycles"));
|
||||
if (ok) return dir;
|
||||
if (explicit) throw new Error(`Cycles-Ordner ${dir} enthält kein Programm "cycles"`);
|
||||
if (env.DOSSIER_REQUIRE_CYCLES === "1") throw new Error("Cycles fehlt (build/cycles): zuerst scripts/cycles/get.sh linux x86_64");
|
||||
return null;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
@@ -36,13 +57,14 @@ async function main() {
|
||||
}
|
||||
const versionArg = process.argv.slice(2).find((a) => a.startsWith("--version="));
|
||||
const version = versionArg ? versionArg.slice("--version=".length) : undefined;
|
||||
console.log(`electron-pack: Dossier ${version ?? info.version} (Build ${info.build})`);
|
||||
const cyclesDir = resolveCyclesDir(root, process.argv.slice(2), process.env);
|
||||
console.log(`electron-pack: Dossier ${version ?? info.version} (Build ${info.build}), Cycles: ${cyclesDir ?? "nicht enthalten (build/cycles fehlt)"}`);
|
||||
const { build, Platform, Arch } = require("electron-builder");
|
||||
await build({
|
||||
projectDir: root,
|
||||
targets: Platform.LINUX.createTarget("AppImage", Arch.x64),
|
||||
publish: "never",
|
||||
config: packConfig(info.build, version),
|
||||
config: packConfig(info.build, version, cyclesDir),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,4 +74,4 @@ if (require.main === module)
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
module.exports = { packConfig, readDistBuild };
|
||||
module.exports = { packConfig, readDistBuild, resolveCyclesDir };
|
||||
Reference in new issue
Block a user