From bb0cc21a8020475f9314be5d917a446a266c5277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Facundo=20Dom=C3=ADnguez?= Date: Wed, 24 Mar 2021 16:56:57 +0000 Subject: [PATCH] Always pass an environment to run_ghc. --- haskell/private/actions/link.bzl | 3 +++ haskell/toolchain.bzl | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/haskell/private/actions/link.bzl b/haskell/private/actions/link.bzl index 14dc9e8b2..24ddd585f 100644 --- a/haskell/private/actions/link.bzl +++ b/haskell/private/actions/link.bzl @@ -1,5 +1,6 @@ """Actions for linking object code produced by compilation""" +load("@bazel_skylib//lib:dicts.bzl", "dicts") load(":private/packages.bzl", "expose_packages", "pkg_info_to_compile_flags") load(":private/pkg_id.bzl", "pkg_id") load(":private/cc_libraries.bzl", "create_link_config") @@ -186,6 +187,7 @@ def link_binary( mnemonic = "HaskellLinkBinary", arguments = args, params_file = objects_dir_manifest, + env = dicts.add(hs.env, cc.env), ) return (executable, dynamic_libs) @@ -368,6 +370,7 @@ def link_library_dynamic(hs, cc, posix, dep_info, extra_srcs, objects_dir, my_pk mnemonic = "HaskellLinkDynamicLibrary", arguments = args, params_file = objects_dir_manifest, + env = dicts.add(hs.env, cc.env), ) return dynamic_library diff --git a/haskell/toolchain.bzl b/haskell/toolchain.bzl index 8e74e2b20..68a7b7928 100644 --- a/haskell/toolchain.bzl +++ b/haskell/toolchain.bzl @@ -1,6 +1,5 @@ """Rules for defining toolchains""" -load("@bazel_skylib//lib:dicts.bzl", "dicts") load("@bazel_skylib//lib:paths.bzl", "paths") load(":ghc_bindist.bzl", "haskell_register_ghc_bindists") load( @@ -20,10 +19,7 @@ load(":cc.bzl", "ghc_cc_program_args") _GHC_BINARIES = ["ghc", "ghc-pkg", "hsc2hs", "haddock", "ghci", "runghc", "hpc"] -def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, params_file = None, env = None, progress_message = None, input_manifests = None): - if not env: - env = hs.env - +def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, env, params_file = None, progress_message = None, input_manifests = None): args = hs.actions.args() extra_inputs = [] @@ -83,7 +79,7 @@ def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, params_file = None, e executable = hs.ghc_wrapper, mnemonic = mnemonic, progress_message = progress_message, - env = dicts.add(env, cc.env), + env = env, arguments = [compile_flags_file.path, flagsfile_prefix + flagsfile.path], execution_requirements = execution_requirements, )