Skip to content

Declare that bazel is under an Apache 2.0 license #15543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

load("//tools/distributions:distribution_rules.bzl", "distrib_jar_filegroup")
load("//tools/python:private/defs.bzl", "py_binary")
load("@rules_license//rules:license.bzl", "license")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

package(default_visibility = ["//scripts/release:__pkg__"])

license(
name = "license",
license_kinds = [
"@rules_license//licenses/spdx:Apache-2.0",
],
copyright_notice = "Copyright © 2014 The Bazel Authors. All rights reserved.",
license_text = "LICENSE",
package_name = "bazelbuild/bazel",
)

exports_files(["LICENSE"])

filegroup(
Expand All @@ -31,6 +42,7 @@ filegroup(
"//src/main/starlark/tests/builtins_bzl:srcs",
] + glob([".bazelci/*"]) + [".bazelrc"],
visibility = ["//src/test/shell/bazel:__pkg__"],
applicable_licenses = ["@io_bazel//:license"],
)

filegroup(
Expand Down
10 changes: 6 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ bind(
actual = "//third_party:guava",
)

# We must control the version of rules_license we use, so we load ours before
# any other repo can bring it in through their deps.
dist_http_archive(
name = "rules_license",
)

# For src/test/shell/bazel:test_srcs
load("//src/test/shell/bazel:list_source_repository.bzl", "list_source_repository")

Expand Down Expand Up @@ -658,7 +664,3 @@ debian_deps()
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

dist_http_archive(
name = "rules_license",
)
1 change: 1 addition & 0 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ DIST_DEPS = {
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"rules_pkg": {
Expand Down
3 changes: 3 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ load(":embedded_tools.bzl", "srcsfile")
load(":rule_size_test.bzl", "rule_size_test")
load("//src:release_archive.bzl", "release_archive")

package(default_applicable_licenses = ["@io_bazel//:license"])

exports_files(["jdeps_modules.golden"])

md5_cmd = "set -e -o pipefail && %s $(SRCS) | %s | %s > $@"
Expand Down Expand Up @@ -379,6 +381,7 @@ genrule(
"//scripts/packages:__pkg__", # For installer generation
"//src/java:__subpackages__", # For command line reference generation
"//src/test:__subpackages__", # For integration tests
"//tools/compliance:__pkg__", # For license gathering
],
) for suffix, jdk in [
("-dev", "_jdk_allmodules"),
Expand Down
1 change: 1 addition & 0 deletions src/test/shell/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gen_workspace_stanza(
repos = [
"rules_cc",
"rules_java",
"rules_license",
"rules_proto",
],
template = "testenv.sh.tmpl",
Expand Down
1 change: 1 addition & 0 deletions src/test/shell/bazel/srcs_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SRCS_QUERY="$(mktemp)"
# a local_repository located in third_party.
cat "${TEST_SRCDIR}/io_bazel/src/test/shell/bazel/srcs_list" \
| sed -e 's|@bazel_tools//||' \
| sed -e 's|@io_bazel//||' \
| sed -e 's|@\([^/]*\)//|third_party/\1|' \
| sed -e 's|^//||' | sed -e 's|^:||' | sed -e 's|:|/|' \
| sort -u >"${SRCS_QUERY}"
Expand Down
10 changes: 10 additions & 0 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ EOF
"remotejdk18_win_arm64_for_testing"
"rules_cc"
"rules_java"
"rules_license"
"rules_proto"
"rules_python"
)
Expand Down Expand Up @@ -543,6 +544,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
EOF
}

function add_rules_license_to_workspace() {
cat >> "$1"<<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

{rules_license}
EOF
}

function add_rules_proto_to_workspace() {
cat >> "$1"<<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand All @@ -563,6 +572,7 @@ workspace(name = "$2")
EOF
add_rules_cc_to_workspace "WORKSPACE"
add_rules_java_to_workspace "WORKSPACE"
add_rules_license_to_workspace "WORKSPACE"
add_rules_proto_to_workspace "WORKSPACE"

maybe_setup_python_windows_workspace
Expand Down
1 change: 1 addition & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ filegroup(
"//tools/buildstamp:srcs",
"//tools/build_defs:srcs",
"//tools/build_rules:srcs",
"//tools/compliance:srcs",
"//tools/config:srcs",
"//tools/coverage:srcs",
"//tools/ctexplain:srcs",
Expand Down
25 changes: 25 additions & 0 deletions tools/compliance/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tools for gathering OSS licenses

load("@rules_license//rules:compliance.bzl", "check_license")

licenses(["notice"]) # Apache 2.0

filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = [
"//tools:__subpackages__",
"@bazel_tools//tools:__subpackages__",
],
)

check_license(
name = "check_bazel",
check_conditions = False,
copyright_notices = "bazel_copyrights.txt",
license_texts = "bazel_licenses.txt",
report = "bazel_report",
deps = [
"//src:bazel-bin_nojdk",
],
)