Unverified Commit d997e4de authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

various: avoid throwing for invalid platforms combinations in CI (#426645)

parents 66280fdf 6de5573e
Loading
Loading
Loading
Loading
+124 −115
Original line number Diff line number Diff line
{
  config,
  lib,
  stdenv,
  makeWrapper,
@@ -21,7 +22,7 @@ let
  # some builds need that clarity.
  #
  ndkBuildInfoFun =
    { config, ... }:
    fallback:
    {
      x86_64-apple-darwin = {
        double = "darwin-x86_64";
@@ -30,10 +31,10 @@ let
        double = "linux-x86_64";
      };
    }
    .${config} or (throw "Android NDK doesn't support building on ${config}, as far as we know");
    .${stdenv.buildPlatform.config} or fallback;

  ndkTargetInfoFun =
    { config, ... }:
    fallback:
    {
      i686-unknown-linux-android = {
        triple = "i686-linux-android";
@@ -52,10 +53,14 @@ let
        triple = "aarch64-linux-android";
      };
    }
    .${config} or (throw "Android NDK doesn't support targetting ${config}, as far as we know");
    .${stdenv.targetPlatform.config} or fallback;

  buildInfo = ndkBuildInfoFun stdenv.buildPlatform;
  targetInfo = ndkTargetInfoFun stdenv.targetPlatform;
  buildInfo = ndkBuildInfoFun (
    throw "Android NDK doesn't support building on ${stdenv.buildPlatform.config}, as far as we know"
  );
  targetInfo = ndkTargetInfoFun (
    throw "Android NDK doesn't support targetting ${stdenv.targetPlatform.config}, as far as we know"
  );

  androidSdkVersion =
    if
@@ -74,6 +79,10 @@ let
  );
in

if !config.allowAliases && (ndkBuildInfoFun null == null || ndkTargetInfoFun null == null) then
  # Don't throw without aliases to not break CI.
  null
else
  lib.recurseIntoAttrs rec {
    # Misc tools
    binaries = stdenv.mkDerivation {
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ let
      majorVersion = lib.versions.major ndkVersion;
    in
    import ./androidndk-pkgs.nix {
      inherit lib;
      inherit config lib;
      inherit (buildPackages)
        makeWrapper
        autoPatchelfHook
+80 −75
Original line number Diff line number Diff line
{
  config,
  lib,
  stdenv,
  fetchFromGitHub,
@@ -57,6 +58,8 @@ let
      true
    else
      versionOlder (versions.major (getVersion erlang)) maxShiftMajor;
  minAssert = versionAtLeast (getVersion erlang) minimumOTPVersion;
  bothAssert = minAssert && maxAssert;

  elixirShebang =
    if stdenv.hostPlatform.isDarwin then
@@ -70,9 +73,11 @@ let

  erlc_opts = [ "deterministic" ] ++ optionals debugInfo [ "debug_info" ];
in
assert assertMsg (versionAtLeast (getVersion erlang) minimumOTPVersion) compatibilityMsg;
assert assertMsg maxAssert compatibilityMsg;

if !config.allowAliases && !bothAssert then
  # Don't throw without aliases to not break CI.
  null
else
  assert assertMsg bothAssert compatibilityMsg;
  stdenv.mkDerivation {
    pname = "${baseName}";

+81 −75
Original line number Diff line number Diff line
{
  config,
  lib,
  fetchFromGitHub,
  erlang,
@@ -37,6 +38,8 @@ let

  mainVersion = versions.major (getVersion erlang);

  maxAssert = versionAtLeast maximumOTPVersion mainVersion;

  proper = buildHex {
    name = "proper";
    version = "1.4.0";
@@ -45,10 +48,13 @@ let
  };

in
assert (assertMsg (versionAtLeast maximumOTPVersion mainVersion)) ''
if !config.allowAliases && !maxAssert then
  # Don't throw without aliases to not break CI.
  null
else
  assert assertMsg maxAssert ''
    LFE ${version} is supported on OTP <=${maximumOTPVersion}, not ${mainVersion}.
  '';

  buildRebar3 {
    name = baseName;

+9 −3
Original line number Diff line number Diff line
@@ -5097,11 +5097,10 @@ with pkgs;
  # The GCC used to build libc for the target platform. Normal gccs will be
  # built with, and use, that cross-compiled libc.
  gccWithoutTargetLibc =
    assert stdenv.targetPlatform != stdenv.hostPlatform;
    let
      libc1 = binutilsNoLibc.libc;
    in
    wrapCCWith {
    (wrapCCWith {
      cc = gccFun {
        # copy-pasted
        inherit noSysDirs;
@@ -5127,7 +5126,14 @@ with pkgs;
      bintools = binutilsNoLibc;
      libc = libc1;
      extraPackages = [ ];
    }).overrideAttrs
      (prevAttrs: {
        meta = prevAttrs.meta // {
          badPlatforms =
            (prevAttrs.meta.badPlatforms or [ ])
            ++ lib.optionals (stdenv.targetPlatform == stdenv.hostPlatform) [ stdenv.hostPlatform.system ];
        };
      });

  inherit (callPackage ../development/compilers/gcc/all.nix { inherit noSysDirs; })
    gcc9