diff --git a/src/doctor/data-access/check-android-sdk.ts b/src/doctor/data-access/check-android-sdk.ts index dce0526..ce5e216 100644 --- a/src/doctor/data-access/check-android-sdk.ts +++ b/src/doctor/data-access/check-android-sdk.ts @@ -1,4 +1,4 @@ -import { basename, join } from 'node:path' +import { join } from 'node:path' import type { DoctorCheckResult } from './doctor-check-result.ts' import { type DoctorEnvironment, findExecutable, parseVersion, sortVersions } from './doctor-environment.ts' @@ -201,6 +201,3 @@ export function selectHighestBuildToolsVersion(entries: string[]) { export function parseEmulatorVersion(output: string) { return output.match(/Android emulator version\s+(\d+(?:\.\d+)*)/i)?.[1] ?? parseVersion(output) } -export function sdkComponentName(path: string) { - return basename(path) -} diff --git a/src/doctor/data-access/doctor-environment.ts b/src/doctor/data-access/doctor-environment.ts index e1a7c8f..dd9459e 100644 --- a/src/doctor/data-access/doctor-environment.ts +++ b/src/doctor/data-access/doctor-environment.ts @@ -1,7 +1,7 @@ import { execFile } from 'node:child_process' import { access, readdir, realpath, statfs } from 'node:fs/promises' import { homedir, platform, release } from 'node:os' -import { delimiter, dirname, extname, join, resolve, sep } from 'node:path' +import { delimiter, join, sep } from 'node:path' export type CommandResult = { path: string; stderr: string; stdout: string } export type CommandRunner = (command: string, args?: string[]) => Promise @@ -89,7 +89,3 @@ export function compareVersions(left: string, right: string) { } return 0 } - -export function executableDirectory(path: string) { - return extname(path) ? dirname(path) : resolve(path) -} diff --git a/src/localnet/data-access/apply-forwards.ts b/src/localnet/data-access/apply-forwards.ts index 408f7f4..7056e97 100644 --- a/src/localnet/data-access/apply-forwards.ts +++ b/src/localnet/data-access/apply-forwards.ts @@ -3,7 +3,7 @@ import { createAdbReverse, listAdbReverses, removeAdbReverse } from '../../devic import type { AdbDependencies, AdbDevice, AdbReverseEntry } from '../../device/data-access/device-types.ts' import { isUsableDevice, listAdbDevices } from '../../device/data-access/list-adb-devices.ts' import type { ForwardAction, OwnedForward, ResolvedLocalnetPort } from './localnet-types.ts' -import { ownedForwards, pendingForwards, planForwards } from './plan-forwards.ts' +import { pendingForwards, planForwards } from './plan-forwards.ts' export async function collectExistingReverses( devices: readonly AdbDevice[], @@ -23,24 +23,6 @@ export async function collectExistingReverses( return new Map(entries) } -/** - * The forwards a run would create, computed without applying anything. - * - * A detached session records this on the container before starting it, because once it exits there is no - * process left to remember what it claimed. Computing it early means a device that appears in between is - * simply not claimed — `stop` then leaves that forward alone, which is the safe direction to err. - */ -export async function planOwnedForwards( - { devices: only, ports }: { devices?: readonly string[]; ports: readonly ResolvedLocalnetPort[] }, - { runCommand = runExecutable }: AdbDependencies = {}, -): Promise { - const all = await listAdbDevices({ runCommand }) - const devices = only?.length ? all.filter(({ serial }) => only.includes(serial)) : all - const existing = await collectExistingReverses(devices, { runCommand }) - - return ownedForwards(planForwards({ devices, existing, ports })) -} - /** * `onApplied` fires as each reverse lands, rather than once at the end. *