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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/acl/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions packages/attr/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/autobuild/autotools/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/autobuild/cmake/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_ =
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/autobuild/go/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/autobuild/js/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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();
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions packages/autobuild/python/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_ =
Expand All @@ -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);
Expand All @@ -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_ =
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/autobuild/ruby/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_ =
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/autobuild/rust/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_ =
Expand All @@ -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 });
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions packages/autobuild/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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];
Expand Down
12 changes: 5 additions & 7 deletions packages/autoconf/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 = {},
Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Up @@ -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";
Expand All @@ -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,
Expand All @@ -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);
});
11 changes: 3 additions & 8 deletions packages/bash/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand Down Expand Up @@ -158,12 +158,7 @@ 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 () => {
export const test = tg.command(async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
});
Loading