From 829b99e5b251e10a56354e6a0dfde4555f1cc81b Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 12 Apr 2021 14:33:10 +1000 Subject: [PATCH] force number in protobuf generation Anki's object IDs and millisecond timestamps fit within MAX_SAFE_INTEGER. --- ts/protobuf.bzl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ts/protobuf.bzl b/ts/protobuf.bzl index 23cc8d54c..6d92e3447 100644 --- a/ts/protobuf.bzl +++ b/ts/protobuf.bzl @@ -1,6 +1,6 @@ # taken from example on # https://github.com/bazelbuild/rules_nodejs/commit/078243a217afe85a8c8f449838bb66ca87608aba -# tweaked to use json-module instead of static-module, and disable strict long +# tweaked to use json-module instead of static-module, and force number load("@build_bazel_rules_nodejs//:index.bzl", "js_library") @@ -78,6 +78,7 @@ def protobufjs_library(name, proto, **kwargs): "--target=static-module", "--wrap=default", #"--strict-long", # Force usage of Long type with int64 fields + "--force-number", "--out=$@", "$(execpaths %s)" % proto_target, ], @@ -94,6 +95,7 @@ def protobufjs_library(name, proto, **kwargs): "--target=json-module", "--wrap=default", #"--strict-long", # Force usage of Long type with int64 fields + "--force-number", "--out=$@", "$(execpaths %s)" % proto_target, ],