-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I have the following code:
load("@io_bazel_rules_openapi//openapi:openapi.bzl", "openapi_gen")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
openapi_gen(
name="sample-go-src",
language="go",
spec="sample.yaml",
api_package = "com.shingo.swagger.api",
model_package = "com.shingo.swagger.model",
)
go_library(
name = "sample-go",
srcs = ["//bazel-bin/model/sample_go_codegen.srcjar"], # produced by sample-go-src
)
If I build sample-go-src, I can see that it builds successfully and outputs a .srcjar file.
bazel build -c opt model:sample-go-src 1 err | 16:51:20
INFO: Analyzed target //model:sample-go-src (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //model:sample-go-src up-to-date:
bazel-bin/model/sample-go-src_codegen.srcjar
INFO: Elapsed time: 0.634s, Critical Path: 0.56s
INFO: 2 processes: 1 internal, 1 linux-sandbox.
INFO: Build completed successfully, 2 total actions
However, if I build sample-go, I get the below error:
bazel build -c opt model:sample-go 2 err | 16:54:00
ERROR:<workspace-dir>/model/BUILD:14:11: no such package 'bazel-bin/model/sample_go_codegen.srcjar': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
-<workspace-dir>/bazel-bin/model/sample_go_codegen.srcjar and referenced by '//model:sample-go'
ERROR: Analysis of target '//model:sample-go' failed; build aborted: no such package 'bazel-bin/model/sample_go_codegen.srcjar': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
- <workspace-dir>/bazel-bin/model/sample_go_codegen.srcjar
INFO: Elapsed time: 0.062s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
Consequently, I cannot declare dependency on the go_library to use in my Go code.
Metadata
Metadata
Assignees
Labels
No labels