Skip to content

Commit

Permalink
Merge remote-tracking branch 'other/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 18, 2024
2 parents ace7856 + 1803dbf commit 531a2e8
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/customisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ rec {
1. Takes a function `p`, or a path to a Nix file that contains a function `p`, which takes an attribute set and returns value of arbitrary type `a`,
2. Takes an attribute set `args` with explicit attributes to pass to `p`,
3. Calls `f` with attributes from the original attribute set `attrs` passed to `newScope` updated with `args, i.e. `attrs // args`, if they match the attributes in the argument of `p`.
3. Calls `f` with attributes from the original attribute set `attrs` passed to `newScope` updated with `args`, i.e. `attrs // args`, if they match the attributes in the argument of `p`.
All such functions `p` will be called with the same value for `attrs`.
Expand Down
6 changes: 6 additions & 0 deletions lib/licenses.nix
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,12 @@ lib.mapAttrs mkLicense ({
redistributable = false;
};

databricks-license = {
fullName = "Databricks License";
url = "https://www.databricks.com/legal/db-license";
free = false;
};

fair = {
fullName = "Fair License";
spdxId = "Fair";
Expand Down
16 changes: 16 additions & 0 deletions lib/systems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ let
if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET"
else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET"
else null;

# Remove before 25.05
androidSdkVersion =
if (args ? sdkVer && !args ? androidSdkVersion) then
throw "For android `sdkVer` has been renamed to `androidSdkVersion`"
else if (args ? androidSdkVersion) then
args.androidSdkVersion
else
null;
androidNdkVersion =
if (args ? ndkVer && !args ? androidNdkVersion) then
throw "For android `ndkVer` has been renamed to `androidNdkVersion`"
else if (args ? androidSdkVersion) then
args.androidNdkVersion
else
null;
} // (
let
selectEmulator = pkgs:
Expand Down
12 changes: 6 additions & 6 deletions lib/systems/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ rec {
armv7a-android-prebuilt = {
config = "armv7a-unknown-linux-androideabi";
rust.rustcTarget = "armv7-linux-androideabi";
sdkVer = "33";
ndkVer = "26";
androidSdkVersion = "33";
androidNdkVersion = "26";
useAndroidPrebuilt = true;
} // platforms.armv7a-android;

aarch64-android-prebuilt = {
config = "aarch64-unknown-linux-android";
rust.rustcTarget = "aarch64-linux-android";
sdkVer = "33";
ndkVer = "26";
androidSdkVersion = "33";
androidNdkVersion = "26";
useAndroidPrebuilt = true;
};

aarch64-android = {
config = "aarch64-unknown-linux-android";
sdkVer = "33";
ndkVer = "26";
androidSdkVersion = "33";
androidNdkVersion = "26";
libc = "bionic";
useAndroidPrebuilt = false;
useLLVM = true;
Expand Down
53 changes: 48 additions & 5 deletions lib/tests/modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,44 @@ set -o errexit -o noclobber -o nounset -o pipefail
shopt -s failglob inherit_errexit

# https://stackoverflow.com/a/246128/6605742
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

cd "$DIR"/modules

pass=0
fail=0

# loc
# prints the location of the call of to the function that calls it
# loc n
# prints the location n levels up the call stack
loc() {
local caller depth
depth=1
if [[ $# -gt 0 ]]; then
depth=$1
fi
# ( lineno fnname file ) of the caller
caller=( $(caller $depth) )
echo "${caller[2]}:${caller[0]}"
}

line() {
echo "----------------------------------------"
}
logStartFailure() {
line
}
logEndFailure() {
line
echo
}

logFailure() {
# bold red
printf '\033[1;31mTEST FAILED\033[0m at %s\n' "$(loc 2)"
}

evalConfig() {
local attr=$1
shift
Expand All @@ -31,7 +62,7 @@ reportFailure() {
local attr=$1
shift
local script="import ./default.nix { modules = [ $* ];}"
echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only --json"
echo "$ nix-instantiate -E '$script' -A '$attr' --eval-only --json"
evalConfig "$attr" "$@" || true
((++fail))
}
Expand All @@ -42,8 +73,12 @@ checkConfigOutput() {
if evalConfig "$@" 2>/dev/null | grep -E --silent "$outputContains" ; then
((++pass))
else
echo 2>&1 "error: Expected result matching '$outputContains', while evaluating"
logStartFailure
echo "ACTUAL:"
reportFailure "$@"
echo "EXPECTED: result matching '$outputContains'"
logFailure
logEndFailure
fi
}

Expand All @@ -52,14 +87,22 @@ checkConfigError() {
local err=""
shift
if err="$(evalConfig "$@" 2>&1 >/dev/null)"; then
echo 2>&1 "error: Expected error code, got exit code 0, while evaluating"
logStartFailure
echo "ACTUAL: exit code 0, output:"
reportFailure "$@"
echo "EXPECTED: non-zero exit code"
logFailure
logEndFailure
else
if echo "$err" | grep -zP --silent "$errorContains" ; then
((++pass))
else
echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
logStartFailure
echo "ACTUAL:"
reportFailure "$@"
echo "EXPECTED: error matching '$errorContains'"
logFailure
logEndFailure
fi
fi
}
Expand Down

0 comments on commit 531a2e8

Please sign in to comment.