Skip to content

Commit 6afbf25

Browse files
committed
Revert "Windows: build simple binary"
This reverts commit 5d67857.
1 parent aac5484 commit 6afbf25

File tree

4 files changed

+15
-37
lines changed

4 files changed

+15
-37
lines changed

haskell/private/actions/compile.bzl

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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")

haskell/private/actions/link.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ def link_binary(
202202
File: produced executable
203203
"""
204204

205-
exe_name = hs.name
206-
executable = hs.actions.declare_file(exe_name)
205+
executable = hs.actions.declare_file(hs.name)
207206
if not hs.toolchain.is_darwin:
208207
compile_output = executable
209208
else:

haskell/private/haskell_impl.bzl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ def haskell_binary_impl(ctx):
5757

5858
# Add any interop info for other languages.
5959
cc = cc_interop_info(ctx)
60-
if hs.toolchain.is_windows:
61-
cc = "Bazel's CC shouldn't be used on Windows"
6260
java = java_interop_info(ctx)
6361

6462
with_profiling = is_profiling_enabled(hs)
@@ -177,8 +175,6 @@ def haskell_library_impl(ctx):
177175

178176
# Add any interop info for other languages.
179177
cc = cc_interop_info(ctx)
180-
if hs.toolchain.is_windows:
181-
cc = "Bazel's CC shouldn't be used on Windows"
182178
java = java_interop_info(ctx)
183179

184180
srcs_files, import_dir_map = _prepare_srcs(ctx.attr.srcs)

haskell/toolchain.bzl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ load(":private/set.bzl", "set")
1919
_GHC_BINARIES = ["ghc", "ghc-pkg", "hsc2hs", "haddock", "ghci"]
2020

2121
def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, params_file = None, env = None, progress_message = None):
22-
if hs.toolchain.is_windows:
23-
cc = None
2422
if not env:
2523
env = hs.env
2624

@@ -62,10 +60,9 @@ def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, params_file = None, e
6260
hs.toolchain.version_file,
6361
ghc_args_file,
6462
extra_args_file,
65-
] + (cc.files if not hs.toolchain.is_windows else [])
63+
] + cc.files
6664
if params_file:
6765
command = """
68-
export PATH=${PATH:-} # otherwise GCC fails on Windows
6966
readarray -t ghc_args < %s
7067
readarray -t extra_args < %s
7168
readarray -t param_file_args < %s

0 commit comments

Comments
 (0)