mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 03:16:05 +00:00
* style: apply SwiftFormat 0.62.1 rules Refs #103202 * ci: enforce deterministic Swift lint Refs #103202 * refactor: keep gateway connect lint-clean Refs #103202 * style: keep iOS typography checks warning-free * ci: route MLX Swift changes through pre-push * fix: preserve native i18n extraction after Swift cleanup * refactor: keep rebased Swift surfaces lint-clean * style: format latest Swift additions * chore: refresh native i18n inventory * style: keep generated Swift formatter-clean * fix: preserve node route invalidation callbacks * fix: keep native translation IDs stable * fix: retain native translation identifiers * fix: preserve translations across Swift source moves
68 lines
2.3 KiB
JavaScript
68 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
import { existsSync, lstatSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const repoRoot = path.resolve(import.meta.dirname, "..");
|
|
const iosRoot = path.join(repoRoot, "apps", "ios");
|
|
const outputPath = path.join(iosRoot, "SwiftSources.input.xcfilelist");
|
|
|
|
const iosSourceRoots = [
|
|
"Sources",
|
|
"ShareExtension",
|
|
"ActivityWidget",
|
|
path.join("WatchApp", "Sources"),
|
|
];
|
|
|
|
const sharedSourceRoots = [
|
|
path.join("..", "shared", "OpenClawKit", "Sources", "OpenClawChatUI"),
|
|
path.join("..", "shared", "OpenClawKit", "Sources", "OpenClawKit"),
|
|
path.join("..", "shared", "OpenClawKit", "Sources", "OpenClawProtocol"),
|
|
path.join("..", "swabble", "Sources", "SwabbleKit"),
|
|
];
|
|
|
|
const excludedSwiftFiles = new Set([
|
|
"../shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift",
|
|
]);
|
|
|
|
function normalizeFileListPath(filePath) {
|
|
return filePath.split(path.sep).join("/");
|
|
}
|
|
|
|
function collectSwiftFiles(rootRelativePath) {
|
|
const root = path.join(iosRoot, rootRelativePath);
|
|
if (!existsSync(root)) {
|
|
throw new Error(`Missing Swift source root: ${rootRelativePath}`);
|
|
}
|
|
|
|
const entries = [];
|
|
const visit = (dir) => {
|
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
const fullPath = path.join(dir, entry.name);
|
|
if (entry.isDirectory()) {
|
|
visit(fullPath);
|
|
} else if (entry.isFile() && entry.name.endsWith(".swift")) {
|
|
entries.push(normalizeFileListPath(path.relative(iosRoot, fullPath)));
|
|
}
|
|
}
|
|
};
|
|
visit(root);
|
|
return entries;
|
|
}
|
|
|
|
function writeGeneratedFile(filePath, contents) {
|
|
if (existsSync(filePath) && lstatSync(filePath).isSymbolicLink()) {
|
|
throw new Error(`Refusing to overwrite symlinked file: ${filePath}`);
|
|
}
|
|
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
writeFileSync(filePath, contents, "utf8");
|
|
}
|
|
|
|
const iosFiles = iosSourceRoots.flatMap(collectSwiftFiles);
|
|
const sharedFiles = sharedSourceRoots.flatMap(collectSwiftFiles);
|
|
const fileList = [...new Set([...iosFiles, ...sharedFiles])]
|
|
.filter((filePath) => !excludedSwiftFiles.has(filePath))
|
|
.toSorted((left, right) => left.localeCompare(right));
|
|
|
|
writeGeneratedFile(outputPath, `${fileList.join("\n")}\n`);
|
|
process.stdout.write(`Prepared iOS Swift file list: ${path.relative(repoRoot, outputPath)}\n`);
|