Skip to content

Commit b6c0c69

Browse files
authored
Merge pull request #592 from wgqqqqq/workspace-search-flashgrep-multiarch
Add gated workspace search and multi-arch flashgrep resources
2 parents 2ee5bf0 + f5f1b77 commit b6c0c69

33 files changed

Lines changed: 741 additions & 181 deletions

resources/flashgrep/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ Place the prebuilt `flashgrep` daemon binary in this directory.
22

33
Expected filenames:
44

5-
- macOS/Linux: `flashgrep`
6-
- Windows: `flashgrep.exe`
5+
- macOS x86_64: `flashgrep-x86_64-apple-darwin`
6+
- macOS arm64: `flashgrep-aarch64-apple-darwin`
7+
- Linux x86_64: `flashgrep-x86_64-unknown-linux-gnu`
8+
- Linux arm64: `flashgrep-aarch64-unknown-linux-gnu`
9+
- Windows x86_64: `flashgrep-x86_64-pc-windows-msvc.exe`
10+
- Windows arm64: `flashgrep-aarch64-pc-windows-msvc.exe`
711

812
BitFun dev/build scripts load the daemon from this repository-relative path.

resources/flashgrep/flashgrep renamed to resources/flashgrep/flashgrep-aarch64-apple-darwin

7.41 MB
Binary file not shown.
6.16 MB
Binary file not shown.
8.32 MB
Binary file not shown.
7.65 MB
Binary file not shown.
7.18 MB
Binary file not shown.
8.81 MB
Binary file not shown.

resources/flashgrep/flashgrep.exe

-16.9 MB
Binary file not shown.

scripts/dev.cjs

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -544,26 +544,49 @@ async function startDesktopPreview() {
544544
await new Promise(() => {});
545545
}
546546

547-
function flashgrepBinaryName() {
548-
return process.platform === 'win32' ? 'flashgrep.exe' : 'flashgrep';
547+
function flashgrepBinaryNames() {
548+
if (process.platform === 'win32' && process.arch === 'x64') {
549+
return ['flashgrep-x86_64-pc-windows-msvc.exe'];
550+
}
551+
if (process.platform === 'win32' && process.arch === 'arm64') {
552+
return ['flashgrep-aarch64-pc-windows-msvc.exe'];
553+
}
554+
if (process.platform === 'darwin' && process.arch === 'x64') {
555+
return ['flashgrep-x86_64-apple-darwin'];
556+
}
557+
if (process.platform === 'darwin' && process.arch === 'arm64') {
558+
return ['flashgrep-aarch64-apple-darwin'];
559+
}
560+
if (process.platform === 'linux' && process.arch === 'x64') {
561+
return ['flashgrep-x86_64-unknown-linux-gnu'];
562+
}
563+
if (process.platform === 'linux' && process.arch === 'arm64') {
564+
return ['flashgrep-aarch64-unknown-linux-gnu'];
565+
}
566+
return [process.platform === 'win32' ? 'flashgrep.exe' : 'flashgrep'];
549567
}
550568

551-
function flashgrepBinaryPath() {
552-
return path.join(ROOT_DIR, 'resources', 'flashgrep', flashgrepBinaryName());
569+
function flashgrepBinaryName() {
570+
return flashgrepBinaryNames()[0];
553571
}
554572

555573
function ensureFlashgrepBinary() {
556-
const binaryPath = flashgrepBinaryPath();
557-
if (!fs.existsSync(binaryPath)) {
558-
return {
559-
ok: false,
560-
error: new Error(
561-
`flashgrep binary not found: ${binaryPath}. Put the prebuilt daemon binary at resources/flashgrep/${flashgrepBinaryName()}`
562-
),
563-
};
574+
for (const binaryName of flashgrepBinaryNames()) {
575+
const binaryPath = path.join(ROOT_DIR, 'resources', 'flashgrep', binaryName);
576+
if (!fs.existsSync(binaryPath)) {
577+
continue;
578+
}
579+
return { ok: true, binaryPath };
564580
}
565581

566-
return { ok: true, binaryPath };
582+
return {
583+
ok: false,
584+
error: new Error(
585+
`flashgrep binary not found for ${process.platform}/${process.arch}. Expected one of: ${flashgrepBinaryNames()
586+
.map((name) => `resources/flashgrep/${name}`)
587+
.join(', ')}`
588+
),
589+
};
567590
}
568591

569592
async function ensureFlashgrepBundleResource() {
@@ -685,7 +708,7 @@ async function main() {
685708
if (mode === 'desktop') {
686709
await ensureDesktopOpenSslIfNeeded();
687710
const desktopDir = path.join(ROOT_DIR, 'src/apps/desktop');
688-
const tauriConfig = path.join(desktopDir, 'tauri.conf.json');
711+
const tauriConfig = path.join(desktopDir, 'tauri.dev.conf.json');
689712
if (process.platform === 'win32') {
690713
// Running the generated .cmd shim directly via spawn is flaky on Windows.
691714
// Use cmd.exe with an explicit args array so the desktop app directory

scripts/prepare-flashgrep-resource.mjs

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,52 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
66
const ROOT = join(__dirname, '..');
77
const RESOURCE_DIR = join(ROOT, 'resources', 'flashgrep');
88

9+
export function flashgrepBinaryNames() {
10+
if (process.platform === 'win32' && process.arch === 'x64') {
11+
return ['flashgrep-x86_64-pc-windows-msvc.exe'];
12+
}
13+
if (process.platform === 'win32' && process.arch === 'arm64') {
14+
return ['flashgrep-aarch64-pc-windows-msvc.exe'];
15+
}
16+
if (process.platform === 'darwin' && process.arch === 'x64') {
17+
return ['flashgrep-x86_64-apple-darwin'];
18+
}
19+
if (process.platform === 'darwin' && process.arch === 'arm64') {
20+
return ['flashgrep-aarch64-apple-darwin'];
21+
}
22+
if (process.platform === 'linux' && process.arch === 'x64') {
23+
return ['flashgrep-x86_64-unknown-linux-gnu'];
24+
}
25+
if (process.platform === 'linux' && process.arch === 'arm64') {
26+
return ['flashgrep-aarch64-unknown-linux-gnu'];
27+
}
28+
return [process.platform === 'win32' ? 'flashgrep.exe' : 'flashgrep'];
29+
}
30+
931
export function flashgrepBinaryName() {
10-
return process.platform === 'win32' ? 'flashgrep.exe' : 'flashgrep';
32+
return flashgrepBinaryNames()[0];
1133
}
1234

1335
export function flashgrepBinaryPath() {
1436
return join(RESOURCE_DIR, flashgrepBinaryName());
1537
}
1638

1739
export function ensureFlashgrepBinary() {
18-
const binaryPath = flashgrepBinaryPath();
19-
if (!existsSync(binaryPath)) {
20-
throw new Error(
21-
`flashgrep binary not found: ${binaryPath}. Put the prebuilt daemon binary at resources/flashgrep/${flashgrepBinaryName()}`
22-
);
23-
}
40+
for (const binaryName of flashgrepBinaryNames()) {
41+
const binaryPath = join(RESOURCE_DIR, binaryName);
42+
if (!existsSync(binaryPath)) {
43+
continue;
44+
}
2445

25-
if (process.platform !== 'win32') {
26-
chmodSync(binaryPath, statSync(binaryPath).mode | 0o111);
46+
if (process.platform !== 'win32') {
47+
chmodSync(binaryPath, statSync(binaryPath).mode | 0o111);
48+
}
49+
return binaryPath;
2750
}
28-
return binaryPath;
51+
52+
throw new Error(
53+
`flashgrep binary not found for ${process.platform}/${process.arch}. Expected one of: ${flashgrepBinaryNames()
54+
.map((name) => `resources/flashgrep/${name}`)
55+
.join(', ')}`
56+
);
2957
}

0 commit comments

Comments
 (0)