Skip to content

Commit

Permalink
maprule: hide it, not ready for public use. (#133)
Browse files Browse the repository at this point in the history
Move maprule() to a private directory, to
discourage use of it. I (@laszlocsomor) am
planning breaking changes to it.

Also move private files (rule implementations) to
a subdirectory "rules/private/", to clean up the
"rules/" directory.
  • Loading branch information
laszlocsomor committed Mar 20, 2019
1 parent aeefb65 commit 3721d32
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 47 deletions.
7 changes: 0 additions & 7 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ stardoc(
deps = ["//rules:copy_file"],
)

stardoc(
name = "maprule_docs",
out = "maprule_doc_gen.md",
input = "//rules:maprule.bzl",
deps = ["//rules:maprule"],
)

stardoc(
name = "write_file_docs",
out = "write_file_doc_gen.md",
Expand Down
38 changes: 2 additions & 36 deletions rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,13 @@ bzl_library(
bzl_library(
name = "copy_file",
srcs = ["copy_file.bzl"],
deps = [":copy_file_private"],
)

bzl_library(
name = "copy_file_private",
srcs = ["copy_file_private.bzl"],
visibility = ["//visibility:private"],
)

bzl_library(
name = "maprule",
srcs = ["maprule.bzl"],
deps = [":maprule_private"],
)

bzl_library(
name = "maprule_private",
srcs = ["maprule_private.bzl"],
visibility = ["//visibility:private"],
deps = [
":maprule_util",
"//lib:dicts",
"//lib:paths",
],
)

bzl_library(
name = "maprule_util",
srcs = ["maprule_util.bzl"],
deps = ["//rules/private:copy_file_private"],
)

bzl_library(
name = "write_file",
srcs = ["write_file.bzl"],
deps = [":write_file_private"],
)

bzl_library(
name = "write_file_private",
srcs = ["write_file_private.bzl"],
visibility = ["//visibility:private"],
deps = ["//rules/private:write_file_private"],
)

# Exported for build_test.bzl to make sure of, it is an implementation detail
Expand Down
2 changes: 1 addition & 1 deletion rules/copy_file.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on Windows (no Bash is required).
"""

load(
":copy_file_private.bzl",
"//rules/private:copy_file_private.bzl",
_copy_file = "copy_file",
)

Expand Down
35 changes: 35 additions & 0 deletions rules/private/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
load("//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "copy_file_private",
srcs = ["copy_file_private.bzl"],
visibility = ["//rules:__pkg__"],
)

bzl_library(
name = "write_file_private",
srcs = ["write_file_private.bzl"],
visibility = ["//rules:__pkg__"],
)

bzl_library(
name = "maprule",
srcs = ["maprule.bzl"],
visibility = ["//tests:__pkg__"],
deps = [":maprule_private"],
)

bzl_library(
name = "maprule_private",
srcs = ["maprule_private.bzl"],
deps = [
":maprule_util",
"//lib:dicts",
"//lib:paths",
],
)

bzl_library(
name = "maprule_util",
srcs = ["maprule_util.bzl"],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion rules/write_file.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ file. Instead they use Starlark's built-in file writing action
"""

load(
":write_file_private.bzl",
"//rules/private:write_file_private.bzl",
_write_file = "write_file",
)

Expand Down
5 changes: 4 additions & 1 deletion tests/maprule/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# This package aids testing the 'maprule' rule.
#
# ATTENTION: As of 2019-03-20, maprule is not ready for public use.
# @laszlocsomor is planning incompatible changes to the rule.

load("//rules:maprule.bzl", "bash_maprule")
load("//rules/private:maprule.bzl", "bash_maprule")

package(default_testonly = 1)

Expand Down
2 changes: 1 addition & 1 deletion tests/maprule_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""Unit tests for maprule.bzl."""

load("//lib:unittest.bzl", "asserts", "unittest")
load("//rules:maprule_testing.bzl", "maprule_testing")
load("//rules/private:maprule_testing.bzl", "maprule_testing")

def _dummy_generating_action(ctx, path):
ctx.actions.write(path, "hello")
Expand Down

0 comments on commit 3721d32

Please sign in to comment.