Files
orca/config/scripts/orcad-distribution/server-bundle/orcad-windows-process-tree.mjs
T
Neil 9bd6272fdf refactor(tooling): organize build, CI, and test owners (#38130)
* refactor(tooling): organize test runtime and maintenance owners

* test(tooling): preserve relocated runtime fixture dependency edges

* refactor(tooling): preserve xterm routing owner checks

* ci(tooling): include routing owner in sparse checkout

* test(tooling): preserve copied workflow dependency closures

* fix(tooling): normalize hashed JSON assets in release parity

* fix(tooling): distinguish asset aliases from literal references

* fix(tooling): frame normalized asset reference payloads

* fix(tooling): normalize decoded JSON asset references

* refactor(tooling): organize build, CI and release owners

* fix(tooling): align moved generator and workflow path contracts

* fix(tooling): update generated plugin bundle owner banners

* test(tooling): create relocated mobile verifier fixture directories

* test(tooling): copy headless detector dependency closure

* test(tooling): align native batch policy fixtures with owner path

* fix(tooling): link moved reliability command to historical evidence

* fix(tooling): preserve nested sandbox owners and canonical guide source

* fix(tooling): target release version owners in checkout fixture
2026-11-04 21:08:19 -08:00

49 lines
1.7 KiB
JavaScript

import { copyFileSync, lstatSync } from 'node:fs'
import { createRequire } from 'node:module'
import { join } from 'node:path'
import { ORCAD_WINDOWS_PROCESS_TREE_FILENAME } from '../../../../src/shared/orcad-artifacts.ts'
import {
inspectWindowsProcessTreeAddon,
windowsProcessTreeAddonPath
} from '../../native-build/windows/windows-process-tree-gyp-rebuild.mjs'
const { PE_MACHINE, describePeMachine, readPeMachine } = createRequire(import.meta.url)(
'../../native-build/windows/windows-pe-machine.cjs'
)
export function stageOrcadWindowsProcessTree(
root,
outputDir,
target,
host = { platform: process.platform, arch: process.arch }
) {
if (!target.startsWith('win32-')) {
return
}
const arch = target.slice('win32-'.length)
let source = join(
root,
'.build',
'windows-process-tree',
arch,
ORCAD_WINDOWS_PROCESS_TREE_FILENAME
)
// Ordinary Windows installs already compile this N-API addon for the host.
if (target === `${host.platform}-${host.arch}` && !lstatSync(source, { throwIfNoEntry: false })) {
source = windowsProcessTreeAddonPath(
join(root, 'node_modules', '@vscode', 'windows-process-tree')
)
}
if (inspectWindowsProcessTreeAddon(source) !== 'clean') {
throw new Error(
`Orcad ${target} requires a patched process reader. On Windows, run: ` +
`node config/scripts/native-build/windows/build-windows-process-tree-addon.mjs --arch=${arch}`
)
}
const machine = readPeMachine(source)
if (machine !== PE_MACHINE[arch]) {
throw new Error(`Orcad ${target} process reader has ${describePeMachine(machine)}`)
}
copyFileSync(source, join(outputDir, ORCAD_WINDOWS_PROCESS_TREE_FILENAME))
}