Skip to content

Commit

Permalink
Bump version to 3.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dibenede committed Jun 17, 2024
1 parent bd0540e commit 5d939db
Showing 1 changed file with 41 additions and 43 deletions.
84 changes: 41 additions & 43 deletions protobuf_javascript_release.bzl
Original file line number Diff line number Diff line change
@@ -1,57 +1,55 @@
"""Generates package naming variables for use with rules_pkg."""

load("@rules_pkg//:providers.bzl", "PackageVariablesInfo")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@rules_pkg//:providers.bzl", "PackageVariablesInfo")

_PROTOBUF_JAVASCRIPT_VERSION = "3.21.2"

_PROTOBUF_JAVASCRIPT_VERSION = "3.21.3"

def _package_naming_impl(ctx):
values = {}
values["version"] = _PROTOBUF_JAVASCRIPT_VERSION

if ctx.attr.platform != "":
values["platform"] = ctx.attr.platform
return PackageVariablesInfo(values=values)

# infer from the current cpp toolchain.
toolchain = find_cpp_toolchain(ctx)
cpu = toolchain.cpu
system_name = toolchain.target_gnu_system_name

# rename cpus to match what we want artifacts to be
if cpu == "systemz":
cpu = "s390_64"
elif cpu == "aarch64":
cpu = "aarch_64"
elif cpu == "ppc64":
cpu = "ppcle_64"

# use the system name to determine the os and then create platform names
if "apple" in system_name:
values["platform"] = "osx-" + cpu
elif "linux" in system_name:
values["platform"] = "linux-" + cpu
elif "mingw" in system_name:
if cpu == "x86_64":
values["platform"] = "win64"
values = {}
values["version"] = _PROTOBUF_JAVASCRIPT_VERSION

if ctx.attr.platform != "":
values["platform"] = ctx.attr.platform
return PackageVariablesInfo(values = values)

# infer from the current cpp toolchain.
toolchain = find_cpp_toolchain(ctx)
cpu = toolchain.cpu
system_name = toolchain.target_gnu_system_name

# rename cpus to match what we want artifacts to be
if cpu == "systemz":
cpu = "s390_64"
elif cpu == "aarch64":
cpu = "aarch_64"
elif cpu == "ppc64":
cpu = "ppcle_64"

# use the system name to determine the os and then create platform names
if "apple" in system_name:
values["platform"] = "osx-" + cpu
elif "linux" in system_name:
values["platform"] = "linux-" + cpu
elif "mingw" in system_name:
if cpu == "x86_64":
values["platform"] = "win64"
else:
values["platform"] = "win32"
else:
values["platform"] = "win32"
else:
values["platform"] = "unknown"

return PackageVariablesInfo(values=values)
values["platform"] = "unknown"

return PackageVariablesInfo(values = values)

package_naming = rule(
implementation=_package_naming_impl,
attrs={
implementation = _package_naming_impl,
attrs = {
# Necessary data dependency for find_cpp_toolchain.
"_cc_toolchain":
attr.label(
default=Label("@bazel_tools//tools/cpp:current_cc_toolchain"),),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"platform": attr.string(),
},
toolchains=["@bazel_tools//tools/cpp:toolchain_type"],
incompatible_use_toolchain_transition=True,
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
incompatible_use_toolchain_transition = True,
)

0 comments on commit 5d939db

Please sign in to comment.