Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update for process/command change #148

Merged
merged 14 commits into from
Feb 2, 2025
Next Next commit
target -> command
deciduously committed Feb 1, 2025
commit 335928813473f2b7945178e2da7d0a5d5732d322
6 changes: 3 additions & 3 deletions packages/acl/tangram.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export const metadata = {
},
};

export const source = tg.target(async () => {
export const source = tg.command(async () => {
const { name, version } = metadata;
const checksum =
"sha256:97203a72cae99ab89a067fe2210c1cbf052bc492b479eca7d226d9830883b0bd";
@@ -39,7 +39,7 @@ export type Arg = {
source?: tg.Directory;
};

export const build = tg.target(async (...args: std.Args<Arg>) => {
export const build = tg.command(async (...args: std.Args<Arg>) => {
const {
autotools = {},
build,
@@ -85,7 +85,7 @@ export const build = tg.target(async (...args: std.Args<Arg>) => {
});

export default build;
export const test = tg.target(async () => {
export const test = tg.command(async () => {
const displaysUsage = (name: string) => {
return {
name,
6 changes: 3 additions & 3 deletions packages/attr/tangram.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ export const metadata = {
},
};

export const source = tg.target(async () => {
export const source = tg.command(async () => {
const { name, version } = metadata;
const checksum =
"sha256:f2e97b0ab7ce293681ab701915766190d607a1dba7fae8a718138150b700a70b";
@@ -38,7 +38,7 @@ export type Arg = {
source?: tg.Directory;
};

export const build = tg.target(async (...args: std.Args<Arg>) => {
export const build = tg.command(async (...args: std.Args<Arg>) => {
const {
autotools = {},
build,
@@ -73,7 +73,7 @@ const provides = {
libraries: ["attr"],
};

export const test = tg.target(async () => {
export const test = tg.command(async () => {
const displaysUsage = (name: string) => {
return {
name,
4 changes: 2 additions & 2 deletions packages/autobuild/autotools/tangram.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export type Arg = {
source: tg.Directory;
};

export const build = tg.target(async (arg: Arg) => {
export const build = tg.command(async (arg: Arg) => {
const { env: envArg, ...rest } = arg ?? {};
const env_ = envArg ?? env({ build: arg.build, host: arg.host });

@@ -51,7 +51,7 @@ export type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg: EnvArg) => {
export const env = tg.command(async (arg: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
4 changes: 2 additions & 2 deletions packages/autobuild/cmake/tangram.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ export type Arg = {
source: tg.Directory;
};

export const build = tg.target(async (arg: Arg) => {
export const build = tg.command(async (arg: Arg) => {
const { env: envArg, ...rest } = arg ?? {};

const env_ =
@@ -25,7 +25,7 @@ type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg: EnvArg) => {
export const env = tg.command(async (arg: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
4 changes: 2 additions & 2 deletions packages/autobuild/go/tangram.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ export type Arg = {
source: tg.Directory;
};

export const build = tg.target(async (arg: Arg) => {
export const build = tg.command(async (arg: Arg) => {
const { env: envArg, ...rest } = arg ?? {};

const env_ = envArg ?? env({ build: arg.build, host: arg.host });
@@ -23,7 +23,7 @@ type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg: EnvArg) => {
export const env = tg.command(async (arg: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
6 changes: 3 additions & 3 deletions packages/autobuild/js/tangram.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ export type Arg = {
source: tg.Directory;
};

export const node = tg.target(async (arg: Arg) => {
export const node = tg.command(async (arg: Arg) => {
const { build: build_, env: envArg, host: host_, source } = arg ?? {};

const host = host_ ?? (await std.triple.host());
@@ -22,7 +22,7 @@ export const node = tg.target(async (arg: Arg) => {

export default node;

export const plain = tg.target(async (arg: Arg) => {
export const plain = tg.command(async (arg: Arg) => {
// FIXME - env!
const { source } = arg;
const toolchain = await nodejs.self();
@@ -35,7 +35,7 @@ type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg?: EnvArg) => {
export const env = tg.command(async (arg?: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
8 changes: 4 additions & 4 deletions packages/autobuild/python/tangram.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ export type Arg = {
source: tg.Directory;
};

export const build = tg.target(async (arg: Arg) => {
export const build = tg.command(async (arg: Arg) => {
const { env: envArg, source, ...rest } = arg ?? {};

const env_ =
@@ -30,7 +30,7 @@ export const build = tg.target(async (arg: Arg) => {

export default build;

export const plain = tg.target(async (arg: Arg) => {
export const plain = tg.command(async (arg: Arg) => {
const { build, env: envArg, host, source } = arg ?? {};

const env_ = envArg ?? std.env.arg(env({ build, host }), envArg);
@@ -57,7 +57,7 @@ export const plain = tg.target(async (arg: Arg) => {
// return poetry.build(arg_);
// });

export const pyproject = tg.target(async (arg: Arg) => {
export const pyproject = tg.command(async (arg: Arg) => {
const { env: envArg, source, ...rest } = arg ?? {};

const env_ =
@@ -73,7 +73,7 @@ type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg: EnvArg) => {
export const env = tg.command(async (arg: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
4 changes: 2 additions & 2 deletions packages/autobuild/ruby/tangram.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ export type Arg = {
source: tg.Directory;
};

export const plain = tg.target(async (arg: Arg) => {
export const plain = tg.command(async (arg: Arg) => {
const { env: envArg, source } = arg ?? {};

const env_ =
@@ -32,7 +32,7 @@ type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg: EnvArg) => {
export const env = tg.command(async (arg: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
6 changes: 3 additions & 3 deletions packages/autobuild/rust/tangram.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ export type Arg = {
source: tg.Directory;
};

export const cargo = tg.target(async (arg: Arg) => {
export const cargo = tg.command(async (arg: Arg) => {
const { env: envArg, ...rest } = arg ?? {};

const env_ =
@@ -22,7 +22,7 @@ export const cargo = tg.target(async (arg: Arg) => {

export default cargo;

export const plain = tg.target(async (arg: Arg) => {
export const plain = tg.command(async (arg: Arg) => {
const { env: envArg, ...rest } = arg ?? {};

const env_ = envArg ?? env({ build: arg.build, host: arg.host });
@@ -36,7 +36,7 @@ type EnvArg = {
host?: string | undefined;
};

export const env = tg.target(async (arg?: EnvArg) => {
export const env = tg.command(async (arg?: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
8 changes: 4 additions & 4 deletions packages/autobuild/tangram.ts
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ export type Arg = {
source: tg.Directory;
};

export const build = tg.target(async (arg: Arg) => {
export const build = tg.command(async (arg: Arg) => {
const { env: envArg, source } = arg;
const sourceId = await source.id();
console.log("received source dir", sourceId);
@@ -97,7 +97,7 @@ export type EnvArg = {
source: tg.Directory;
};

export const env = tg.target(async (arg: EnvArg) => {
export const env = tg.command(async (arg: EnvArg) => {
const { build, host, source } = arg;
const sourceId = await source.id();
console.log("received source dir", sourceId);
@@ -185,7 +185,7 @@ export const detectKind = async (source: tg.Directory): Promise<Kind> => {
throw new Error("failed to detect project kind");
};

export const test = tg.target(async () => {
export const test = tg.command(async () => {
const allKinds: Array<Kind> = [
"cc-autotools",
"cmake",
@@ -265,7 +265,7 @@ const testDirs = async (): Promise<Record<Kind, tg.Directory>> => {
};
};

export const testKind = tg.target(async (kind: Kind) => {
export const testKind = tg.command(async (kind: Kind) => {
console.log(`testing ${kind}...`);
const dirs = await testDirs();
const source = dirs[kind];
12 changes: 5 additions & 7 deletions packages/autoconf/tangram.ts
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ export const metadata = {
},
};

export const source = tg.target(() => {
export const source = tg.command(() => {
const { name, version } = metadata;
const checksum =
"sha256:ba885c1319578d6c94d46e9b0dceb4014caafe2490e437a0dbca3f270a223f5a";
@@ -52,7 +52,7 @@ export type Arg = {
source?: tg.Directory;
};

export const build = tg.target(async (...args: std.Args<Arg>) => {
export const build = tg.command(async (...args: std.Args<Arg>) => {
const arg = await std.args.apply<Arg>(...args);
const {
autotools = {},
@@ -183,8 +183,7 @@ export const build = tg.target(async (...args: std.Args<Arg>) => {
return output;
});

export const patchAutom4teCfg = tg.target(
async (autoconf: tg.Directory, arg?: Arg): Promise<tg.Directory> => {
export const patchAutom4teCfg = tg.command(async (autoconf: tg.Directory, arg?: Arg): Promise<tg.Directory> => {
const autom4teCfg = await autoconf.get("share/autoconf/autom4te.cfg");
tg.assert(autom4teCfg instanceof tg.File);

@@ -209,11 +208,10 @@ export const patchAutom4teCfg = tg.target(
return tg.directory(autoconf, {
["share/autoconf/autom4te.cfg"]: patchedAutom4teCfg,
});
},
);
});

export default build;
export const test = tg.target(async () => {
export const test = tg.command(async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
});
6 changes: 3 additions & 3 deletions packages/automake/tangram.ts
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ export const metadata = {
},
};

export const source = tg.target(() => {
export const source = tg.command(() => {
const { name, version } = metadata;
const checksum =
"sha256:8920c1fc411e13b90bf704ef9db6f29d540e76d232cb3b2c9f4dc4cc599bd990";
@@ -54,7 +54,7 @@ export type Arg = {
source?: tg.Directory;
};

export const build = tg.target(async (...args: std.Args<Arg>) => {
export const build = tg.command(async (...args: std.Args<Arg>) => {
const {
autotools = {},
build,
@@ -160,7 +160,7 @@ export const build = tg.target(async (...args: std.Args<Arg>) => {
});

export default build;
export const test = tg.target(async () => {
export const test = tg.command(async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
});
6 changes: 3 additions & 3 deletions packages/b3sum/tangram.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ export const metadata = {
},
};

export const source = tg.target(async () => {
export const source = tg.command(async () => {
const { name, version } = metadata;
const checksum =
"sha256:6feba0750efc1a99a79fb9a495e2628b5cd1603e15f56a06b1d6cb13ac55c618";
@@ -36,7 +36,7 @@ type Arg = {
source?: tg.Directory;
};

export const build = tg.target(async (...args: std.Args<Arg>) => {
export const build = tg.command(async (...args: std.Args<Arg>) => {
const {
build,
host,
@@ -57,7 +57,7 @@ export const build = tg.target(async (...args: std.Args<Arg>) => {
});

export default build;
export const test = tg.target(async () => {
export const test = tg.command(async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
});
12 changes: 3 additions & 9 deletions packages/bash/tangram.ts
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ export const metadata = {
},
};

export const source = tg.target(async () => {
export const source = tg.command(async () => {
const { name, version } = metadata;
const checksum =
"sha256:9599b22ecd1d5787ad7d3b7bf0c59f312b3396d1e281175dd1f8a4014da621ff";
@@ -98,7 +98,7 @@ export type Arg = {
source?: tg.Directory;
};

export const build = tg.target(async (...args: std.Args<Arg>) => {
export const build = tg.command(async (...args: std.Args<Arg>) => {
const {
autotools = {},
build,
@@ -158,12 +158,6 @@ export const wrapScript = async (script: tg.File, host: string) => {
return std.wrap(script, { interpreter, identity: "executable" });
};

export const provides = tg.target(async () => {
console.log(await std.directory.provides(await build()));
return true;
});

export const test = tg.target(async () => {
const spec = std.assert.defaultSpec(metadata);
export const test = tg.command(async () => {
return await std.assert.pkg(build, spec);
});
Loading