OpenAPITools / openapi-generator-bazel

Bazel plugin for OpenAPI Generator
Apache License 2.0
66 stars 46 forks source link

How to add JavaInfo to deps #35

Closed abiezev closed 2 years ago

abiezev commented 2 years ago

When trying to import a generated kotlin sdk into a service, I am getting an error that the generated openapi sdk does not have mandatory providers: 'JavaInfo'

Error:(3, 15) in deps attribute of kt_jvm_library rule //services/path/... :   '//openapi:com.company.sdk.service' does not have mandatory providers: 'JavaInfo'.

I see in the code that I can add a dep for JavaInfo: https://github.com/OpenAPITools/openapi-generator-bazel/blob/master/internal/openapi_generator.bzl#L131:L137

When I set deps = ["JavaInfo"] I get an error that: rule '//openapi:JavaInfo' does not exist.

Any idea how I should apply JavaInfo to deps? My understanding is that JavaInfo is a provider not a rule.

Just as a note, it seems Kotlin like Scala requires JavaInfo: https://docs.aspect.build/bazelbuild/rules_kotlin/v1.5.0-beta-2/kotlin.html#kt_jvm_library

AndrewGuenther commented 2 years ago

Pretty sure this is a duplicate of #22

Effectively, the output of this rule cannot be depended on by any other rule. I have yet to see a project using this package successfully. As far as I can tell, it will get you the output into bazel-bin, but if you actually want to use that from another bazel target, you cannot.