Skip to content

Commit ec3bc7f

Browse files
pcjdibenede
authored andcommitted
Revert BUILD file change, remove bigint handling in writer.js
1 parent 6a7eced commit ec3bc7f

File tree

2 files changed

+63
-40
lines changed

2 files changed

+63
-40
lines changed

BUILD.bazel

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#
33
# See also code generation logic under generator/
44

5+
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
6+
load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
7+
load("//:protobuf_javascript_release.bzl", "package_naming")
8+
59
config_setting(
610
name = "x64_x86_windows",
711
values = {"cpu": "x64_x86_windows"},
@@ -27,38 +31,65 @@ config_setting(
2731
values = {"cpu": "darwin_x86_64"},
2832
)
2933

30-
filegroup(
31-
name = "javascript",
34+
package_naming(
35+
name = "protobuf_javascript_pkg_naming",
36+
platform = select({
37+
":k8": "linux-x86_64", # currently the only supported build type in Github Actions
38+
":x64_x86_windows": "win32",
39+
":x64_windows": "win64",
40+
":darwin_arm64": "osx-aarch_64",
41+
":darwin_x86_64": "osx-x86_64",
42+
"//conditions:default": "" # continues with current behavior when no --cpu is specified allowing existing internal builds to function
43+
})
44+
)
45+
46+
pkg_files(
47+
name = "plugin_files",
48+
srcs = ["//generator:protoc-gen-js"],
49+
attributes = pkg_attributes(mode = "0555"),
50+
prefix = "bin/",
51+
)
52+
53+
pkg_files(
54+
name = "dist_files",
55+
srcs = glob([
56+
"google/protobuf/*.js",
57+
"google/protobuf/compiler/*.js"
58+
]) + [
59+
"google-protobuf.js",
60+
"package.json",
61+
"README.md",
62+
"LICENSE.md",
63+
"LICENSE-asserts.md",
64+
],
65+
strip_prefix = strip_prefix.from_root(""),
66+
)
67+
68+
pkg_tar(
69+
name = "dist_tar",
3270
srcs = [
33-
"asserts.js",
34-
"binary/any_field_type.js",
35-
"binary/arith.js",
36-
"binary/binary_constants.js",
37-
"binary/bytesource.js",
38-
"binary/bytesource_alias.js",
39-
"binary/decoder.js",
40-
"binary/decoder_alias.js",
41-
"binary/encoder.js",
42-
"binary/encoder_alias.js",
43-
"binary/errors.js",
44-
"binary/internal_buffer.js",
45-
"binary/reader.js",
46-
"binary/reader_alias.js",
47-
"binary/repeated_field_type.js",
48-
"binary/scalar_field_type.js",
49-
"binary/test_utils.js",
50-
"binary/utf8.js",
51-
"binary/utils.js",
52-
"binary/writer.js",
53-
"binary/writer_alias.js",
54-
"bytestring.js",
55-
"debug.js",
56-
"internal_bytes.js",
57-
"internal_options.js",
58-
"internal_public.js",
59-
"map.js",
60-
"message.js",
61-
"unsafe_bytestring.js",
71+
":dist_files",
72+
":plugin_files",
6273
],
63-
visibility = ["//visibility:public"],
74+
extension = "tar.gz",
75+
package_file_name = "protobuf-javascript-{version}-{platform}.tar.gz",
76+
package_variables = ":protobuf_javascript_pkg_naming",
77+
)
78+
79+
pkg_zip(
80+
name = "dist_zip",
81+
srcs = [
82+
":dist_files",
83+
":plugin_files",
84+
],
85+
package_file_name = "protobuf-javascript-{version}-{platform}.zip",
86+
package_variables = ":protobuf_javascript_pkg_naming",
87+
)
88+
89+
filegroup(
90+
name = "dist_all",
91+
srcs = [
92+
":dist_tar",
93+
":dist_zip",
94+
]
6495
)

binary/writer.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,6 @@ class BinaryWriter {
430430
this.encoder_.writeZigzagVarint64(/** @type {number} */(value));
431431
break;
432432

433-
case 'bigint':
434-
this.encoder_.writeZigzagVarint64BigInt(/** @type {bigint} */(value));
435-
break;
436-
437433
default:
438434
this.encoder_.writeZigzagVarint64String(/** @type {string} */(value));
439435
break;
@@ -1425,10 +1421,6 @@ class BinaryWriter {
14251421
this.encoder_.writeZigzagVarint64(v);
14261422
break;
14271423

1428-
case 'bigint':
1429-
this.encoder_.writeZigzagVarint64BigInt(/** @type {bigint} */(v));
1430-
break;
1431-
14321424
default:
14331425
this.encoder_.writeZigzagVarint64String(/** @type {string} */(v));
14341426
break;

0 commit comments

Comments
 (0)