Use rules_pkg to make the skylib tarball for a release. (#185)

* add empty CHANGELOG.md to try to reuse bazel release.sh

* checkpoint a new distribution method

* Update CHANGELOG.

* checkpoint relnew

* get the tarball working

* fix visibilyt

* whitespace

* punctuation typos

* buildify

* linty fresh
This commit is contained in:
aiuto 2019-08-23 14:37:16 -04:00 committed by GitHub
parent c5bd012f31
commit ab87410a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 139 additions and 7 deletions

16
BUILD
View File

@ -47,3 +47,19 @@ bzl_library(
name = "bzl_library",
srcs = ["bzl_library.bzl"],
)
# The files needed for distribution.
# TODO(aiuto): We should strip this from the release, but there is no
# capability now to generate BUILD.foo from BUILD and have it appear in the
# tarball as BUILD.
filegroup(
name = "distribution",
srcs = [
"LICENSE",
"BUILD",
"CODEOWNERS",
"CONTRIBUTORS",
"//lib:distribution",
"//rules:distribution",
] + glob(["*.bzl"]),
)

45
CHANGELOG.md Normal file
View File

@ -0,0 +1,45 @@
**New Features**
- common_settings.bzl: Standard data types for user defined build
configuration. Common scalar build settings for rules to use so they don't
recreate them locally. This fulfills part of the SBC design doc:
https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw/edit#bookmark=id.iiumwic0jphr
- selects.bzl: Add config_setting_group for config_setting AND/OR-chaining
Implements
https://github.com/bazelbuild/proposals/blob/master/designs/2018-11-09-config-setting-chaining.md.
- Make sets.bzl point to new_sets.bzl instead of old_sets.bzl. new_sets.bzl
and old_sets.bzl should be removed in the following skylib release.
- run_binary: runs an executable as an action
- This rule is an alternative for genrule(): it can run a binary with the
desired arguments, environment, inputs, and outputs, as a single build
action, without shelling out to Bash.
- Fixes https://github.com/bazelbuild/bazel-skylib/issues/149
- New `native_binary()` and `native_test()` rules let you wrap a pre-built
binary in a binary and test rule respectively.
- native_binary() wraps a pre-built binary or script in a *_binary rule
interface. Rules like genrule can tool-depend on it, and it can be
executed with "bazel run". This rule can also augment the binary with
runfiles.
- native_test() is similar, but creates a testable rule instead of a
binary rule.
- Fixes https://github.com/bazelbuild/bazel-skylib/issues/148
- diff_test: test rule compares two files and passes if the files match.
On Linux/macOS/non-Windows, the test compares files using 'diff'.
On Windows, the test compares files using 'fc.exe'. This utility is
available on all Windows versions I tried (Windows 2008 Server, Windows 2016
Datacenter Core).
See https://github.com/bazelbuild/bazel/issues/5508,
https://github.com/bazelbuild/bazel/issues/4319
- maprule: move functionality to maprule_util.bzl. maprule_util.bzl will
benefit planned new rules (namely a genrule alternative).
**This release is tested with Bazel 0.28**

29
distribution/BUILD Normal file
View File

@ -0,0 +1,29 @@
package(
default_visibility = ["//visibility:private"],
)
load("@bazel_skylib//: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 = "bazel-skylib-%s" % version,
srcs = [
"//: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 = "bazel-skylib",
version = version,
)

View File

@ -14,8 +14,14 @@
"""Dependencies that are needed for running skylib tests."""
load("@bazel_federation//:repositories.bzl", "bazel", "bazel_stardoc")
load(
"@bazel_federation//:repositories.bzl",
"bazel",
"bazel_stardoc",
"rules_pkg",
)
def bazel_skylib_internal_deps():
bazel()
bazel_stardoc()
rules_pkg()

View File

@ -4,12 +4,6 @@ licenses(["notice"])
package(default_visibility = ["//visibility:public"])
filegroup(
name = "test_deps",
testonly = True,
srcs = ["BUILD"] + glob(["*.bzl"]),
)
bzl_library(
name = "collections",
srcs = ["collections.bzl"],
@ -78,3 +72,19 @@ bzl_library(
name = "versions",
srcs = ["versions.bzl"],
)
filegroup(
name = "test_deps",
testonly = True,
srcs = ["BUILD"] + glob(["*.bzl"]),
)
# The files needed for distribution
filegroup(
name = "distribution",
srcs = glob(["*"]),
visibility = [
"//:__pkg__",
"//distribution:__pkg__",
],
)

View File

@ -56,3 +56,13 @@ filegroup(
"empty_test.sh",
] + glob(["*.bzl"]),
)
# The files needed for distribution
filegroup(
name = "distribution",
srcs = glob(["*"]),
visibility = [
"//:__pkg__",
"//distribution:__pkg__",
],
)

16
version.bzl Normal file
View File

@ -0,0 +1,16 @@
# 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.
"""The version of bazel-skylib."""
version = "0.10.0"