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

Add starlark rule "experimental_resolve_attr" feature #329

Merged
merged 8 commits into from
Jun 19, 2023

Conversation

pcj
Copy link
Member

@pcj pcj commented Jun 18, 2023

This PR adds a new attribute to the starlark rule struct implementation experimental_resolve_attr that, if provided with a string attribute name such as deps, will perform a default logic for deps resolution. The deps will mirror the deps structure of the underlying proto_library, but for the same rule kind.

This is a bit of a hack; a proper implementation would expose the RuleIndex and other bits typically needed to do custom implementations of the resolve phase.

In preparing this PR it was was discovered that the starlark configuration loading phase was swallowing errors; fixing this triggered fixing a few unrelated starlark errors that had been lurking in the codebase.

@pcj
Copy link
Member Author

pcj commented Jun 19, 2023

@pcj pcj merged commit 3799dab into master Jun 19, 2023
@pcj pcj deleted the experimental_resolve_attr branch June 19, 2023 04:00
sacsar added a commit to Nextdoor/rules_proto that referenced this pull request Aug 4, 2023
* Add bazel to gitignore files

* make tidy

* Add proto_repositories with descriptors

* make tidy

* Update grpc-web to 1.4.2 (for darwin arm64)

* Use grpc-gateway plugin from go_deps

* Copy cmd/gazelle files over from 0.31.0

* Update @bazel_gazelle to 0.31.0

* Build all descriptors in @protoapis

* Move internal packages to a location where 'go build' can find them

* Add testonly flags to all_files

* Sync changes for proto_gazelle

* Move com_google_absl override into deps/BUILD

* Code review

* Fix proto_repository for @googleapis (stackb#324)

* Include vendor tree in proto_repository_tools_srcs
* Rename -override_go_googleapis to -reresolve_known_proto_imports
* Add googleapis to CI build
* Fix TestOverrideRule

* proto_gazelle: support static mode (stackb#327)

This is supported by the underlying gazelle, just need to update
the runner script.

* proto_repository: add attributes to write a proto_repository_info provider (stackb#328)

* Use non-zip archive for @protoapis dep
* Add proto_repository_info provider, rule, and github_proto_repository macro
* Upgrade to rules_go 0.39.1
* Bump minimum bazel version to 5.4.0
* Add test for ProtoRepositoryInfo provider
* Bump bazelci version

* Add starlark rule "experimental_resolve_attr" feature (stackb#329)

* Add starlark rule "experimental_resolve_attr" feature
* Restore proto_repository_tools check
* Fix errors due to hidden/swallowed starlark configuration problems!
* Fix //example/golden:starlark_java_test

---------

Co-authored-by: Paul Johnston <pcj@stack.build>
sacsar added a commit to Nextdoor/rules_proto that referenced this pull request Aug 14, 2023
* Add bazel to gitignore files

* make tidy

* Add proto_repositories with descriptors

* make tidy

* Update grpc-web to 1.4.2 (for darwin arm64)

* Use grpc-gateway plugin from go_deps

* Copy cmd/gazelle files over from 0.31.0

* Update @bazel_gazelle to 0.31.0

* Build all descriptors in @protoapis

* Move internal packages to a location where 'go build' can find them

* Add testonly flags to all_files

* Sync changes for proto_gazelle

* Move com_google_absl override into deps/BUILD

* Code review

* Fix proto_repository for @googleapis (stackb#324)

* Include vendor tree in proto_repository_tools_srcs
* Rename -override_go_googleapis to -reresolve_known_proto_imports
* Add googleapis to CI build
* Fix TestOverrideRule

* proto_gazelle: support static mode (stackb#327)

This is supported by the underlying gazelle, just need to update
the runner script.

* proto_repository: add attributes to write a proto_repository_info provider (stackb#328)

* Use non-zip archive for @protoapis dep
* Add proto_repository_info provider, rule, and github_proto_repository macro
* Upgrade to rules_go 0.39.1
* Bump minimum bazel version to 5.4.0
* Add test for ProtoRepositoryInfo provider
* Bump bazelci version

* Add starlark rule "experimental_resolve_attr" feature (stackb#329)

* Add starlark rule "experimental_resolve_attr" feature
* Restore proto_repository_tools check
* Fix errors due to hidden/swallowed starlark configuration problems!
* Fix //example/golden:starlark_java_test

---------

Co-authored-by: Paul Johnston <pcj@stack.build>
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.

1 participant