-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example that uses google.protobuf well-known types #1820
Comments
@mrmeku maybe? |
Any pointers to repos that use the well-known protobuf types? |
I tried again recently and am getting a new error in protos the depend on The protobuf code raising the error is // GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var google_type_latlng_pb = require('proj/google/type/latlng_pb');
goog.object.extend(proto, google_type_latlng_pb); Looking at the relevant codegen code in the protobuffers project: // Generate "require" statements.
if ((options.import_style == GeneratorOptions::kImportCommonJs ||
options.import_style == GeneratorOptions::kImportCommonJsStrict)) {
printer->Print("var jspb = require('google-protobuf');\n");
printer->Print("var goog = jspb;\n");
// Do not use global scope in strict mode
if (options.import_style == GeneratorOptions::kImportCommonJsStrict) {
printer->Print("var proto = {};\n\n");
} else {
printer->Print("var global = Function('return this')();\n\n");
}
for (int i = 0; i < file->dependency_count(); i++) {
const std::string& name = file->dependency(i)->name();
printer->Print(
"var $alias$ = require('$file$');\n"
"goog.object.extend(proto, $alias$);\n",
"alias", ModuleAlias(name), "file",
GetRootPath(file->name(), name) + GetJSFilename(options, name));
}
} The ts_devserver I'm using has these scripts: scripts = [
"@npm//:node_modules/tslib/tslib.js",
":rxjs_umd_modules",
# We are manaully adding the bazel generated named-UMD date-fns bundle here as
# named-UMD bundles for non-APF npm packages are not yet automatically added.
# This file is generated by the npm_umd_bundle @npm//date-fns:date-fns__umd
# rule that is setup by yarn_install.
"@npm//date-fns:date-fns.umd.js",
# Needed for gRPC support
"@npm_bazel_labs//grpc_web:bootstrap_scripts",
"@npm//google-protobuf:google-protobuf.umd.js",
"@npm_bazel_labs//protobufjs:bootstrap_scripts",
], |
More relevant code: load("@rules_proto//proto:defs.bzl", "proto_library")
load("@npm_bazel_labs//:index.bzl", "ts_proto_library")
proto_library(
name = "app_proto",
srcs = ["app.proto"],
visibility = ["//visibility:public"],
deps = ["@go_googleapis//google/type:latlng_proto"],
)
ts_proto_library(
name = "app_ts_proto",
proto = ":app_proto",
visibility = ["//visibility:public"],
) syntax = "proto3";
package dashboard;
import "google/type/latlng.proto";
message Place {
string name = 1;
google.type.LatLng lat_lng = 2;
} ts_proto_library source code seems to call pbjs with either Unfortunately I haven't managed to get a development version of rules_nodejs |
This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
This issue was automatically closed because it went two weeks without a reply since it was labeled "Can Close?" |
Please reopen. |
I have an example using googleapi annotations, kind related. Added However I had to strip out |
I believe |
This issue has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
Please keep open.
…On Sun, Feb 14, 2021 at 5:58 PM github-actions[bot] < ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any activity for 90 days. It will be closed if no further activity occurs
in two weeks. Collaborators can add a "cleanup" or "need: discussion" label
to keep it open indefinitely. Thanks for your contributions to rules_nodejs!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1820 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUO57WWSKGUJIR6XRYWZ3S7B5VJANCNFSM4MGCPBGA>
.
|
I'm experiencing this issue as well, but wanted to report a workaround that I'm using. Example:
Generated:
Proto doesn't seem to exist until after the first:
I made a workaround that seems to work: Create a local empty proto:
Then import it above your other imports.
|
This issue has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
Please keep open
…On Tue, Jul 13, 2021, 7:06 PM github-actions[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any activity for 90 days. It will be closed if no further activity occurs
in two weeks. Collaborators can add a "cleanup" or "need: discussion" label
to keep it open indefinitely. Thanks for your contributions to rules_nodejs!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1820 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUO52NHNB4HHS44ZG4F7DTXTWKDANCNFSM4MGCPBGA>
.
|
This issue has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
okay thanks @tsawada FWIW I think rules_nodejs is going to drop all protobuf/grpc as part of our scope reduction for 5.0, others are doing a more capable job with that and it's orthogonal to providing a node toolchain and fetching npm dependencies. |
🚀 feature request
Relevant Rules
ts_proto_library: There are no examples of protos that depend on
@com_google_protobuf//:timestamp_proto
or similar in the examples directoryts_devserver: When I tried including a ts_proto_library that depends on "@com_google_protobuf//:timestamp_proto", I get errors. See next section.
Description
the following error in my devserver:
Where my proto file looks like
The build rule looks like
Describe the solution you'd like
A tiny example of a working gRPC app (Typescript without Angular, please, as small of a WORKSPACE and BUILD file as possible).
Describe alternatives you've considered
I am currently working around my issues with well-known types by using worse versions of those types.
The text was updated successfully, but these errors were encountered: