Skip to content

Commit

Permalink
Added unit entry points to individual builders
Browse files Browse the repository at this point in the history
  • Loading branch information
Thesola10 committed Feb 24, 2025
1 parent ba3baa9 commit a6687e0
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ __pycache__
result
nixie/output/nix-wrapped.sh.in
src/docs
src/*.sh
src/**/*.sh
18 changes: 18 additions & 0 deletions src/builders/autoconf.ab
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,21 @@ pub fun build_autoconf_dep(lib_name: Text, var_name: Text,
trust env_var_set("{var_name}_CFLAGS", "-I{my_source}/{inc_prefix}/include")
trust $export {var_name}_LIBS {var_name}_CFLAGS$
}

main(cmdl)
{
if len(cmdl) < 5 {
echo "Usage: ./autoconf.sh <package> <var_name> <lib_prefix> <inc_prefix>"
echo ""
echo "See builders/autoconf.ab and builders.ab for more info"
exit 1
}

let lib_name = cmdl[1]
let var_name = cmdl[2]
let lib_prefix = cmdl[3]
let inc_prefix = cmdl[4]

trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1")
build_autoconf_dep(lib_name, var_name, lib_prefix, inc_prefix)?
}
6 changes: 6 additions & 0 deletions src/builders/boost.ab
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ pub fun build_boost()
trust $export BOOST_ROOT$
}

main(cmdl)
{
trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1")
build_boost()?
}

// Quick mark-as-used workaround
if false {
exit 300
Expand Down
6 changes: 6 additions & 0 deletions src/builders/lowdown.ab
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ pub fun build_lowdown()
trust env_var_set("LOWDOWN_CFLAGS", "-I{source_root}/lowdown")
}

main(cmdl)
{
trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1")
build_lowdown()?
}

// Quick mark-as-used workaround
if false {
exit 300
Expand Down
9 changes: 9 additions & 0 deletions src/builders/nix.ab
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ pub fun build_nix()
trust mv "{source_root}/nix/src/nix/nix" "{cache_root}/nix-static"
}

main(cmdl)
{
echo "This builder only makes sense in the wrapper context,"
echo "where all dependencies were built and/or resolved."
echo ""
echo "Use ./nix --nixie-no-precompiled to test the full build chain."

exit 1
}

// Quick mark-as-used workaround
if false {
Expand Down
6 changes: 6 additions & 0 deletions src/builders/nlohmann_json.ab
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ pub fun build_nlohmann_json()
trust env_var_set("NLOHMANN_JSON_CFLAGS", "{source_root}/nlohmann_json/single_include")
trust $export NLOHMANN_JSON_LIBS NLOHMANN_JSON_CFLAGS$
}

main(cmdl)
{
trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1")
build_nlohmann_json()?
}
6 changes: 6 additions & 0 deletions src/builders/openssl.ab
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ pub fun build_openssl()
trust $export OPENSSL_LIBS OPENSSL_CFLAGS$
}

main(cmdl)
{
trust env_var_set("_NIXIE_TESTING_SKIP_TARBALL", "1")
build_openssl()?
}

// Quick mark-as-used workaround
if false {
exit 300
Expand Down
8 changes: 5 additions & 3 deletions src/resources.ab
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Resource retrieval from tarball or Cachix

import { file_download } from "std/http"
import { env_var_get } from "std/env"
import { env_var_get, env_var_test } from "std/env"

import { untar } from "./common.ab"

Expand All @@ -18,8 +18,10 @@ pub fun pull_source_file(member: Text, dest: Text): Null?
{
let SOURCE_DERIVATION = trust env_var_get("SOURCE_DERIVATION")

let where = trust untar("sources/{member}")
if status != 0 {
let where = ""
if not env_var_test("_NIXIE_TESTING_SKIP_TARBALL"):
where = trust untar("sources/{member}")
if status != 0 or env_var_test("_NIXIE_TESTING_SKIP_TARBALL") {
let tmpf = trust $mktemp -t nixie_src_XXXXXXXX.tgz$
let tmpd = trust $mktemp -t -d nixie_{member}_XXXXXXXX$

Expand Down

0 comments on commit a6687e0

Please sign in to comment.