@@ -29,8 +29,6 @@ def _process_hsc_file(hs, cc, hsc_flags, hsc_file):
2929 (File, string): Haskell source file created by processing hsc_file and
3030 new import directory containing the produced file.
3131 """
32- if hs .toolchain .is_windows :
33- cc = "Bazel's CC shouldn't be used on Windows"
3432 args = hs .actions .args ()
3533
3634 # Output a Haskell source file.
@@ -76,25 +74,19 @@ def _compilation_defaults(hs, cc, java, dep_info, srcs, import_dir_map, extra_sr
7674 DefaultCompileInfo: Populated default compilation settings.
7775 """
7876
79- if hs .toolchain .is_windows :
80- cc = "Bazel's CC shouldn't be used on Windows"
81-
8277 ghc_args = []
8378
8479 # GHC expects the CC compiler as the assembler, but segregates the
8580 # set of flags to pass to it when used as an assembler. So we have
8681 # to set both -optc and -opta.
87- # Since we don't use Bazel's CC toolchain on windows, there's nothing to
88- # do.
89- if not hs .toolchain .is_windows :
90- cc_args = [
91- "-optc" + f
92- for f in cc .compiler_flags
93- ] + [
94- "-opta" + f
95- for f in cc .compiler_flags
96- ]
97- ghc_args += cc_args
82+ cc_args = [
83+ "-optc" + f
84+ for f in cc .compiler_flags
85+ ] + [
86+ "-opta" + f
87+ for f in cc .compiler_flags
88+ ]
89+ ghc_args += cc_args
9890
9991 interface_dir_raw = "_iface_prof" if with_profiling else "_iface"
10092 object_dir_raw = "_obj_prof" if with_profiling else "_obj"
@@ -180,9 +172,8 @@ def _compilation_defaults(hs, cc, java, dep_info, srcs, import_dir_map, extra_sr
180172 set .mutable_insert (import_dirs , idir )
181173
182174 ghc_args += ["-i{0}" .format (d ) for d in set .to_list (import_dirs )]
183- if not hs .toolchain .is_windows :
184- ghc_args += ["-optP" + f for f in cc .cpp_flags ]
185- ghc_args += cc .include_args
175+ ghc_args += ["-optP" + f for f in cc .cpp_flags ]
176+ ghc_args += cc .include_args
186177
187178 locale_archive_depset = (
188179 depset ([hs .toolchain .locale_archive ]) if hs .toolchain .locale_archive != None else depset ()
@@ -252,6 +243,7 @@ def _compilation_defaults(hs, cc, java, dep_info, srcs, import_dir_map, extra_sr
252243 depset (boot_files ),
253244 set .to_depset (source_files ),
254245 extra_srcs ,
246+ depset (cc .hdrs ),
255247 set .to_depset (dep_info .package_confs ),
256248 set .to_depset (dep_info .package_caches ),
257249 set .to_depset (dep_info .interface_dirs ),
@@ -261,11 +253,11 @@ def _compilation_defaults(hs, cc, java, dep_info, srcs, import_dir_map, extra_sr
261253 depset ([e .mangled_lib for e in set .to_list (dep_info .external_libraries )]),
262254 java .inputs ,
263255 locale_archive_depset ,
264- ] + ([ depset ( cc . hdrs )] if not hs . toolchain . is_windows else []) ),
256+ ]),
265257 objects_dir = objects_dir ,
266258 interfaces_dir = interfaces_dir ,
267259 outputs = [objects_dir , interfaces_dir ],
268- header_files = set .from_list (( cc .hdrs if not hs . toolchain . is_windows else []) + header_files ),
260+ header_files = set .from_list (cc .hdrs + header_files ),
269261 boot_files = set .from_list (boot_files ),
270262 source_files = source_files ,
271263 extra_source_files = extra_srcs ,
@@ -289,10 +281,6 @@ def compile_binary(hs, cc, java, dep_info, srcs, ls_modules, import_dir_map, ext
289281 modules: set of module names
290282 source_files: set of Haskell source files
291283 """
292-
293- if hs .toolchain .is_windows :
294- cc = "Bazel's CC shouldn't be used on Windows"
295-
296284 c = _compilation_defaults (hs , cc , java , dep_info , srcs , import_dir_map , extra_srcs , compiler_flags , with_profiling , my_pkg_id = None , version = version )
297285 c .args .add_all (["-main-is" , main_function ])
298286 if dynamic :
@@ -356,8 +344,6 @@ def compile_library(hs, cc, java, dep_info, srcs, ls_modules, other_modules, exp
356344 source_files: set of Haskell module files
357345 import_dirs: import directories that should make all modules visible (for GHCi)
358346 """
359- if hs .toolchain .is_windows :
360- cc = "Bazel's CC shouldn't be used on Windows"
361347 c = _compilation_defaults (hs , cc , java , dep_info , srcs , import_dir_map , extra_srcs , compiler_flags , with_profiling , my_pkg_id = my_pkg_id , version = my_pkg_id .version )
362348 if with_shared :
363349 c .args .add ("-dynamic-too" )
0 commit comments