Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
Match dir layout conventions of other dwtj rules
Browse files Browse the repository at this point in the history
These are all internal changes except for `markdownlint_aspect`. It is
now located in `@dwtj_rules_markdown//markdown:aspects.bzl`.

Also removed lots of unnecessary subpackages `//markdown`. (That is, I
deleted a bunch of empty `BUILD` files within `//markdown`.)
  • Loading branch information
David Johnston committed Sep 2, 2020
1 parent 37dd25a commit 483ea28
Show file tree
Hide file tree
Showing 26 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build --aspects @dwtj_rules_markdown//markdown:defs.bzl%markdownlint_aspect
build --aspects @dwtj_rules_markdown//markdown:aspects.bzl%markdownlint_aspect
6 changes: 6 additions & 0 deletions markdown/aspects.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'''This file exports public rule definitions for use by clients.
'''

load('//markdown:private/aspects/markdownlint_aspect/defs.bzl', _markdownlint_aspect = 'markdownlint_aspect')

markdownlint_aspect = _markdownlint_aspect
Empty file.
6 changes: 1 addition & 5 deletions markdown/defs.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'''This file exports public rule definitions for use by clients.
'''

load('//markdown/rules/markdown_library:defs.bzl', _markdown_library = 'markdown_library')

load('//markdown/aspects/markdownlint_aspect:defs.bzl', _markdownlint_aspect = 'markdownlint_aspect')
load('//markdown:private/rules/markdown_library/defs.bzl', _markdown_library = 'markdown_library')

markdown_library = _markdown_library

markdownlint_aspect = _markdownlint_aspect
Empty file removed markdown/private/BUILD
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This aspect adds a lint as an action to `markdown` targets. The lint is
performed by the lint tool provided by the selected `markdown_lint_toolchain`.
'''

load("@dwtj_rules_markdown//markdown/rules/markdown_library:defs.bzl", "MarkdownInfo")
load("@dwtj_rules_markdown//markdown:private/rules/markdown_library/defs.bzl", "MarkdownInfo")

MarkdownLintAspectInfo = provider(
fields = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ project's implementation. They shouldn't be directly used by any client of this
project.
'''

SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS = ['.json']
SUPPORTED_MARKDOWN_FILE_EXTENSIONS = ['.md', '.markdown']

SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS = ['.json']
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ symlink to a local `markdownlint` binary and some boilerplate to use it as part
of a `markdownlint_toolchain` instance.
"""

load(
'@dwtj_rules_markdown//markdown/private:constants.bzl',
'SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS'
)
load('@dwtj_rules_markdown//markdown:private/common/constants.bzl', 'SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS')

# This is the name used for the config file *within* this external repository.
_CONFIG_FILE = 'markdownlint_config.json'
Expand Down Expand Up @@ -98,11 +95,11 @@ local_markdownlint_repository = repository_rule(
# interpreted as paths relative to the external repository's root.
'_build_file_template': attr.label(
allow_single_file = True,
default = '@dwtj_rules_markdown//markdown/repository_rules/markdownlint/local_markdownlint_repository:template.BUILD',
default = '@dwtj_rules_markdown//markdown:private/repository_rules/markdownlint/local_markdownlint_repository/TEMPLATE.BUILD',
),
'_defs_bzl_file_template': attr.label(
allow_single_file = True,
default = '@dwtj_rules_markdown//markdown/repository_rules/markdownlint/local_markdownlint_repository:template.defs.bzl',
default = '@dwtj_rules_markdown//markdown:private/repository_rules/markdownlint/local_markdownlint_repository/TEMPLATE.defs.bzl',
),
},
environ = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
'''Defines the `markdown_library` Bazel rule.
'''

load('//markdown/private:constants.bzl', 'SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS')
load(
'//markdown:private/common/constants.bzl',
'SUPPORTED_MARKDOWN_FILE_EXTENSIONS',
'SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS',
)

MarkdownInfo = provider(
fields = [
Expand Down Expand Up @@ -32,12 +36,12 @@ markdown_library = rule(
attrs = {
'srcs': attr.label_list(
allow_empty = False,
allow_files = ['.md', '.markdown'],
allow_files = SUPPORTED_MARKDOWN_FILE_EXTENSIONS,
doc = 'A list of Markdown source files to be included.'
),
'deps': attr.label_list(
providers = [MarkdownInfo],
doc = 'A list of labels providing `MarkdownInfo`. Usually, this is a list of names of `markdown_library` instances.'
doc = 'A list of labels providing `MarkdownInfo` (e.g. `markdown_library` target labels).'
),
'markdownlint_config': attr.label(
default = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Markdown lint toolchain instances are created by writing
`markdownlint_toolchain` rule instances.
'''

load('//markdown/private:constants.bzl', 'SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS')
load('//markdown:private/common/constants.bzl', 'SUPPORTED_MARKDOWNLINT_CONFIG_FILE_EXTENSIONS')

MarkdownlintToolchainInfo = provider(
fields = [
Expand Down
2 changes: 1 addition & 1 deletion markdown/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'''This file exports public repository rule definitions for use by clients.
'''

load('//markdown/repository_rules/markdownlint/local_markdownlint_repository:defs.bzl', _local_markdownlint_repository = 'local_markdownlint_repository')
load('//markdown:private/repository_rules/markdownlint/local_markdownlint_repository/defs.bzl', _local_markdownlint_repository = 'local_markdownlint_repository')

local_markdownlint_repository = _local_markdownlint_repository
Empty file removed markdown/repository_rules/BUILD
Empty file.
Empty file.
Empty file.
Empty file removed markdown/rules/BUILD
Empty file.
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion markdown/toolchains.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'''This file exports public toolchain rule definitions for use by clients.
'''

load('//markdown/rules/markdownlint_toolchain:defs.bzl', _markdownlint_toolchain = 'markdownlint_toolchain')
load('//markdown:private/rules/markdownlint_toolchain/defs.bzl', _markdownlint_toolchain = 'markdownlint_toolchain')

markdownlint_toolchain = _markdownlint_toolchain
File renamed without changes.
File renamed without changes.
Empty file removed tests/BUILD
Empty file.

0 comments on commit 483ea28

Please sign in to comment.