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

ledger-api: Use proto_jars, and publish Protobuf sources separately from the Scala classes. [KVL-714] #8091

Merged
merged 7 commits into from
Nov 27, 2020

Conversation

ghost
Copy link

@ghost ghost commented Nov 27, 2020

The current behavior is to bundle the Protobuf definitions in both the generated Scala JAR and its source JAR. This makes it hard to pull these in and generate the Scala code yourself, because you have to get both the source and the generated code, which means generating your own will lead to classpath conflicts, with multiple versions of the same gRPC classes.

If you were generating Java (or Kotlin, or Clojure, or…) gPRC classes, this wouldn't be a problem, but you would have Scala classes on your classpath for no reason.

Changelog

  • [Ledger API] The Scala JARs containing the gRPC definitions no longer contain the *.proto files used to generate the ScalaPB-based classes.
  • [Ledger API] The *.proto files containing the gRPC definitions are now provided by a new Maven Central artifact, with the group "com.daml" and the artifact name "ledger-api-proto".

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

CHANGELOG_BEGIN
- [Ledger API] The Scala JARs containing the gRPC definitions no longer
  contain the *.proto files used to generate the ScalaPB-based classes.
CHANGELOG_END
CHANGELOG_BEGIN
- [Ledger API] The *.proto files containing the gRPC definitions are now
  provided by a new Maven Central artifact, with the group "com.daml"
  and the artifact name "ledger-api-proto".
CHANGELOG_END
Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few comments, thanks!

bazel_tools/proto.bzl Outdated Show resolved Hide resolved
visibility = ["//visibility:public"],
) if is_windows == False else None

if maven_group and maven_artifact_prefix:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we always generate this or does this fail if this is not set? The logic is complex enough so if we can make less things conditional, it seems a bit simpler.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the target doesn't have Maven coordinates.

bazel_tools/proto.bzl Outdated Show resolved Hide resolved
bazel_tools/proto.bzl Outdated Show resolved Hide resolved
@@ -45,7 +45,7 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar")
],
maven_artifact_prefix = "daml-lf-%s-archive" % version,
maven_group = "com.daml",
strip_import_prefix = "src/main/protobuf/",
strip_import_prefix = "src/main/protobuf",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed to require this? Was it broken before?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has exactly the same behavior, but this makes it more consistent with other usages of the same parameter.

release/src/Util.hs Outdated Show resolved Hide resolved
@ghost ghost added the automerge label Nov 27, 2020
@mergify mergify bot merged commit 052f69c into master Nov 27, 2020
@mergify mergify bot deleted the samir/ledger-api/reuse-proto-jars branch November 27, 2020 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants