Skip to content

Commit

Permalink
create cleaner, smaller distro using rules_pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
thundergolfer-two committed Jul 18, 2020
1 parent d5f56a0 commit 85f25eb
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
45 changes: 45 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")

load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_python//:version.bzl", "version")

buildifier(
name = "buildifier",
)

package(default_visibility = ["//visibility:private"])

licenses(["notice"]) # MIT

exports_files([
"LICENSE",
"version.bzl",
])

filegroup(
name = "distribution",
srcs = [
"BUILD",
"LICENSE",
"config.bzl",
"mypy.bzl",
"rules.bzl",
"current_mypy_version.txt",
"//mypy:distribution",
"//repositories:distribution",
"//templates:distribution",
"//third_party:distribution",
],
)

version = "0.0.8"

# Build the artifact to put on the github release page.
pkg_tar(
name = "bazel_mypy_integration-{version}".format(version = version),
srcs = [
":distribution",
],
extension = "tar.gz",
# It is all source code, so make it read-only.
mode = "0444",
# Make it owned by root
owner = "0.0",
package_dir = ".",
strip_prefix = ".",
)
13 changes: 13 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,16 @@ pip_import(
load("@my_deps//:requirements.bzl", "pip_install")

pip_install()

########################
# OTHER
########################

http_archive(
name = "rules_pkg",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
],
sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
)
6 changes: 6 additions & 0 deletions mypy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ py_binary(
requirement("typed_ast"),
],
)

filegroup(
name = "distribution",
srcs = glob(["**"]),
visibility = ["//:__pkg__"],
)
5 changes: 5 additions & 0 deletions repositories/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "distribution",
srcs = glob(["**"]),
visibility = ["//:__pkg__"],
)
6 changes: 6 additions & 0 deletions templates/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
exports_files(["mypy.sh.tpl"])

filegroup(
name = "distribution",
srcs = glob(["**"]),
visibility = ["//:__pkg__"],
)
7 changes: 7 additions & 0 deletions third_party/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exports_files(["mypy.sh.tpl"])

filegroup(
name = "distribution",
srcs = glob(["**"]),
visibility = ["//:__pkg__"],
)

0 comments on commit 85f25eb

Please sign in to comment.