Skip to content

Conversation

@simuons
Copy link
Collaborator

@simuons simuons commented Nov 18, 2020

Description

Based on change in rules_proto
bazelbuild/rules_proto#36

rules_proto_dependencies() declares a @com_google_protobuf//:protoc
which points to released protoc binary.

The tricks is to load that before scala_repositories() which has
conditional load for @com_google_protobuf

Motivation

Avoid compiling protoc during bazel build.

Avoid compiling protoc during bazel build.

Based on change in rules_proto
bazelbuild/rules_proto#36

rules_proto_dependencies() declares a @com_google_protobuf//:protoc
which points to released protoc binary.

The tricks is to load that before scala_repositories() which has
conditional load for @com_google_protobuf
@simuons simuons requested a review from ittaiz as a code owner November 18, 2020 12:44
@google-cla google-cla bot added the cla: yes label Nov 18, 2020
Copy link
Contributor

@ittaiz ittaiz left a comment

Choose a reason for hiding this comment

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

Thanks!
2 questions:

  1. If existing clients don't have this will they break?
  2. Update the readme?

@simuons
Copy link
Collaborator Author

simuons commented Nov 20, 2020

If existing clients don't have this will they break?

Clients won't break. rules_proto and com_google_protobuf are defined in rules_scala_setup and guarded by if. So they will get current defaults or whatever they configure.

Update the readme?

Ok I'll remove current recommendation for com_google_protobuf from README and add rules_proto setup after skylib.

@liucijus
Copy link
Collaborator

Ok I'll remove current recommendation for com_google_protobuf from README and add rules_proto setup after skylib.

I think it's more important to explain in the REDAME what's going on. I would say that this change in the first place is intended for rules_scala development. I would keep this change out user attention until we properly refactor repository.bzl's - meaning no update to README or setup instructions.

@ittaiz
Copy link
Contributor

ittaiz commented Nov 20, 2020

Why? Maybe I'm missing the point here. Is this really only meant for rules_scala development or do you just want to keep it internal until the repository.bzl refactor?

@liucijus
Copy link
Collaborator

At the moment rules_proto are also loaded in scala_repositories.bzl. Until this duplication is refactored (which isn't a trivial change), I consider it will be confusing to users.

@ittaiz
Copy link
Contributor

ittaiz commented Nov 20, 2020

Then why do we need to load them twice?

@simuons
Copy link
Collaborator Author

simuons commented Nov 20, 2020

It's loaded twice because I didn't want to change existing macro and break users. Well technically it isn't loaded twice because definition in macro is guarded by the if. I had to define rules_proto before scala_repositories macro because it contains definition for com_google_protobuf and I want to use definition of com_google_protobuf from rules_proto.

Guys can we agree that I'll revert readme change. And will treat this PR as an optimization for rules_scala build. And I'll look at repository.bzl refactoring to align setup of rules_scala and what user have to setup.

@simuons
Copy link
Collaborator Author

simuons commented Nov 20, 2020

Or feel free to close this PR if you think it should be done as a "proper refactoring of repositories.bzl"

@ittaiz
Copy link
Contributor

ittaiz commented Nov 20, 2020

Let's revert the PR and merge.
Maybe just add a comment about why our WORKSPACE setup is different than the readme? If there is already a comment and I forgot about it then 👍🏽

This reverts commit b9a3606.
@ittaiz ittaiz merged commit db8a5c6 into bazel-contrib:master Nov 21, 2020
blorente pushed a commit to twitter-forks/rules_scala that referenced this pull request Nov 23, 2020
* Use released protoc binaries

Avoid compiling protoc during bazel build.

Based on change in rules_proto
bazelbuild/rules_proto#36

rules_proto_dependencies() declares a @com_google_protobuf//:protoc
which points to released protoc binary.

The tricks is to load that before scala_repositories() which has
conditional load for @com_google_protobuf

* lint fix

* Align rules_proto versions

* Update readme

* Revert "Update readme"

This reverts commit b9a3606.
blorente pushed a commit to twitter-forks/rules_scala that referenced this pull request Nov 26, 2020
* Use released protoc binaries

Avoid compiling protoc during bazel build.

Based on change in rules_proto
bazelbuild/rules_proto#36

rules_proto_dependencies() declares a @com_google_protobuf//:protoc
which points to released protoc binary.

The tricks is to load that before scala_repositories() which has
conditional load for @com_google_protobuf

* lint fix

* Align rules_proto versions

* Update readme

* Revert "Update readme"

This reverts commit b9a3606.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants