132 lines
3.3 KiB
Nix
132 lines
3.3 KiB
Nix
# Fresh artifact builder. Candidate plans and runtime dependencies are supplied by the workspace compiler.
|
|
{
|
|
pkgs,
|
|
src,
|
|
plan ? null,
|
|
buildContract ?
|
|
(import ./package-context.nix {
|
|
inherit
|
|
pkgs
|
|
protocol
|
|
plan
|
|
packageRevisionId
|
|
;
|
|
}).buildContract,
|
|
sourceDigest ?
|
|
(import ./package-context.nix {
|
|
inherit
|
|
pkgs
|
|
protocol
|
|
plan
|
|
packageRevisionId
|
|
;
|
|
}).sourceDigest,
|
|
protocol,
|
|
core,
|
|
sharedRuntime,
|
|
typescript ? core.dependencies,
|
|
packageRevisionId,
|
|
portable ? null,
|
|
remote ? null,
|
|
service ? { },
|
|
nodeModules ? null,
|
|
components ? null,
|
|
group ? false,
|
|
}:
|
|
let
|
|
buildTools = import ./build-tools.nix;
|
|
# The standalone bundle is the complete code dependency of this driver.
|
|
# Changes to unrelated checker CLIs must not invalidate every package group.
|
|
compiler = builtins.path {
|
|
path = "${protocol}/libexec/quixos-protocol/execution-world.mjs";
|
|
name = "execution-world.mjs";
|
|
};
|
|
config = pkgs.writeText "camino-artifact-build.json" (
|
|
builtins.toJSON {
|
|
inherit
|
|
buildContract
|
|
compiler
|
|
packageRevisionId
|
|
core
|
|
sharedRuntime
|
|
nodeModules
|
|
service
|
|
;
|
|
group = true;
|
|
components =
|
|
if components == null then
|
|
null
|
|
else
|
|
{
|
|
inherit (components) sdk runtime entries;
|
|
dependencies = components.sdk.dependencies;
|
|
bindingOutput = components.bindingOutput or "src/gen/client.ts";
|
|
contracts = components.contracts or [ ];
|
|
};
|
|
source = import ./implementation-source.nix {
|
|
inherit (pkgs) lib;
|
|
inherit src;
|
|
};
|
|
portable =
|
|
if portable == null then
|
|
null
|
|
else
|
|
{
|
|
inherit (portable) entry;
|
|
entries = portable.entries or { };
|
|
registryExport = portable.registryExport or "registry";
|
|
bindingOutput = portable.bindingOutput or "src/gen/qx.ts";
|
|
targets =
|
|
portable.targets or [
|
|
"browser"
|
|
"server"
|
|
];
|
|
};
|
|
remote =
|
|
if remote == null then
|
|
null
|
|
else
|
|
{
|
|
inherit (remote) entry;
|
|
registryExport = remote.registryExport or "registry";
|
|
bindingOutput = remote.bindingOutput or "src/gen/remote.ts";
|
|
};
|
|
node = "${pkgs.nodejs_24}/bin/node";
|
|
tsc = "${typescript}/node_modules/typescript/bin/tsc";
|
|
esbuild = "${pkgs.esbuild}/bin/esbuild";
|
|
shell = "${pkgs.runtimeShell}";
|
|
serviceAdapter = ./portable-service.mjs;
|
|
restrictedSDK = "${(import ./restricted-execution { inherit pkgs core; }).sdk}/core.mjs";
|
|
}
|
|
);
|
|
compiled =
|
|
pkgs.runCommand "camino-compiled-artifacts"
|
|
{
|
|
passthru.buildConfig = config;
|
|
QUIXOS_TRACE_PROFILE = "1";
|
|
}
|
|
''
|
|
${pkgs.nodejs_24}/bin/node ${buildTools}/build-artifacts.mjs ${config}
|
|
'';
|
|
in
|
|
if group then
|
|
compiled
|
|
else
|
|
(import ./assemble-package.nix {
|
|
inherit pkgs;
|
|
artifacts = [ compiled ];
|
|
context = {
|
|
inherit
|
|
buildContract
|
|
sourceDigest
|
|
packageRevisionId
|
|
sharedRuntime
|
|
;
|
|
generator = protocol;
|
|
};
|
|
})
|
|
// {
|
|
caminoGroup = compiled;
|
|
buildConfig = config;
|
|
}
|