Skip to content

Commit f56ed00

Browse files
authored
Add deprecation notes for the ‘prebuilt_dependencies’ attribute (#355)
1 parent d60628c commit f56ed00

File tree

45 files changed

+341
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+341
-174
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
113113
tested, pass custom flags to `doctest` executable. See
114114
[#342](https://github.com/tweag/rules_haskell/pull/342).
115115

116+
* The `prebuilt_dependencies` attribute of `haskell_binary` and
117+
`haskell_library` has been deprecated. See
118+
[#355](https://github.com/tweag/rules_haskell/pull/355).
119+
116120
## [0.5] - 2018-04-15
117121

118122
### Added

haskell/private/haskell_impl.bzl

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ def _prepare_srcs(srcs):
4646
return srcs_files, import_dir_map
4747

4848
def haskell_binary_impl(ctx):
49+
if ctx.attr.prebuilt_dependencies:
50+
print("""The attribute 'prebuilt_dependencies' has been deprecated,
51+
use the 'haskell_import' rule instead.
52+
""")
53+
4954
hs = haskell_context(ctx)
5055
dep_info = gather_dep_info(ctx)
5156

@@ -145,6 +150,11 @@ def haskell_binary_impl(ctx):
145150
]
146151

147152
def haskell_library_impl(ctx):
153+
if ctx.attr.prebuilt_dependencies:
154+
print("""The attribute 'prebuilt_dependencies' has been deprecated,
155+
use the 'haskell_import' rule instead.
156+
""")
157+
148158
hs = haskell_context(ctx)
149159
dep_info = gather_dep_info(ctx)
150160
my_pkg_id = pkg_id.new(ctx.label, ctx.attr.version)

haskell/protobuf.bzl

+5
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ registered.
235235
"""
236236

237237
def _protobuf_toolchain_impl(ctx):
238+
if ctx.attr.prebuilt_deps:
239+
print("""The attribute 'prebuilt_deps' has been deprecated,
240+
use the 'deps' attribute instead.
241+
""")
242+
238243
return [
239244
platform_common.ToolchainInfo(
240245
name = ctx.label.name,

tests/BUILD

+109-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ load(
44
"@io_tweag_rules_haskell//haskell:haskell.bzl",
55
"haskell_binary",
66
"haskell_doctest_toolchain",
7+
"haskell_import",
78
"haskell_library",
89
"haskell_proto_toolchain",
910
"haskell_toolchain",
@@ -50,17 +51,115 @@ haskell_proto_toolchain(
5051
name = "protobuf-toolchain",
5152
testonly = 0,
5253
plugin = "@protoc_gen_haskell//:bin/proto-lens-protoc",
53-
prebuilt_deps = [
54-
"base",
55-
"bytestring",
56-
"containers",
57-
"data-default-class",
58-
"lens-family",
59-
"lens-labels",
60-
"proto-lens",
61-
"text",
62-
],
6354
protoc = "@com_google_protobuf//:protoc",
55+
deps = [
56+
"//tests:base",
57+
"//tests:bytestring",
58+
"//tests:containers",
59+
"//tests:data-default-class",
60+
"//tests:lens-family",
61+
"//tests:lens-labels",
62+
"//tests:proto-lens",
63+
"//tests:text",
64+
],
65+
)
66+
67+
haskell_import(
68+
name = "base",
69+
testonly = 0,
70+
package = "base",
71+
visibility = ["//visibility:public"],
72+
)
73+
74+
haskell_import(
75+
name = "bytestring",
76+
testonly = 0,
77+
package = "bytestring",
78+
visibility = ["//visibility:public"],
79+
)
80+
81+
haskell_import(
82+
name = "containers",
83+
testonly = 0,
84+
package = "containers",
85+
visibility = ["//visibility:public"],
86+
)
87+
88+
haskell_import(
89+
name = "directory",
90+
testonly = 0,
91+
package = "directory",
92+
visibility = ["//visibility:public"],
93+
)
94+
95+
haskell_import(
96+
name = "data-default-class",
97+
testonly = 0,
98+
package = "data-default-class",
99+
visibility = ["//visibility:public"],
100+
)
101+
102+
haskell_import(
103+
name = "filepath",
104+
testonly = 0,
105+
package = "filepath",
106+
visibility = ["//visibility:public"],
107+
)
108+
109+
haskell_import(
110+
name = "ghc-prim",
111+
testonly = 0,
112+
package = "ghc-prim",
113+
visibility = ["//visibility:public"],
114+
)
115+
116+
haskell_import(
117+
name = "process",
118+
testonly = 0,
119+
package = "process",
120+
visibility = ["//visibility:public"],
121+
)
122+
123+
haskell_import(
124+
name = "template-haskell",
125+
testonly = 0,
126+
package = "template-haskell",
127+
visibility = ["//visibility:public"],
128+
)
129+
130+
haskell_import(
131+
name = "lens-family",
132+
testonly = 0,
133+
package = "lens-family",
134+
visibility = ["//visibility:public"],
135+
)
136+
137+
haskell_import(
138+
name = "lens-labels",
139+
testonly = 0,
140+
package = "lens-labels",
141+
visibility = ["//visibility:public"],
142+
)
143+
144+
haskell_import(
145+
name = "array",
146+
testonly = 0,
147+
package = "array",
148+
visibility = ["//visibility:public"],
149+
)
150+
151+
haskell_import(
152+
name = "text",
153+
testonly = 0,
154+
package = "text",
155+
visibility = ["//visibility:public"],
156+
)
157+
158+
haskell_import(
159+
name = "proto-lens",
160+
testonly = 0,
161+
package = "proto-lens",
162+
visibility = ["//visibility:public"],
64163
)
65164

66165
rule_test(

tests/BUILD.zlib

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ haskell_library(
3333
"Codec/Compression/Zlib/*.hs",
3434
"Codec/Compression/Zlib/*.hsc",
3535
]),
36-
deps = ["zlib-import"],
37-
prebuilt_dependencies = [
38-
"base",
39-
"bytestring",
40-
"ghc-prim",
36+
deps = [
37+
":zlib-import",
38+
"@io_tweag_rules_haskell//tests:base",
39+
"@io_tweag_rules_haskell//tests:bytestring",
40+
"@io_tweag_rules_haskell//tests:ghc-prim",
4141
],
4242
)

tests/binary-custom-main/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ haskell_binary(
99
name = "binary-custom-main",
1010
srcs = ["foo.hs"],
1111
main_file = "foo.hs",
12-
prebuilt_dependencies = ["base"],
1312
visibility = ["//visibility:public"],
13+
deps = ["//tests:base"],
1414
)

tests/binary-simple/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ load(
88
haskell_binary(
99
name = "binary-simple",
1010
srcs = ["Main.hs"],
11-
prebuilt_dependencies = ["base"],
1211
visibility = ["//visibility:public"],
12+
deps = ["//tests:base"],
1313
)

tests/binary-with-compiler-flags/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ haskell_test(
1212
# compiler_flags:
1313
compiler_flags = ["-with-rtsopts=-qg"],
1414
main_file = "Main.hs",
15-
prebuilt_dependencies = ["base"],
15+
deps = ["//tests:base"],
1616
)

tests/binary-with-data/BUILD

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ haskell_binary(
1111
# Regular file input:
1212
data = ["bin1-input"],
1313
main_file = "bin1.hs",
14-
prebuilt_dependencies = ["base"],
1514
visibility = ["//visibility:public"],
15+
deps = ["//tests:base"],
1616
)
1717

1818
haskell_binary(
@@ -21,9 +21,9 @@ haskell_binary(
2121
args = ["$(location :bin1)"],
2222
data = [":bin1"],
2323
main_file = "bin2.hs",
24-
prebuilt_dependencies = [
25-
"base",
26-
"process",
27-
],
2824
visibility = ["//visibility:public"],
25+
deps = [
26+
"//tests:base",
27+
"//tests:process",
28+
],
2929
)

tests/binary-with-lib/BUILD

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ haskell_library(
1515
haskell_binary(
1616
name = "binary-with-lib",
1717
srcs = ["Main.hs"],
18-
prebuilt_dependencies = ["base"],
1918
visibility = ["//visibility:public"],
20-
deps = ["lib"],
19+
deps = [
20+
":lib",
21+
"//tests:base",
22+
],
2123
)

tests/binary-with-link-flags/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ haskell_binary(
1212
name = "binary-with-link-flags",
1313
srcs = ["Main.hs"],
1414
compiler_flags = ["-threaded"],
15-
prebuilt_dependencies = ["base"],
1615
visibility = ["//visibility:public"],
16+
deps = ["//tests:base"],
1717
)

tests/binary-with-main/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ haskell_binary(
99
name = "binary-with-main",
1010
srcs = ["MainIsHere.hs"],
1111
main_function = "MainIsHere.this",
12-
prebuilt_dependencies = ["base"],
1312
visibility = ["//visibility:public"],
13+
deps = ["//tests:base"],
1414
)

tests/binary-with-prebuilt/BUILD

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ load(
88
haskell_binary(
99
name = "binary-with-prebuilt",
1010
srcs = ["Main.hs"],
11-
prebuilt_dependencies = [
12-
"base",
13-
"template-haskell",
14-
],
1511
visibility = ["//visibility:public"],
12+
deps = [
13+
"//tests:base",
14+
"//tests:template-haskell",
15+
],
1616
)

tests/binary-with-sysdeps/BUILD

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ haskell_cc_import(
1414
haskell_binary(
1515
name = "binary-with-sysdeps",
1616
srcs = ["Main.hs"],
17-
prebuilt_dependencies = ["base"],
1817
visibility = ["//visibility:public"],
19-
deps = [":zlib"],
18+
deps = [
19+
":zlib",
20+
"//tests:base",
21+
],
2022
)

tests/c-compiles-still/BUILD

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ load(
88
haskell_library(
99
name = "foo",
1010
srcs = ["Foo.hs"],
11-
prebuilt_dependencies = ["base"],
12-
deps = ["//tests/c-compiles:c-lib"],
11+
deps = [
12+
"//tests:base",
13+
"//tests/c-compiles:c-lib",
14+
],
1315
)

tests/c-compiles/BUILD

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ cc_library(
1515
haskell_library(
1616
name = "hs-lib",
1717
srcs = ["Lib.hs"],
18-
prebuilt_dependencies = ["base"],
19-
deps = [":c-lib"],
18+
deps = [
19+
":c-lib",
20+
"//tests:base",
21+
],
2022
)
2123

2224
haskell_binary(
2325
name = "c-compiles",
2426
srcs = ["Main.hs"],
25-
prebuilt_dependencies = ["base"],
2627
visibility = ["//visibility:public"],
27-
deps = [":hs-lib"],
28+
deps = [
29+
":hs-lib",
30+
"//tests:base",
31+
],
2832
)

tests/c2hs/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ haskell_library(
3232
":bar",
3333
":foo",
3434
],
35-
prebuilt_dependencies = ["base"],
35+
deps = ["//tests:base"],
3636
)

tests/cc_haskell_import/BUILD

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ load(
1010
haskell_library(
1111
name = "hs-lib-a",
1212
srcs = ["LibA.hs"],
13-
prebuilt_dependencies = ["base"],
13+
deps = ["//tests:base"],
1414
)
1515

1616
haskell_library(
1717
name = "hs-lib-b",
1818
srcs = ["LibB.hs"],
19-
prebuilt_dependencies = ["base"],
20-
deps = [":hs-lib-a"],
19+
deps = [
20+
":hs-lib-a",
21+
"//tests:base",
22+
],
2123
)
2224

2325
cc_haskell_import(

tests/encoding/BUILD

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ haskell_binary(
1414
extra_srcs = [
1515
"unicode.txt",
1616
],
17-
prebuilt_dependencies = [
18-
"base",
19-
"template-haskell",
17+
deps = [
18+
"//tests:base",
19+
"//tests:template-haskell",
2020
],
2121
)

0 commit comments

Comments
 (0)