Skip to content

Commit

Permalink
Start converting pkg rules to a separate repo (#27)
Browse files Browse the repository at this point in the history
- Move to ABSL flags.
- Add deps.bzl.
- Fix some docs. There is certainly more to do.
- Fix the tests to use the runfiles library rather than ad hoc methods

Note that the tests are now all in a distinct folder from the BUILD file
which contains the tools needed to create packages. This is an experiment
in packaging techniques for rules. The idea is that most users should be
able to import a "thin" version of a rule set.  That would only include
the files needed to use the rule, but not those needed to test and or
package the rules. That would currently be all the *files* in pkg but
none of the folders.

A "thicker" version might include the tests, but at the cost of perhaps
making your workspace deps resolver bring in more things.

The "thickest" version would include all the code needed to repackage
and redistribute the rule set. That would be using the full source
distribution.

I may abandon this experiment and fold tests back together with the
sources, but doing so will not impact users of the tools, so that
would be transparent and harmless. So please indulge me for now.
  • Loading branch information
aiuto authored Jun 6, 2019
1 parent 80387a3 commit 864739f
Show file tree
Hide file tree
Showing 33 changed files with 4,784 additions and 0 deletions.
63 changes: 63 additions & 0 deletions pkg/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
licenses(["notice"]) # Apache 2.0

exports_files(
glob(["*.bzl"]),
visibility = ["//visibility:public"],
)

py_library(
name = "archive",
srcs = [
"__init__.py",
"archive.py",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)

py_binary(
name = "build_tar",
srcs = ["build_tar.py"],
python_version = "PY2",
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":archive",
"@abseil_py//absl/flags",
],
)

py_binary(
name = "make_deb",
srcs = ["make_deb.py"],
python_version = "PY2",
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":archive",
"@abseil_py//absl/flags",
],
)

# Used by pkg_rpm in rpm.bzl.
py_binary(
name = "make_rpm",
srcs = ["make_rpm.py"],
python_version = "PY2",
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":make_rpm_lib",
],
)

py_library(
name = "make_rpm_lib",
srcs = ["make_rpm.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
"@abseil_py//absl/flags",
],
)
Loading

0 comments on commit 864739f

Please sign in to comment.