fix android

This commit is contained in:
KingKDot
2026-07-31 15:00:22 -05:00
parent 53beec84f5
commit 279081b12a
2 changed files with 25 additions and 2 deletions
@@ -1,5 +1,19 @@
import { describe, expect, test } from "bun:test";
import { createAgentTlsPinsLdflag } from "./build-process";
import { createAgentTlsPinsLdflag, createBaseGoLdflags } from "./build-process";
describe("agent base linker flags", () => {
test("allows Pion's Android interface dependency to link on current Go", () => {
expect(createBaseGoLdflags("android", true)).toBe(
"-s -w -buildid= -checklinkname=0",
);
expect(createBaseGoLdflags("android", false)).toBe("-checklinkname=0");
});
test("does not relax linkname checks for other targets", () => {
expect(createBaseGoLdflags("linux", true)).toBe("-s -w -buildid=");
expect(createBaseGoLdflags("windows", false)).toBe("");
});
});
describe("agent build TLS pin embedding", () => {
test("creates the linker flag consumed by the Go agent config", () => {
+10 -1
View File
@@ -31,6 +31,15 @@ export function createAgentTlsPinsLdflag(pins: string[]): string {
return `-X overlord-client/cmd/agent/config.DefaultTLSSPKIPins=${pins.join(",")}`;
}
export function createBaseGoLdflags(targetOs: string, stripDebug: boolean): string {
const flags: string[] = [];
if (stripDebug) flags.push("-s", "-w", "-buildid=");
if (targetOs === "android") flags.push("-checklinkname=0");
return flags.join(" ");
}
function isClientModuleDir(dir: string): boolean {
return (
fs.existsSync(path.join(dir, "go.mod")) &&
@@ -1213,7 +1222,7 @@ func runBoundFiles() {
);
}
let ldflags = config.stripDebug !== false ? "-s -w -buildid=" : "";
let ldflags = createBaseGoLdflags(effectiveOs, config.stripDebug !== false);
if (config.serverUrl) {
const serverFlag = `-X overlord-client/cmd/agent/config.DefaultServerURL=${config.serverUrl}`;