File tree 3 files changed +31
-7
lines changed
rules_haskell_tests/tests/repl-targets/hs_lib_repl_test
3 files changed +31
-7
lines changed Original file line number Diff line number Diff line change 4
4
"haskell_library" ,
5
5
"haskell_toolchain_library" ,
6
6
)
7
+ load (":maybe_cc_shared_library.bzl" , "maybe_cc_shared_library" )
7
8
8
9
[
9
10
haskell_toolchain_library (name = name )
@@ -42,12 +43,7 @@ cc_library(
42
43
visibility = ["//visibility:public" ],
43
44
)
44
45
45
- cc_shared_library (
46
- name = "ourclibrary_shared" ,
47
- deps = [
48
- ":ourclibrary" ,
49
- ],
50
- )
46
+ library_name = maybe_cc_shared_library (name = "ourclibrary" )
51
47
52
48
config_setting (
53
49
name = "nix" ,
@@ -79,7 +75,7 @@ haskell_library(
79
75
deps = [
80
76
":array" ,
81
77
":base" ,
82
- ":ourclibrary_shared" ,
83
78
":zlib" ,
79
+ library_name ,
84
80
],
85
81
)
Original file line number Diff line number Diff line change @@ -140,3 +140,14 @@ stack_snapshot(
140
140
register_toolchains (
141
141
":c2hs-toolchain" ,
142
142
)
143
+
144
+ http_archive (
145
+ name = "bazel_features" ,
146
+ sha256 = "ba1282c1aa1d1fffdcf994ab32131d7c7551a9bc960fbf05f42d55a1b930cbfb" ,
147
+ strip_prefix = "bazel_features-1.15.0" ,
148
+ url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.15.0/bazel_features-v1.15.0.tar.gz" ,
149
+ )
150
+
151
+ load ("@bazel_features//:deps.bzl" , "bazel_features_deps" )
152
+
153
+ bazel_features_deps ()
Original file line number Diff line number Diff line change
1
+ load ("@bazel_features//:features.bzl" , "bazel_features" )
2
+
3
+ def maybe_cc_shared_library (name , ** kwargs ):
4
+ if _has_cc_shared_library ():
5
+ shared_name = "%s_shared" % name
6
+ native .cc_shared_library (
7
+ name = shared_name ,
8
+ deps = [name ],
9
+ ** kwargs ,
10
+ )
11
+ return shared_name
12
+ return name
13
+
14
+
15
+
16
+ def _has_cc_shared_library ():
17
+ return bazel_features .globals .CcSharedLibraryInfo != None
You can’t perform that action at this time.
0 commit comments