Skip to content

Commit 829cd4b

Browse files
authored
Merge pull request #57 from aiuto/lic
Add rules_license style declaration.
2 parents 3fbc687 + c688024 commit 829cd4b

File tree

6 files changed

+57
-5
lines changed

6 files changed

+57
-5
lines changed

BUILD

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1-
package(default_visibility = ["//visibility:public"])
1+
load("@rules_license//rules:license.bzl", "license")
22

3-
licenses(["notice"])
3+
package(
4+
default_applicable_licenses = [":license"],
5+
default_visibility = ["//visibility:public"],
6+
)
7+
8+
license(
9+
name = "license",
10+
license_kinds = [
11+
"@rules_license//licenses/spdx:Apache-2.0",
12+
],
13+
license_text = "LICENSE",
14+
)
415

5-
exports_files(["LICENSE"])
16+
exports_files([
17+
"LICENSE",
18+
"MODULE.bazel",
19+
])
620

721
filegroup(
822
name = "srcs",

MODULE.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module(
22
name = "platforms",
3-
version = "0.0.6", # keep in sync with version.bzl
3+
version = "0.0.7", # keep in sync with version.bzl
44
compatibility_level = 1,
55
)
6+
7+
bazel_dep(name = "rules_license", version = "0.0.4")

WORKSPACE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
workspace(name = "platforms")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
name = "rules_license",
7+
urls = [
8+
"https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz",
9+
"https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz",
10+
],
11+
sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381",
12+
)

WORKSPACE.bzlmod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Include dependencies which are only needed for development here.
2+
#
3+
# Even if this is empty, you need it with bzlmod enable to prevent
4+
# bzlmod from bringing in WORKSPACE too.

tests/BUILD

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
load("//:version.bzl", "version")
2+
3+
package(default_visibility = ["//visibility:private"])
4+
5+
# This is a quick hack to make sure that version.bzl agrees with MODULE.bazel
6+
# It only works from Linux, but that is sufficient, becuase we do a presubmit
7+
# run linux, so we will still catch a mismatch.
8+
genrule(
9+
name = "versions_match",
10+
outs = ["found_it"],
11+
cmd = ";\n".join([
12+
"""echo version: %s""" % version,
13+
"""grep 'version = "%s",' $(location //:MODULE.bazel) >$(location :found_it)""" % version,
14+
]),
15+
target_compatible_with = [
16+
"//os:linux",
17+
],
18+
tools = [
19+
"//:MODULE.bazel",
20+
],
21+
)

version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
"""The version of bazelbuild/platforms."""
1515

16-
version = "0.0.6"
16+
version = "0.0.7"

0 commit comments

Comments
 (0)