2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-12-03 17:52:40 +00:00

Merge branch 'master' into c-parsons-patch-1

This commit is contained in:
aiuto 2019-08-21 15:16:49 -04:00 committed by GitHub
commit 8a9708a5ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 57 deletions

View file

@ -1,22 +1,30 @@
workspace(name = "bazel_skylib")
load(":workspace.bzl", "bazel_skylib_workspace")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_federation",
url = "https://github.com/bazelbuild/bazel-federation/archive/130c84ec6d60f31b711400e8445a8d0d4a2b5de8.zip",
sha256 = "9d4fdf7cc533af0b50f7dd8e58bea85df3b4454b7ae00056d7090eb98e3515cc",
strip_prefix = "bazel-federation-130c84ec6d60f31b711400e8445a8d0d4a2b5de8",
type = "zip",
)
bazel_skylib_workspace()
load("@bazel_federation//:repositories.bzl", "bazel_skylib_deps")
bazel_skylib_deps()
load("@bazel_federation//setup:bazel_skylib.bzl", "bazel_skylib_setup")
bazel_skylib_setup()
# Below this line is for documentation generation only,
# and should thus not be included by dependencies on
# bazel-skylib.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:internal_deps.bzl", "bazel_skylib_internal_deps")
http_archive(
name = "io_bazel_skydoc",
url = "https://github.com/bazelbuild/skydoc/archive/0.3.0.tar.gz",
sha256 = "c2d66a0cc7e25d857e480409a8004fdf09072a1bd564d6824441ab2f96448eea",
strip_prefix = "skydoc-0.3.0",
)
bazel_skylib_internal_deps()
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
load("//:internal_setup.bzl", "bazel_skylib_internal_setup")
skydoc_repositories()
bazel_skylib_internal_setup()

21
internal_deps.bzl Normal file
View file

@ -0,0 +1,21 @@
# 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.
"""Dependencies that are needed for running skylib tests."""
load("@bazel_federation//:repositories.bzl", "bazel", "bazel_stardoc")
def bazel_skylib_internal_deps():
bazel()
bazel_stardoc()

18
internal_setup.bzl Normal file
View file

@ -0,0 +1,18 @@
# 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.
"""Setup function that must be invoked before running skylib tests."""
def bazel_skylib_internal_setup():
pass # placeholder function for the federation

35
lib.bzl
View file

@ -14,36 +14,7 @@
"""Index from which multiple modules can be loaded."""
load("//lib:collections.bzl", _collections = "collections")
load("//lib:dicts.bzl", _dicts = "dicts")
load("//lib:new_sets.bzl", _new_sets = "sets")
load("//lib:partial.bzl", _partial = "partial")
load("//lib:paths.bzl", _paths = "paths")
load("//lib:selects.bzl", _selects = "selects")
load("//lib:sets.bzl", _sets = "sets")
load("//lib:shell.bzl", _shell = "shell")
load("//lib:structs.bzl", _structs = "structs")
load("//lib:types.bzl", _types = "types")
load("//lib:unittest.bzl", _asserts = "asserts", _unittest = "unittest")
load("//lib:versions.bzl", _versions = "versions")
print(
"WARNING: lib.bzl is deprecated and will go away in the future, please" +
" directly load the bzl file(s) of the module(s) needed as it is more" +
" efficient.",
fail(
"lib.bzl has been removed, please directly load the bzl file(s) of the" +
" module(s) needed as it is more efficient.",
)
collections = _collections
dicts = _dicts
new_sets = _new_sets
partial = _partial
paths = _paths
selects = _selects
sets = _sets
shell = _shell
structs = _structs
types = _types
versions = _versions
asserts = _asserts
unittest = _unittest

View file

@ -335,6 +335,8 @@ def _fail(env, msg):
msg: The message to log describing the failure.
"""
full_msg = "In test %s: %s" % (env.ctx.attr._impl_name, msg)
# There isn't a better way to output the message in Starlark, so use print.
# buildifier: disable=print
print(full_msg)
env.failures.append(full_msg)

View file

@ -93,8 +93,7 @@ def _check_bazel_version(minimum_bazel_version, maximum_bazel_version = None, ba
minimum_bazel_version,
))
elif not native.bazel_version:
print("Current Bazel is not a release version; cannot check for compatibility. " +
"Make sure that you are running at least Bazel {}.".format(minimum_bazel_version))
# Using a non-release version, assume it is good.
return
else:
bazel_version = native.bazel_version

View file

@ -14,19 +14,10 @@
"""Skylib module containing a library rule for aggregating rules files.
Deprecated:
Removed:
Use bzl_library in bzl_library.bzl instead.
"""
load("//:bzl_library.bzl", "StarlarkLibraryInfo", "bzl_library")
print(
"WARNING: skylark_library.bzl is deprecated and will go away in the future, please" +
" use bzl_library.bzl instead.",
fail(
"skylark_library.bzl has been removed, please use bzl_library.bzl instead.",
)
# These are temporary forwarding macros to facilitate migration to
# the new names for these objects.
SkylarkLibraryInfo = StarlarkLibraryInfo
skylark_library = bzl_library