diff --git a/mix.exs b/mix.exs index 972a148..f68e239 100644 --- a/mix.exs +++ b/mix.exs @@ -60,8 +60,9 @@ defmodule Trinity.MixProject do desktop: [ steps: [:assemble, &Burrito.wrap/1], # Slice 032: exla in the release, loaded and not started (see `exla_deps/0`); on a - # Windows host it is not declared at all. - applications: exla_release_applications(), + # Windows host it is not declared at all. Slice 133: not in the Linux bundle either + # (`desktop_release_applications/1`). + applications: desktop_release_applications(System.get_env("BURRITO_TARGET")), burrito: [ targets: [ linux_x86_64: [os: :linux, cpu: :x86_64], @@ -126,6 +127,19 @@ defmodule Trinity.MixProject do end end + @doc """ + The desktop release's applications for one Burrito target (slice 133, AC12). The Linux + bundle leaves exla out: its NIF never loaded there (Burrito's musl ERTS against a glibc + `.so`, the `__libc_single_threaded` failure above), so the bundle already ran with the local + embedder off and the Elixir scorer in `Trinity.Memory.VectorStores.Brute`, and the 68.7 MB + it carried was dead weight (slice 032's PROOF). macOS keeps it until slice 133's eval; the + headless release keeps `exla_release_applications/0`. Public only so a test can call it. + `package.yml` sets `BURRITO_TARGET` per job; a local `mix release desktop` without it builds + every target with what the host declares, as before. + """ + def desktop_release_applications("linux_x86_64"), do: [] + def desktop_release_applications(_target), do: exla_release_applications() + defp exla_deps do case :os.type() do {:win32, _} -> [] diff --git a/test/release_composition_test.exs b/test/release_composition_test.exs new file mode 100644 index 0000000..6d53f4f --- /dev/null +++ b/test/release_composition_test.exs @@ -0,0 +1,31 @@ +# SPDX-FileCopyrightText: Sudo Apt Holdings LLC +# SPDX-License-Identifier: Apache-2.0 +defmodule ReleaseCompositionTest do + @moduledoc """ + Slice 133, AC12. The Linux Burrito bundle carries no exla. The release's applications are + computed in `mix.exs`, so this asserts on the function `releases/0` calls for the desktop + release, for each target `package.yml` builds. The artifact's size and its + `TRINITY_SMOKE_EXLA` line are the package run's half and are cited in the proof. + """ + use ExUnit.Case, async: true + + test "the Linux bundle leaves exla out" do + linux = Trinity.MixProject.desktop_release_applications("linux_x86_64") + refute Keyword.has_key?(linux, :exla) + end + + test "macOS and Windows bundles, and a build with no target, keep what the host declares" do + for target <- ["macos_aarch64", "windows_x86_64", nil] do + assert Trinity.MixProject.desktop_release_applications(target) == headless() + end + end + + test "the headless release still carries exla where the host declares it" do + case :os.type() do + {:win32, _} -> assert headless() == [] + _ -> assert headless()[:exla] == :load + end + end + + defp headless, do: Trinity.MixProject.project()[:releases][:headless][:applications] +end