Skip to content

Commit

Permalink
Depend on rules_python (bazelbuild#140)
Browse files Browse the repository at this point in the history
* load rules python

* add workspace deps

* add missing loads
  • Loading branch information
aiuto authored Mar 12, 2020
1 parent 2b375a0 commit 48001d1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
load("@rules_python//python:defs.bzl", "py_binary", "py_library")

licenses(["notice"]) # Apache 2.0

exports_files(
Expand Down
2 changes: 2 additions & 0 deletions pkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ http_archive(
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()
```

<a name="basic-example"></a>
Expand Down
8 changes: 8 additions & 0 deletions pkg/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# Workspace dependencies for rules_pkg/pkg

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

Expand All @@ -29,6 +30,13 @@ def rules_pkg_dependencies():
],
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
)
maybe(
git_repository,
name = "rules_python",
remote = "https://github.com/bazelbuild/rules_python.git",
commit = "4b84ad270387a7c439ebdccfd530e2339601ef27", # (2019-08-02 or later)
)


def rules_pkg_register_toolchains():
pass
Expand Down
2 changes: 2 additions & 0 deletions pkg/distro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package(
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//:version.bzl", "version")
load("@rules_pkg//releasing:defs.bzl", "print_rel_notes")
load("@rules_python//python:defs.bzl", "py_test")

# Build the artifact to put on the github release page.
pkg_tar(
Expand All @@ -27,6 +28,7 @@ print_rel_notes(
outs = ["relnotes.txt"],
repo = "rules_pkg",
version = version,
deps_method = "rules_pkg_dependencies",
)

py_test(
Expand Down
4 changes: 3 additions & 1 deletion pkg/distro/packaging_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def testBuild(self):
workspace_content = '\n'.join((
'workspace(name = "test_rules_pkg_packaging")',
release_tools.workspace_content(
'file://%s' % local_path, self.repo, sha256)
'file://%s' % local_path, self.repo, sha256,
deps_method='rules_pkg_dependencies'
)
))
workspace.write(workspace_content)
if _VERBOSE:
Expand Down
2 changes: 2 additions & 0 deletions pkg/releasing/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")

package(
default_visibility = ["//visibility:public"],
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pkg_rpm = rule(
# Implicit dependencies.
"rpmbuild_path": attr.string(),
"_make_rpm": attr.label(
default = Label("@rules_pkg//:make_rpm"),
default = Label("//:make_rpm"),
cfg = "host",
executable = True,
allow_files = True,
Expand Down
1 change: 1 addition & 0 deletions pkg/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ licenses(["notice"]) # Apache 2.0

load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar", "pkg_zip")
load("@rules_pkg//:rpm.bzl", "pkg_rpm")
load("@rules_python//python:defs.bzl", "py_test")

genrule(
name = "generate_files",
Expand Down

0 comments on commit 48001d1

Please sign in to comment.