Merge pull request #35 from fweikert:distro

PiperOrigin-RevId: 272444545
Change-Id: I8d582773c5ef124ecafe77a353434887f1abc1aa
This commit is contained in:
Copybara-Service 2019-10-02 08:49:43 -07:00
commit f871759081
8 changed files with 84 additions and 4 deletions

8
BUILD
View File

@ -3,3 +3,11 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) licenses(["notice"])
exports_files(["LICENSE"]) exports_files(["LICENSE"])
filegroup(
name = "distribution",
srcs = [
"LICENSE",
],
visibility = ["@//distro:__pkg__"],
)

View File

@ -4,9 +4,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive( http_archive(
name = "bazel_federation", name = "bazel_federation",
url = "https://github.com/bazelbuild/bazel-federation/archive/a3e140a91ea9ea25b01ad0cc6fbfcaf74f65498f.zip", url = "https://github.com/bazelbuild/bazel-federation/archive/f0e5eda7f0cbfe67f126ef4dacb18c89039b0506.zip", # 2019-09-30
sha256 = "026149d1273a87c634d2270004865fd7474420f88d5bd6ea8d8cd71f4b0f0542", sha256 = "33222ab7bcc430f1ff1db8788c2e0118b749319dd572476c4fd02322d7d15792",
strip_prefix = "bazel-federation-a3e140a91ea9ea25b01ad0cc6fbfcaf74f65498f", strip_prefix = "bazel-federation-f0e5eda7f0cbfe67f126ef4dacb18c89039b0506",
type = "zip", type = "zip",
) )

View File

@ -44,3 +44,14 @@ filegroup(
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
# TODO(aiuto): Find a way to strip this rule from the distribution tarball.
filegroup(
name = "distribution",
srcs = glob([
"**",
]),
visibility = [
"//distro:__pkg__",
],
)

17
cc/version.bzl Normal file
View File

@ -0,0 +1,17 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Information about the present version of rules_cc."""
version = "0.0.1"

30
distro/BUILD Normal file
View File

@ -0,0 +1,30 @@
package(
default_visibility = ["//visibility:private"],
)
load("@rules_cc//cc:version.bzl", "version")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//releasing:defs.bzl", "print_rel_notes")
# Build the artifact to put on the github release page.
pkg_tar(
name = "rules_cc-%s" % version,
srcs = [
"//:distribution",
"//cc:distribution",
],
extension = "tar.gz",
# It is all source code, so make it read-only.
mode = "0444",
# Make it owned by root so it does not have the uid of the CI robot.
owner = "0.0",
package_dir = ".",
strip_prefix = ".",
)
print_rel_notes(
name = "relnotes",
outs = ["relnotes.txt"],
repo = "rules_cc",
version = version,
)

11
distro/README.md Normal file
View File

@ -0,0 +1,11 @@
# Package rules_cc
```bash
bazel build :relnotes
cat ../bazel-bin/distro/relnotes.txt
tar tzf ../bazel-bin/distro/rules_cc-*.tar.gz
```
- Create a new release
- Copy/paste relnotes.txt into the notes. Adjust as needed.
- Upload the tar.gz file as an artifact.

View File

@ -14,7 +14,7 @@
"""Dependencies that are needed for rules_cc tests and tools.""" """Dependencies that are needed for rules_cc tests and tools."""
load("@bazel_federation//:repositories.bzl", "bazel_skylib", "protobuf", "rules_go") load("@bazel_federation//:repositories.bzl", "bazel_skylib", "protobuf", "rules_go", "rules_pkg")
load("@bazel_federation//:third_party_repositories.bzl", "abseil_py", "py_mock", "six", "zlib") load("@bazel_federation//:third_party_repositories.bzl", "abseil_py", "py_mock", "six", "zlib")
def rules_cc_internal_deps(): def rules_cc_internal_deps():
@ -22,6 +22,7 @@ def rules_cc_internal_deps():
bazel_skylib() bazel_skylib()
protobuf() protobuf()
rules_go() rules_go()
rules_pkg()
abseil_py() abseil_py()
py_mock() py_mock()

View File

@ -19,8 +19,10 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
# TODO(fweikert): Also load rules_go's setup.bzl file from the federation once it exists # TODO(fweikert): Also load rules_go's setup.bzl file from the federation once it exists
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_federation//setup:rules_pkg.bzl", "rules_pkg_setup")
def rules_cc_internal_setup(): def rules_cc_internal_setup():
bazel_skylib_workspace() bazel_skylib_workspace()
go_rules_dependencies() go_rules_dependencies()
go_register_toolchains() go_register_toolchains()
rules_pkg_setup()