Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cargo mismatch on MacOS build #974

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ jobs:
uses: >- # v4
DeterminateSystems/magic-nix-cache-action@fc6aaceb40b9845a02b91e059ec147e78d1b4e41

- name: Run build
run: >
nix build
- name: Test nix run
run: |
nix run -L .#nativelink-is-executable-test
7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

craneLib =
if pkgs.stdenv.isDarwin
then crane.lib.${system}
then (crane.mkLib pkgs).overrideToolchain stable-rust.default
else
(crane.mkLib pkgs).overrideToolchain (stable-rust.default.override {
targets = ["x86_64-unknown-linux-musl"];
Expand Down Expand Up @@ -139,6 +139,8 @@

local-image-test = import ./tools/local-image-test.nix {inherit pkgs;};

nativelink-is-executable-test = import ./tools/nativelink-is-executable-test.nix {inherit pkgs nativelink;};

generate-toolchains = import ./tools/generate-toolchains.nix {inherit pkgs;};

native-cli = import ./native-cli/default.nix {inherit pkgs;};
Expand Down Expand Up @@ -201,7 +203,7 @@
};
};
packages = rec {
inherit publish-ghcr local-image-test nativelink nativelink-debug native-cli lre-cc;
inherit publish-ghcr local-image-test nativelink-is-executable-test nativelink nativelink-debug native-cli lre-cc;
default = nativelink;

rbe-autogen-lre-cc = rbe-autogen lre-cc;
Expand Down Expand Up @@ -276,6 +278,7 @@

# Additional tools from within our development environment.
local-image-test
nativelink-is-executable-test
generate-toolchains
customClang
native-cli
Expand Down
27 changes: 27 additions & 0 deletions tools/nativelink-is-executable-test.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
pkgs,
nativelink,
...
}:
pkgs.writeShellScriptBin "is-executable-test" ''
set -xuo pipefail

nativelink_output="$(${nativelink}/bin/nativelink 2>&1)"

print_error_output=$(cat <<EOF
error: the following required arguments were not provided:
<CONFIG_FILE>

Usage: nativelink <CONFIG_FILE>

For more information, try '--help'.
EOF)

if [ "$nativelink_output" = "$print_error_output" ]; then
echo "The output of nativelink matches the print_error output."
else
echo 'The output of nativelink does not match the print_error output:'
diff <(echo "$nativelink_output") <(echo "$print_error_output") >&2
exit 1
fi
''