From f4f14136653472f2e1dee8ced48a5d91812cc35b Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 21 Dec 2022 08:10:10 -0500 Subject: [PATCH] Just use the full build.ts Fixes issue where we don't install zlib to build zlib even though llvm needs it. Doing these in steps was a cool demo of our primitives but led to issues due to install all deps up front rather than just before each build so fuck it. --- .github/workflows/build.yml | 7 +------ scripts/build.plumbing.ts | 6 ------ scripts/build.ts | 18 +++++++++++++++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9938a406..de04bc50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,13 +73,8 @@ jobs: - run: /opt/tea.xyz/var/pantry/scripts/sort.ts ${{ inputs.projects }} id: sorted - - run: /opt/tea.xyz/var/pantry/scripts/build-deps.ts ${{ steps.sorted.outputs.pkgs }} - id: deps - - - run: cli/scripts/install.ts ${{ steps.deps.outputs.pkgs }} - # running out of /opt because only pantry.core has these scripts - - run: /opt/tea.xyz/var/pantry/scripts/build.plumbing.ts ${{ steps.sorted.outputs.pkgs }} + - run: /opt/tea.xyz/var/pantry/scripts/build.ts ${{ steps.sorted.outputs.pkgs }} id: build env: GITHUB_TOKEN: ${{ github.token }} diff --git a/scripts/build.plumbing.ts b/scripts/build.plumbing.ts index 85f7bbd5..41a6451c 100755 --- a/scripts/build.plumbing.ts +++ b/scripts/build.plumbing.ts @@ -14,13 +14,11 @@ args: ---*/ import { usePantry } from "hooks" -import { Installation } from "types" import { pkg as pkgutils } from "utils" import { useFlags, usePrefix } from "hooks" import { set_output } from "./utils/gha.ts" import build, { BuildResult } from "./build/build.ts" import * as ARGV from "./utils/args.ts" -import Path from "path" useFlags() @@ -52,7 +50,3 @@ await set_output("paths", rv.map(x => x.installation.path), '%0A') await set_output("relative-paths", rv.map(x => x.installation.path.relative({ to }))) await set_output("srcs", rv.map(x => x.src?.relative({ to }) ?? "~")) await set_output("srcs-relative-paths", rv.compact(x => x.src?.relative({ to }))) - -interface InstallationPlus extends Installation { - src: Path -} diff --git a/scripts/build.ts b/scripts/build.ts index 36bd31c3..8a27d828 100755 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -13,12 +13,14 @@ args: - --import-map={{ srcroot }}/import-map.json ---*/ -import { usePantry, useFlags, useCellar, useInventory } from "hooks" +import { usePantry, useFlags, useCellar, useInventory, usePrefix } from "hooks" import { hydrate, install, link } from "prefab" import { str as pkgstr } from "utils/pkg.ts" import * as ARGV from "./utils/args.ts" import { panic } from "utils/error.ts" -import build from "./build/build.ts" +import build, { BuildResult } from "./build/build.ts" +import { set_output } from "./utils/gha.ts" +import { pkg as pkgutils } from "utils" useFlags() @@ -26,6 +28,7 @@ const pantry = usePantry() const cellar = useCellar() const inventory = useInventory() const raw = await ARGV.toArray(ARGV.pkgs()) +const rv: BuildResult[] = [] for (const rq of raw) { const dry = await pantry.getDeps(rq) @@ -40,6 +43,15 @@ for (const rq of raw) { } const pkg = await pantry.resolve(rq) - await build(pkg) + rv.push(await build(pkg)) await link(pkg) } + +if (Deno.env.get("GITHUB_ACTIONS")) { + const to = usePrefix() + await set_output("pkgs", rv.map(x => pkgutils.str(x.installation.pkg))) + await set_output("paths", rv.map(x => x.installation.path), '%0A') + await set_output("relative-paths", rv.map(x => x.installation.path.relative({ to }))) + await set_output("srcs", rv.map(x => x.src?.relative({ to }) ?? "~")) + await set_output("srcs-relative-paths", rv.compact(x => x.src?.relative({ to }))) +}