Skip to content

Commit

Permalink
Merge pull request #57 from aiuto/lic
Browse files Browse the repository at this point in the history
Add rules_license style declaration.
  • Loading branch information
aiuto authored Feb 9, 2023
2 parents 3fbc687 + c688024 commit 829cd4b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
20 changes: 17 additions & 3 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
package(default_visibility = ["//visibility:public"])
load("@rules_license//rules:license.bzl", "license")

licenses(["notice"])
package(
default_applicable_licenses = [":license"],
default_visibility = ["//visibility:public"],
)

license(
name = "license",
license_kinds = [
"@rules_license//licenses/spdx:Apache-2.0",
],
license_text = "LICENSE",
)

exports_files(["LICENSE"])
exports_files([
"LICENSE",
"MODULE.bazel",
])

filegroup(
name = "srcs",
Expand Down
4 changes: 3 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module(
name = "platforms",
version = "0.0.6", # keep in sync with version.bzl
version = "0.0.7", # keep in sync with version.bzl
compatibility_level = 1,
)

bazel_dep(name = "rules_license", version = "0.0.4")
11 changes: 11 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
workspace(name = "platforms")

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

http_archive(
name = "rules_license",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz",
"https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz",
],
sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381",
)
4 changes: 4 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Include dependencies which are only needed for development here.
#
# Even if this is empty, you need it with bzlmod enable to prevent
# bzlmod from bringing in WORKSPACE too.
21 changes: 21 additions & 0 deletions tests/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("//:version.bzl", "version")

package(default_visibility = ["//visibility:private"])

# This is a quick hack to make sure that version.bzl agrees with MODULE.bazel
# It only works from Linux, but that is sufficient, becuase we do a presubmit
# run linux, so we will still catch a mismatch.
genrule(
name = "versions_match",
outs = ["found_it"],
cmd = ";\n".join([
"""echo version: %s""" % version,
"""grep 'version = "%s",' $(location //:MODULE.bazel) >$(location :found_it)""" % version,
]),
target_compatible_with = [
"//os:linux",
],
tools = [
"//:MODULE.bazel",
],
)
2 changes: 1 addition & 1 deletion version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
"""The version of bazelbuild/platforms."""

version = "0.0.6"
version = "0.0.7"

0 comments on commit 829cd4b

Please sign in to comment.