Skip to content
Open
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
- name: Setup Bazelisk
run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin
- uses: actions/checkout@v4
- name: Build license target
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
run: ~/go/bin/bazelisk build //:license --enable_bzlmod=true --enable_workspace=false
- name: Run bazel-diff tests
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
Expand Down
16 changes: 16 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain")
load("@rules_license//rules:license.bzl", "license")

alias(
name = "bazel-diff",
Expand All @@ -10,6 +11,21 @@ alias(
actual = "//cli/format:format",
)

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

license(
Comment thread
ViggedalZenseact marked this conversation as resolved.
name = "license",
package_name = "bazel-diff",
copyright_notice = "Copyright (c) 2020, Match Group, LLC",
license_kind = "@rules_license//licenses/spdx:BSD-3-Clause",
license_text = "LICENSE",
package_url = "https://github.com/Tinder/bazel-diff",
package_version = "29.0.0",
Comment thread
ViggedalZenseact marked this conversation as resolved.
)

define_kt_toolchain(
name = "kotlin_toolchain",
jvm_target = "11",
Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_java", version = "9.3.0")
bazel_dep(name = "rules_kotlin", version = "2.3.0")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_jvm_external", version = "6.10")

# Add protobuf and grpc for Bazel 9 compatibility
Expand Down
16 changes: 16 additions & 0 deletions tools/generate_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,21 @@ def read_module_version(workspace_dir: Path) -> str:
return match.group(1)


def sync_build_version(workspace_dir: Path, version: str) -> None:
"""Keep the license() package_version in the root BUILD file in sync."""
build_file = workspace_dir / "BUILD"
text = build_file.read_text()
new_text, count = re.subn(
r'(package_version\s*=\s*")[^"]+(")',
rf"\g<1>{version}\g<2>",
text,
)
if count == 0:
raise ValueError("Could not find package_version in BUILD")
if new_text != text:
build_file.write_text(new_text)


def main() -> None:
workspace_dir = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"])
output_path = workspace_dir / "README.md"
Expand All @@ -262,6 +277,7 @@ def main() -> None:

version = read_module_version(workspace_dir)
template = template.replace("{{BAZEL_DIFF_VERSION}}", version)
sync_build_version(workspace_dir, version)

print("Fetching GitHub user data...")
email_map = fetch_github_email_map(REPO)
Expand Down
Loading