Skip to content

Commit

Permalink
Release rules_java v8.5.0-rc1
Browse files Browse the repository at this point in the history
We now use a custom release notes generator because the one from `@rules_pkg` isn't suitable anymore for the new `WORKSPACE` setup

PiperOrigin-RevId: 698036411
Change-Id: I73f6d6464c51abae4bbfc87fbfd71732839993f8
  • Loading branch information
hvadehra authored and rules_java Copybara committed Nov 19, 2024
1 parent bc4a03f commit 7170aea
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rules_java",
version = "8.4.0",
version = "8.5.0-rc1",
bazel_compatibility = [">=6.3.0"],
compatibility_level = 1,
)
Expand Down
8 changes: 2 additions & 6 deletions distro/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_pkg//pkg/releasing:defs.bzl", "print_rel_notes")
load(":relnotes.bzl", "print_rel_notes")

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

Expand All @@ -18,10 +18,6 @@ pkg_tar(

print_rel_notes(
name = "relnotes",
outs = ["relnotes.txt"],
deps_method = "rules_java_dependencies",
repo = "rules_java",
setup_file = "java:repositories.bzl",
toolchains_method = "rules_java_toolchains",
archive = ":rules_java-%s" % module_version(),
version = module_version(),
)
46 changes: 46 additions & 0 deletions distro/relnotes.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Release notes generator"""

def print_rel_notes(*, name, version, archive):
native.genrule(
name = name,
outs = [name + ".txt"],
cmd = """
last_rel=$$(curl -s https://api.github.com/repos/bazelbuild/rules_java/releases/latest | grep 'tag_name' | cut -d: -f2 | tr -cd '[:alnum:].')
changelog=$$(/usr/bin/git log tags/$$last_rel..origin/master --format=oneline --)
sha=$$(/usr/bin/sha256sum $(SRCS) | cut -d ' ' -f1)
cat > $@ <<EOF
**Changes since $$last_rel
$$changelog
**MODULE.bazel setup**
~~~
bazel_dep(name = "rules_java", version = "{VERSION}")
~~~
**WORKSPACE setup**
~~~
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_java",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/{VERSION}/rules_java-{VERSION}.tar.gz",
],
sha256 = "$$sha",
)
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
rules_java_dependencies()
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility
proto_bazel_features(name = "proto_bazel_features")
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
rules_java_toolchains()
~~~
**Using the rules**
See [the source](https://github.com/bazelbuild/rules_java/tree/{VERSION}).
EOF
""".format(ARCHIVE = archive, VERSION = version),
srcs = [archive],
tags = ["local", "manual"],
)

0 comments on commit 7170aea

Please sign in to comment.