Skip to content
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

[Bug]: configure should set ts_proto_library#files_to_copy #761

Open
BenNeighbour opened this issue Oct 20, 2024 · 1 comment
Open

[Bug]: configure should set ts_proto_library#files_to_copy #761

BenNeighbour opened this issue Oct 20, 2024 · 1 comment
Assignees
Labels
bug Something isn't working untriaged Requires traige

Comments

@BenNeighbour
Copy link

BenNeighbour commented Oct 20, 2024

What happened?

Hey guys! I'm trying to use protobufs with Aspect CLI project (multi-language), and when I add logger.proto file, configure, and build, it throws errors relating to protobuf, on a freshly created project.

Any immediate help/feedback/questions would be really appreciated!

Version

Development (host) and target OS/architectures:

Output of bazel --version:
aspect 2024.42.3-e256e0fbf

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

  • JavaScript + TypeScript
  • Go

How to reproduce

$ aspect init
  Welcome to Aspect, the multi-language monorepo dev platform

  Generate boilerplate code for a new Bazel project using Aspect CLI and Aspect
  Workflows.


┃ Languages to be used in the project
┃   ✓ JavaScript & TypeScript
┃   • Python
┃   ✓ Go
┃   • Java
┃   • C & C++
┃   • Rust


$ cd project_name

$ mkdir -p packages/proto && cat <<EOF > packages/proto/logger.proto
syntax = "proto3";

option java_multiple_files = true;
option java_package = "build.aspect.examples";
option java_outer_classname = "GreeterProto";
option go_package = "github.com/aspect-build/bazel-examples/logger";

service Logger {
  rpc SendLogMessage(LogMessage) returns (Empty) {}
}

message LogMessage {
  string message = 1;
  int64 time = 2;
}

message Empty {}
EOF

bazel configure

$ bazel build //...
ERROR: Traceback (most recent call last):
        File "/Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel", line 27, column 17, in <toplevel>
                ts_proto_library(
        File "/private/var/tmp/_bazel_dev/28aeed2d30bf5427ca4b20c849d21118/external/aspect_rules_ts~/ts/proto.bzl", line 153, column 17, in ts_proto_library
                fail("Either proto_srcs should be set, or copy_files should be False")
Error in fail: Either proto_srcs should be set, or copy_files should be False
ERROR: package contains errors: packages/proto
ERROR: error loading package 'tools': Label '@@rules_python//python/entry_points:py_console_script_binary.bzl' is invalid because 'python/entry_points' is not a package; perhaps you meant to put the colon here: '@@rules_python//python:entry_points/py_console_script_binary.bzl'?
ERROR: package contains errors: packages/proto: Traceback (most recent call last):
        File "/Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel", line 27, column 17, in <toplevel>
                ts_proto_library(
        File "/private/var/tmp/_bazel_dev/28aeed2d30bf5427ca4b20c849d21118/external/aspect_rules_ts~/ts/proto.bzl", line 153, column 17, in ts_proto_library
                fail("Either proto_srcs should be set, or copy_files should be False")
Error in fail: Either proto_srcs should be set, or copy_files should be False
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:27:17: Cannot compute config conditions
ERROR: no such package '@@[unknown repo 'io_bazel_rules_go' requested from @@]//proto': The repository '@@[unknown repo 'io_bazel_rules_go' requested from @@]' could not be resolved: No repository visible as '@io_bazel_rules_go' from main repository
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:12:17: no such package '@@[unknown repo 'io_bazel_rules_go' requested from @@]//proto': The repository '@@[unknown repo 'io_bazel_rules_go' requested from @@]' could not be resolved: No repository visible as '@io_bazel_rules_go' from main repository and referenced by '//packages/proto:logger_go_proto'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:12:17: Target '//packages/proto:logger_proto' contains an error and its package is in error and referenced by '//packages/proto:logger_go_proto'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:20:11: Target '//packages/proto:logger_go_proto' contains an error and its package is in error and referenced by '//packages/proto:logger'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:6:14: Target '//packages/proto:logger.proto' contains an error and its package is in error and referenced by '//packages/proto:logger_proto'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:27:17: Target '//packages/proto:logger_proto' contains an error and its package is in error and referenced by '//packages/proto:_logger_proto_ts_protoc'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:27:17: Target '//packages/proto:_logger_proto_ts.gen_es' contains an error and its package is in error and referenced by '//packages/proto:_logger_proto_ts_protoc'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:27:17: Target '//packages/proto:_logger_proto_ts.gen_connect_es' contains an error and its package is in error and referenced by '//packages/proto:_logger_proto_ts_protoc'
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:27:17: Cannot compute config conditions
ERROR: /Users/dev/Downloads/multi_language_monorepo_magic/packages/proto/BUILD.bazel:27:17: Target '//packages/proto:_logger_proto_ts_protoc' contains an error and its package is in error and referenced by '//packages/proto:logger_proto_ts'
WARNING: errors encountered while analyzing target '//packages/proto:logger_proto', it will not be built.
Analysis failed
WARNING: errors encountered while analyzing target '//packages/proto:_logger_proto_ts.gen_connect_es', it will not be built.
WARNING: errors encountered while analyzing target '//packages/proto:logger_go_proto', it will not be built.
Analysis failed
WARNING: errors encountered while analyzing target '//packages/proto:_logger_proto_ts_protoc', it will not be built.
Analysis failed
WARNING: errors encountered while analyzing target '//packages/proto:logger', it will not be built.
Analysis failed
WARNING: errors encountered while analyzing target '//packages/proto:_logger_proto_ts.gen_es', it will not be built.
INFO: Analyzed 32 targets (0 packages loaded, 0 targets configured).
WARNING: errors encountered while analyzing target '//packages/proto:logger_proto_ts', it will not be built.
Analysis failed
INFO: Analysis succeeded for only 25 of 32 top-level targets
INFO: Found 25 targets...
ERROR: command succeeded, but there were errors parsing the target pattern
INFO: Elapsed time: 0.129s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

Any other information?

I expected it to work...

@BenNeighbour BenNeighbour added the bug Something isn't working label Oct 20, 2024
@github-actions github-actions bot added the untriaged Requires traige label Oct 20, 2024
@alexeagle
Copy link
Member

https://github.com/aspect-build/rules_ts/blob/main/ts/proto.bzl#L153 is where we print this message, it could be a lot more helpful about what to do

@alexeagle alexeagle changed the title [Bug]: Proto Files not compiling on fresh aspect init project [Bug]: configure should set files_to_copy Oct 21, 2024
@alexeagle alexeagle changed the title [Bug]: configure should set files_to_copy [Bug]: configure should set ts_proto_library#files_to_copy Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

3 participants