bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.99k stars 4.03k forks source link

incompatible_load_proto_rules_from_bzl: load the Protobuf rules from @rules_proto #8922

Open Yannic opened 5 years ago

Yannic commented 5 years ago

Flag: --incompatible_load_proto_rules_from_bzl Available since: 0.29 Will be flipped in: TBD Tracking issue: #8891

proto_library and proto_lang_toolchain have to be loaded from @rules_proto.

For example, if you are usingproto_library, add the following load statement to your BUILD/bzl file.

load("@rules_proto//proto:defs.bzl", "proto_library")

You can use the following buildifier command to automate the changes to your BUILD/bzl files:

buildifier --lint=fix --warnings=native-proto <path/to/BUILD>

You will have to add proto_library to your WORKSPACE file as well:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_proto",
    sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
    strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
        "https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
    ],
)
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
Yannic commented 5 years ago

@iirina Can you add the labels breaking-change-1.0, incompatible-change, migration-ready, and migration-0.29 per https://docs.bazel.build/versions/0.28.0/backward-compatibility.html#github-labels? Thanks!

iirina commented 5 years ago

@Yannic done! Thanks!

dslomov commented 5 years ago

Will the migration tooling be available to do the migration? (based on buildifier)

Yannic commented 5 years ago

Yes, a buildifier fix has been added in https://github.com/bazelbuild/buildtools/pull/674

Yannic commented 5 years ago

This flag won't be flipped in Bazel 1.0. Could someone remove breaking-change-1.0?

hlopko commented 4 years ago

Hi Yannic, I had to make a decision whether to flip this flag (and similar flags for C++, Java, and Python) in case we have 2.0 in December, and I said we shouldn't (the ecosystem is not yet ready). I hope you agree with that.

limdor commented 2 years ago

What is the status of this flag, it is saying will be flipped TBD but breaking change 5.0. Is it flipped in Bazel 5?

lberki commented 2 years ago

@philwo I assume we are not flipping this in 5.0 since we decided to go with builtin Starlark rules instead for the time being?

lberki commented 2 years ago

/cc @comius

Yannic commented 2 years ago

I don't think it's ready for flipping in 5.0 (would like to do it eventually though)

comius commented 2 years ago

Absolutely, not flipping in 5.0. I removed the label on the issue.

github-actions[bot] commented 1 year ago

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.