Skip to content

Commit

Permalink
Add deprecation notes for the ‘prebuilt_dependencies’ attribute (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkkrp authored Jul 22, 2018
1 parent d60628c commit f56ed00
Show file tree
Hide file tree
Showing 45 changed files with 341 additions and 174 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
tested, pass custom flags to `doctest` executable. See
[#342](https://github.com/tweag/rules_haskell/pull/342).

* The `prebuilt_dependencies` attribute of `haskell_binary` and
`haskell_library` has been deprecated. See
[#355](https://github.com/tweag/rules_haskell/pull/355).

## [0.5] - 2018-04-15

### Added
Expand Down
10 changes: 10 additions & 0 deletions haskell/private/haskell_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def _prepare_srcs(srcs):
return srcs_files, import_dir_map

def haskell_binary_impl(ctx):
if ctx.attr.prebuilt_dependencies:
print("""The attribute 'prebuilt_dependencies' has been deprecated,
use the 'haskell_import' rule instead.
""")

hs = haskell_context(ctx)
dep_info = gather_dep_info(ctx)

Expand Down Expand Up @@ -145,6 +150,11 @@ def haskell_binary_impl(ctx):
]

def haskell_library_impl(ctx):
if ctx.attr.prebuilt_dependencies:
print("""The attribute 'prebuilt_dependencies' has been deprecated,
use the 'haskell_import' rule instead.
""")

hs = haskell_context(ctx)
dep_info = gather_dep_info(ctx)
my_pkg_id = pkg_id.new(ctx.label, ctx.attr.version)
Expand Down
5 changes: 5 additions & 0 deletions haskell/protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ registered.
"""

def _protobuf_toolchain_impl(ctx):
if ctx.attr.prebuilt_deps:
print("""The attribute 'prebuilt_deps' has been deprecated,
use the 'deps' attribute instead.
""")

return [
platform_common.ToolchainInfo(
name = ctx.label.name,
Expand Down
119 changes: 109 additions & 10 deletions tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load(
"@io_tweag_rules_haskell//haskell:haskell.bzl",
"haskell_binary",
"haskell_doctest_toolchain",
"haskell_import",
"haskell_library",
"haskell_proto_toolchain",
"haskell_toolchain",
Expand Down Expand Up @@ -50,17 +51,115 @@ haskell_proto_toolchain(
name = "protobuf-toolchain",
testonly = 0,
plugin = "@protoc_gen_haskell//:bin/proto-lens-protoc",
prebuilt_deps = [
"base",
"bytestring",
"containers",
"data-default-class",
"lens-family",
"lens-labels",
"proto-lens",
"text",
],
protoc = "@com_google_protobuf//:protoc",
deps = [
"//tests:base",
"//tests:bytestring",
"//tests:containers",
"//tests:data-default-class",
"//tests:lens-family",
"//tests:lens-labels",
"//tests:proto-lens",
"//tests:text",
],
)

haskell_import(
name = "base",
testonly = 0,
package = "base",
visibility = ["//visibility:public"],
)

haskell_import(
name = "bytestring",
testonly = 0,
package = "bytestring",
visibility = ["//visibility:public"],
)

haskell_import(
name = "containers",
testonly = 0,
package = "containers",
visibility = ["//visibility:public"],
)

haskell_import(
name = "directory",
testonly = 0,
package = "directory",
visibility = ["//visibility:public"],
)

haskell_import(
name = "data-default-class",
testonly = 0,
package = "data-default-class",
visibility = ["//visibility:public"],
)

haskell_import(
name = "filepath",
testonly = 0,
package = "filepath",
visibility = ["//visibility:public"],
)

haskell_import(
name = "ghc-prim",
testonly = 0,
package = "ghc-prim",
visibility = ["//visibility:public"],
)

haskell_import(
name = "process",
testonly = 0,
package = "process",
visibility = ["//visibility:public"],
)

haskell_import(
name = "template-haskell",
testonly = 0,
package = "template-haskell",
visibility = ["//visibility:public"],
)

haskell_import(
name = "lens-family",
testonly = 0,
package = "lens-family",
visibility = ["//visibility:public"],
)

haskell_import(
name = "lens-labels",
testonly = 0,
package = "lens-labels",
visibility = ["//visibility:public"],
)

haskell_import(
name = "array",
testonly = 0,
package = "array",
visibility = ["//visibility:public"],
)

haskell_import(
name = "text",
testonly = 0,
package = "text",
visibility = ["//visibility:public"],
)

haskell_import(
name = "proto-lens",
testonly = 0,
package = "proto-lens",
visibility = ["//visibility:public"],
)

rule_test(
Expand Down
10 changes: 5 additions & 5 deletions tests/BUILD.zlib
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ haskell_library(
"Codec/Compression/Zlib/*.hs",
"Codec/Compression/Zlib/*.hsc",
]),
deps = ["zlib-import"],
prebuilt_dependencies = [
"base",
"bytestring",
"ghc-prim",
deps = [
":zlib-import",
"@io_tweag_rules_haskell//tests:base",
"@io_tweag_rules_haskell//tests:bytestring",
"@io_tweag_rules_haskell//tests:ghc-prim",
],
)
2 changes: 1 addition & 1 deletion tests/binary-custom-main/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ haskell_binary(
name = "binary-custom-main",
srcs = ["foo.hs"],
main_file = "foo.hs",
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = ["//tests:base"],
)
2 changes: 1 addition & 1 deletion tests/binary-simple/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ load(
haskell_binary(
name = "binary-simple",
srcs = ["Main.hs"],
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = ["//tests:base"],
)
2 changes: 1 addition & 1 deletion tests/binary-with-compiler-flags/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ haskell_test(
# compiler_flags:
compiler_flags = ["-with-rtsopts=-qg"],
main_file = "Main.hs",
prebuilt_dependencies = ["base"],
deps = ["//tests:base"],
)
10 changes: 5 additions & 5 deletions tests/binary-with-data/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ haskell_binary(
# Regular file input:
data = ["bin1-input"],
main_file = "bin1.hs",
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = ["//tests:base"],
)

haskell_binary(
Expand All @@ -21,9 +21,9 @@ haskell_binary(
args = ["$(location :bin1)"],
data = [":bin1"],
main_file = "bin2.hs",
prebuilt_dependencies = [
"base",
"process",
],
visibility = ["//visibility:public"],
deps = [
"//tests:base",
"//tests:process",
],
)
6 changes: 4 additions & 2 deletions tests/binary-with-lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ haskell_library(
haskell_binary(
name = "binary-with-lib",
srcs = ["Main.hs"],
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = ["lib"],
deps = [
":lib",
"//tests:base",
],
)
2 changes: 1 addition & 1 deletion tests/binary-with-link-flags/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ haskell_binary(
name = "binary-with-link-flags",
srcs = ["Main.hs"],
compiler_flags = ["-threaded"],
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = ["//tests:base"],
)
2 changes: 1 addition & 1 deletion tests/binary-with-main/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ haskell_binary(
name = "binary-with-main",
srcs = ["MainIsHere.hs"],
main_function = "MainIsHere.this",
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = ["//tests:base"],
)
8 changes: 4 additions & 4 deletions tests/binary-with-prebuilt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ load(
haskell_binary(
name = "binary-with-prebuilt",
srcs = ["Main.hs"],
prebuilt_dependencies = [
"base",
"template-haskell",
],
visibility = ["//visibility:public"],
deps = [
"//tests:base",
"//tests:template-haskell",
],
)
6 changes: 4 additions & 2 deletions tests/binary-with-sysdeps/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ haskell_cc_import(
haskell_binary(
name = "binary-with-sysdeps",
srcs = ["Main.hs"],
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = [":zlib"],
deps = [
":zlib",
"//tests:base",
],
)
6 changes: 4 additions & 2 deletions tests/c-compiles-still/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ load(
haskell_library(
name = "foo",
srcs = ["Foo.hs"],
prebuilt_dependencies = ["base"],
deps = ["//tests/c-compiles:c-lib"],
deps = [
"//tests:base",
"//tests/c-compiles:c-lib",
],
)
12 changes: 8 additions & 4 deletions tests/c-compiles/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ cc_library(
haskell_library(
name = "hs-lib",
srcs = ["Lib.hs"],
prebuilt_dependencies = ["base"],
deps = [":c-lib"],
deps = [
":c-lib",
"//tests:base",
],
)

haskell_binary(
name = "c-compiles",
srcs = ["Main.hs"],
prebuilt_dependencies = ["base"],
visibility = ["//visibility:public"],
deps = [":hs-lib"],
deps = [
":hs-lib",
"//tests:base",
],
)
2 changes: 1 addition & 1 deletion tests/c2hs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ haskell_library(
":bar",
":foo",
],
prebuilt_dependencies = ["base"],
deps = ["//tests:base"],
)
8 changes: 5 additions & 3 deletions tests/cc_haskell_import/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ load(
haskell_library(
name = "hs-lib-a",
srcs = ["LibA.hs"],
prebuilt_dependencies = ["base"],
deps = ["//tests:base"],
)

haskell_library(
name = "hs-lib-b",
srcs = ["LibB.hs"],
prebuilt_dependencies = ["base"],
deps = [":hs-lib-a"],
deps = [
":hs-lib-a",
"//tests:base",
],
)

cc_haskell_import(
Expand Down
6 changes: 3 additions & 3 deletions tests/encoding/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ haskell_binary(
extra_srcs = [
"unicode.txt",
],
prebuilt_dependencies = [
"base",
"template-haskell",
deps = [
"//tests:base",
"//tests:template-haskell",
],
)
Loading

0 comments on commit f56ed00

Please sign in to comment.