├── .bazelci └── presubmit.yml ├── .bazelignore ├── .bazelrc ├── .bazelversion ├── .github └── workflows │ ├── ci.bazelrc │ ├── ci.yaml │ ├── format.yaml │ ├── release.yaml │ └── workspace_snippet.sh ├── .gitignore ├── .npmrc ├── BUILD.bazel ├── CHANGELOG.md ├── DEVELOPMENT.md ├── LICENSE ├── Makefile ├── README.md ├── WORKSPACE ├── cmd ├── depsgen │ ├── BUILD.bazel │ ├── config.go │ ├── depsgen.go │ ├── generator.go │ └── template.go ├── examplegen │ ├── BUILD.bazel │ ├── config.go │ ├── examplegen.go │ ├── generator.go │ ├── linewriter.go │ └── template.go ├── gazelle │ ├── BUILD.bazel │ ├── README.md │ ├── diff.go │ ├── diff_test.go │ ├── fix-update.go │ ├── fix.go │ ├── fix_test.go │ ├── gazelle.go │ ├── integration_test.go │ ├── internal │ │ ├── module │ │ │ ├── BUILD.bazel │ │ │ └── module.go │ │ └── wspace │ │ │ ├── BUILD.bazel │ │ │ ├── finder.go │ │ │ └── finder_test.go │ ├── langs.go │ ├── metaresolver.go │ ├── print.go │ ├── profiler.go │ ├── update-repos.go │ └── wspace.go └── gencopy │ ├── BUILD.bazel │ ├── gencopy.bash.in │ ├── gencopy.bzl │ ├── gencopy.go │ └── gencopy_test.go ├── deps ├── BUILD.bazel ├── closure_deps.bzl ├── core_deps.bzl ├── example_routeguide_nodejs_deps.bzl ├── go_core_deps.bzl ├── grpc_core_deps.bzl ├── grpc_deps.bzl ├── grpc_java_deps.bzl ├── grpc_js_deps.bzl ├── grpc_node_deps.bzl ├── grpc_web_deps.bzl ├── js_core_deps.bzl ├── nodejs_deps.bzl ├── prebuilt_protoc_deps.bzl ├── protobuf_core_deps.bzl ├── protobuf_deps.bzl ├── scala_deps.bzl └── ts_proto_deps.bzl ├── docs ├── .bundle │ └── config ├── .gitignore ├── .ruby-version ├── 0_index.md ├── 404.html ├── BUILD.bazel ├── Gemfile ├── Gemfile.lock ├── Makefile ├── README.md ├── _config.yml ├── assets │ ├── images │ │ ├── closure-logo.svg │ │ └── protobuf.png │ └── js │ │ ├── custom.js │ │ └── search-data.json ├── builtins.md ├── closurejs.md ├── commonjs.md ├── configuration.md ├── cpp.md ├── csharp.md ├── examples.md ├── go.md ├── goembed.md ├── gogo.md ├── gomerge.md ├── guides.md ├── installation.md ├── java.md ├── logos │ ├── stack-build.png │ └── stackb-full.png ├── objc.md ├── php.md ├── plugins.md ├── proto_repository.md ├── python.md ├── ruby.md ├── rules.md ├── scala.md └── starlark_java.md ├── example ├── BUILD.bazel ├── golden │ ├── BUILD.bazel │ ├── README.md │ ├── builtin.WORKSPACE │ ├── golden_test.go │ ├── prebuilt.WORKSPACE │ └── testdata │ │ ├── builtins │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── README.md │ │ ├── WORKSPACE │ │ └── test.proto │ │ ├── closurejs │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── commonjs │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── cpp │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── csharp │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── go │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── goembed │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── proto │ │ │ ├── bar │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ ├── body.proto │ │ │ └── content │ │ │ │ ├── BUILD.in │ │ │ │ └── BUILD.out │ │ │ └── foo │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ ├── content │ │ │ ├── BUILD.in │ │ │ └── BUILD.out │ │ │ └── foo.proto │ │ ├── gogo │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── gomerge │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── proto │ │ │ └── foo │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ ├── body.proto │ │ │ ├── content │ │ │ ├── BUILD.in │ │ │ └── BUILD.out │ │ │ └── foo.proto │ │ ├── imports_csv │ │ ├── .bazelrc │ │ ├── .gazelle.args │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── README.md │ │ ├── WORKSPACE │ │ ├── example.proto │ │ └── imports.csv │ │ ├── java │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── mappingsmerge │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── README.md │ │ ├── WORKSPACE │ │ ├── example.proto │ │ └── support.proto │ │ ├── objc │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── proto_compiled_sources │ │ ├── .bazelrc │ │ ├── .bazelversion │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── README.md │ │ ├── WORKSPACE │ │ ├── api │ │ │ └── v1 │ │ │ │ ├── BUILD.in │ │ │ │ ├── BUILD.out │ │ │ │ └── v1.proto │ │ └── src │ │ │ └── idl │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ └── svc.proto │ │ ├── proto_repository │ │ ├── .bazelrc │ │ ├── .gazelle.args │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── README.md │ │ ├── WORKSPACE │ │ ├── config.yaml │ │ ├── imports.csv │ │ ├── proto │ │ │ └── foo │ │ │ │ ├── BUILD.in │ │ │ │ ├── BUILD.out │ │ │ │ └── app.proto │ │ ├── proto_gazelle_data_test.bzl │ │ ├── proto_repository_info_test.bzl │ │ └── starlark │ │ │ └── plugins.star │ │ ├── python │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── ruby │ │ ├── .bazelrc │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── example.proto │ │ ├── scala │ │ ├── .bazelrc │ │ ├── .gazelle.args │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ ├── config.yaml │ │ ├── imports.csv │ │ ├── lib │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ └── WithSnapshot.scala │ │ ├── proto │ │ │ ├── BUILD.out │ │ │ └── complete.proto │ │ └── syntax │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ ├── noun.proto │ │ │ ├── package.proto │ │ │ ├── pronoun.proto │ │ │ └── service.proto │ │ ├── starlark_java │ │ ├── .bazelrc │ │ ├── .gazelle.args │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ ├── customer │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ └── customer.proto │ │ ├── defs.bzl │ │ ├── lib │ │ │ ├── plugins.star │ │ │ └── rules.star │ │ └── order │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ └── order.proto │ │ └── strip_import_prefix │ │ ├── .bazelrc │ │ ├── .bazelversion │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ ├── module_app │ │ └── app │ │ │ ├── BUILD.in │ │ │ ├── BUILD.out │ │ │ ├── api.proto │ │ │ └── app_py.py │ │ └── module_lib │ │ └── util │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── date.proto │ │ └── nested │ │ └── prefix │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ └── test.proto ├── person │ ├── BUILD.bazel │ └── person.proto ├── place │ ├── BUILD.bazel │ └── place.proto ├── routeguide │ ├── BUILD.bazel │ ├── cc │ │ ├── BUILD.bazel │ │ ├── client.cc │ │ ├── helper.cc │ │ ├── helper.h │ │ └── server.cc │ ├── closure │ │ ├── BUILD.bazel │ │ ├── client.js │ │ ├── client_test.js │ │ └── main.js │ ├── features.json │ ├── java │ │ ├── BUILD.bazel │ │ ├── RouteGuideClient.java │ │ ├── RouteGuideServer.java │ │ └── RouteGuideUtil.java │ ├── nodejs │ │ ├── BUILD.bazel │ │ ├── client.js │ │ └── server.js │ ├── routeguide.proto │ └── scala │ │ ├── AtomicRef.scala │ │ ├── BUILD.bazel │ │ ├── RouteGuideClient.scala │ │ ├── RouteGuideServer.scala │ │ ├── RouteGuideService.scala │ │ └── RouteGuideUtil.scala ├── thing │ ├── BUILD.bazel │ └── thing.proto └── toolchain │ ├── prebuilt │ ├── BUILD.bazel │ ├── README.md │ └── prebuilt_test.go │ └── standard │ ├── BUILD.bazel │ ├── README.md │ └── standard_test.go ├── go.mod ├── go.sum ├── go_deps.bzl ├── google └── protobuf │ ├── BUILD.bazel │ └── timestamp.proto ├── language ├── example │ ├── BUILD.bazel │ └── example.go └── protobuf │ ├── BUILD.bazel │ ├── oldtestdata │ ├── gogo │ │ ├── BUILD.bazel │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── test.proto │ └── java │ │ ├── BUILD.bazel │ │ ├── BUILD.in │ │ ├── BUILD.out │ │ ├── WORKSPACE │ │ └── test.proto │ └── protobuf.go ├── maven_akka_install.json ├── maven_install.json ├── maven_scala_install.json ├── maven_zio_install.json ├── package.json ├── pkg ├── BUILD.bazel ├── goldentest │ ├── BUILD.bazel │ └── cases.go ├── language │ ├── noop │ │ ├── BUILD.bazel │ │ └── noop.go │ └── protobuf │ │ ├── BUILD.bazel │ │ ├── config.go │ │ ├── fix.go │ │ ├── generate.go │ │ ├── generate_test.go │ │ ├── kinds.go │ │ ├── lang.go │ │ ├── override.go │ │ ├── override_test.go │ │ └── resolve.go ├── plugin │ ├── akka │ │ └── akka_grpc │ │ │ ├── BUILD.bazel │ │ │ ├── protoc_gen_akka_grpc.go │ │ │ └── protoc_gen_akka_grpc_test.go │ ├── bufbuild │ │ ├── BUILD.bazel │ │ ├── connect_es_plugin.go │ │ ├── es_plugin.go │ │ └── es_plugin_test.go │ ├── builtin │ │ ├── BUILD.bazel │ │ ├── cpp_plugin.go │ │ ├── cpp_plugin_test.go │ │ ├── csharp_plugin.go │ │ ├── csharp_plugin_test.go │ │ ├── doc.go │ │ ├── grpc_grpc_cpp.go │ │ ├── java_plugin.go │ │ ├── java_plugin_test.go │ │ ├── js_closure_plugin.go │ │ ├── js_closure_plugin_test.go │ │ ├── js_common_plugin.go │ │ ├── js_common_plugin_test.go │ │ ├── objc_plugin.go │ │ ├── objc_plugin_test.go │ │ ├── php_plugin.go │ │ ├── php_plugin_test.go │ │ ├── pyi_plugin.go │ │ ├── pyi_plugin_test.go │ │ ├── python_plugin.go │ │ ├── python_plugin_test.go │ │ ├── ruby_plugin.go │ │ └── ruby_plugin_test.go │ ├── gogo │ │ └── protobuf │ │ │ ├── BUILD.bazel │ │ │ └── protoc-gen-gogo.go │ ├── golang │ │ └── protobuf │ │ │ ├── BUILD.bazel │ │ │ ├── protoc-gen-go.go │ │ │ └── protoc-gen-go_test.go │ ├── grpc │ │ ├── grpc │ │ │ ├── BUILD.bazel │ │ │ ├── grpc_test.go │ │ │ ├── protoc-gen-grpc-python.go │ │ │ └── protoc-gen-grpc-python_test.go │ │ ├── grpcgo │ │ │ ├── BUILD.bazel │ │ │ └── protoc-gen-go-grpc.go │ │ ├── grpcjava │ │ │ ├── BUILD.bazel │ │ │ └── protoc-gen-grpc-java.go │ │ ├── grpcnode │ │ │ ├── BUILD.bazel │ │ │ └── protoc-gen-grpc-node.go │ │ └── grpcweb │ │ │ ├── BUILD.bazel │ │ │ └── protoc-gen-grpc-web.go │ ├── grpcecosystem │ │ └── grpcgateway │ │ │ ├── BUILD.bazel │ │ │ ├── protoc-gen-grpc-gateway.go │ │ │ └── protoc-gen-grpc-gateway_test.go │ ├── scalapb │ │ ├── scalapb │ │ │ ├── BUILD.bazel │ │ │ ├── protoc_gen_scala.go │ │ │ └── protoc_gen_scala_test.go │ │ └── zio_grpc │ │ │ ├── BUILD.bazel │ │ │ ├── protoc_gen_zio_grpc.go │ │ │ └── protoc_gen_zio_grpc_test.go │ ├── stackb │ │ └── grpc_js │ │ │ ├── BUILD.bazel │ │ │ └── protoc-gen-grpc-js.go │ └── stephenh │ │ └── ts-proto │ │ ├── BUILD.bazel │ │ ├── protoc-gen-ts-proto.go │ │ └── protoc-gen-ts-proto_test.go ├── plugintest │ ├── BUILD.bazel │ ├── case.go │ ├── doc.go │ └── utils.go ├── protoc │ ├── BUILD.bazel │ ├── depsresolver.go │ ├── depsresolver_test.go │ ├── fake_proto_library_test.go │ ├── file.go │ ├── file_test.go │ ├── intent.go │ ├── intent_test.go │ ├── language_config.go │ ├── language_config_test.go │ ├── language_plugin_config.go │ ├── language_rule.go │ ├── language_rule_config.go │ ├── language_rule_config_test.go │ ├── other_proto_library.go │ ├── other_proto_library_test.go │ ├── package.go │ ├── package_config.go │ ├── package_config_test.go │ ├── package_test.go │ ├── plugin.go │ ├── plugin_configuration.go │ ├── plugin_context.go │ ├── plugin_registry.go │ ├── proto_compile.go │ ├── proto_compiled_sources.go │ ├── proto_descriptor_set.go │ ├── proto_library.go │ ├── proto_plugin_config_test.go │ ├── protoc_configuration.go │ ├── protoc_configuration_test.go │ ├── registry.go │ ├── resolver.go │ ├── resolver_test.go │ ├── rewrite.go │ ├── rewrite_test.go │ ├── rule_provider.go │ ├── rule_registry.go │ ├── ruleindex.go │ ├── starlark_plugin.go │ ├── starlark_plugin_test.go │ ├── starlark_rule.go │ ├── starlark_rule_test.go │ ├── starlark_util.go │ ├── starlark_util_test.go │ ├── syntaxutil.go │ └── yconfig.go └── rule │ ├── rules_cc │ ├── BUILD.bazel │ ├── cc_library.go │ ├── grpc_cc_library.go │ └── proto_cc_library.go │ ├── rules_closure │ ├── BUILD.bazel │ ├── closure_js_library.go │ ├── grpc_closure_js_library.go │ └── proto_closure_js_library.go │ ├── rules_go │ ├── BUILD.bazel │ ├── go_library.go │ └── go_library_test.go │ ├── rules_java │ ├── BUILD.bazel │ ├── grpc_java_library.go │ ├── java_library.go │ └── proto_java_library.go │ ├── rules_nodejs │ ├── BUILD.bazel │ ├── grpc_nodejs_library.go │ ├── grpc_web_js_library.go │ ├── js_library.go │ ├── proto_nodejs_library.go │ └── proto_ts_library.go │ ├── rules_python │ ├── BUILD.bazel │ ├── grpc_py_library.go │ ├── proto_py_library.go │ ├── proto_py_library_test.go │ ├── py_library.go │ └── py_library_test.go │ └── rules_scala │ ├── BUILD.bazel │ ├── README.md │ ├── scala_library.go │ ├── scala_library_test.go │ └── scala_proto_library.go ├── plugin ├── BUILD.bazel ├── akka │ └── akka-grpc │ │ └── BUILD.bazel ├── bufbuild │ ├── BUILD.bazel │ └── package.json ├── builtin │ └── BUILD.bazel ├── gogo │ └── protobuf │ │ ├── BUILD.bazel │ │ └── variants.bzl ├── golang │ └── protobuf │ │ └── BUILD.bazel ├── grpc-ecosystem │ └── grpc-gateway │ │ └── BUILD.bazel ├── grpc │ ├── grpc-go │ │ └── BUILD.bazel │ ├── grpc-java │ │ └── BUILD.bazel │ ├── grpc-node │ │ └── BUILD.bazel │ ├── grpc-web │ │ └── BUILD.bazel │ └── grpc │ │ └── BUILD.bazel ├── scalapb │ ├── scalapb │ │ └── BUILD.bazel │ └── zio-grpc │ │ └── BUILD.bazel ├── stackb │ └── grpc_js │ │ └── BUILD.bazel └── stephenh │ └── ts-proto │ ├── BUILD.bazel │ └── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── proto_repositories.bzl ├── rules ├── BUILD.bazel ├── cc │ ├── BUILD.bazel │ ├── grpc_cc_library.bzl │ └── proto_cc_library.bzl ├── closure │ ├── BUILD.bazel │ ├── grpc_closure_js_library.bzl │ └── proto_closure_js_library.bzl ├── depsgen.bzl ├── example.bzl ├── go │ ├── BUILD.bazel │ └── proto_go_library.bzl ├── golden_filegroup.bzl ├── java │ ├── BUILD.bazel │ ├── grpc_java_library.bzl │ └── proto_java_library.bzl ├── nodejs │ ├── BUILD.bazel │ ├── grpc_nodejs_library.bzl │ ├── grpc_web_js_library.bzl │ └── proto_nodejs_library.bzl ├── private │ ├── BUILD.bazel │ ├── execution.bzl │ ├── list_repository_tools_srcs.go │ ├── proto_repository_tools.bzl │ └── proto_repository_tools_srcs.bzl ├── proto │ ├── BUILD.bazel │ └── proto_repository.bzl ├── proto_compile.bzl ├── proto_compile_assets.bzl ├── proto_compile_gencopy.bzl ├── proto_compiled_source_update.bzl ├── proto_compiled_sources.bzl ├── proto_dependency.bzl ├── proto_descriptor_set.bzl ├── proto_gazelle.bzl ├── proto_plugin.bzl ├── proto_repository_info.bzl ├── protogenrule.bzl ├── providers.bzl ├── py │ ├── BUILD.bazel │ ├── grpc_py_library.bzl │ └── proto_py_library.bzl ├── scala │ ├── BUILD.bazel │ ├── grpc_scala_library.bzl │ ├── grpc_zio_scala_library.bzl │ ├── proto_scala_library.bzl │ └── scala_proto_library.bzl └── ts │ ├── BUILD.bazel │ └── proto_ts_library.bzl ├── rules_proto_config.yaml ├── third_party ├── BUILD.bazel ├── bazel-gazelle-revert-1152.patch └── zlib.BUILD ├── toolchain ├── BUILD.bazel ├── scala │ └── BUILD.bazel └── toolchain.bzl └── vendor ├── github.com ├── bazelbuild │ ├── bazel-gazelle │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── config │ │ │ ├── config.go │ │ │ └── constants.go │ │ ├── flag │ │ │ └── flag.go │ │ ├── internal │ │ │ ├── module │ │ │ │ └── module.go │ │ │ ├── version │ │ │ │ └── version.go │ │ │ └── wspace │ │ │ │ └── finder.go │ │ ├── label │ │ │ └── label.go │ │ ├── language │ │ │ ├── base.go │ │ │ ├── go │ │ │ │ ├── build_constraints.go │ │ │ │ ├── config.go │ │ │ │ ├── constants.go │ │ │ │ ├── def.bzl │ │ │ │ ├── embed.go │ │ │ │ ├── fileinfo.go │ │ │ │ ├── fix.go │ │ │ │ ├── generate.go │ │ │ │ ├── kinds.go │ │ │ │ ├── lang.go │ │ │ │ ├── modules.go │ │ │ │ ├── package.go │ │ │ │ ├── resolve.go │ │ │ │ ├── std_package_list.go │ │ │ │ ├── stdlib_links.go │ │ │ │ ├── update.go │ │ │ │ ├── utils.go │ │ │ │ └── work.go │ │ │ ├── lang.go │ │ │ ├── lifecycle.go │ │ │ ├── proto │ │ │ │ ├── config.go │ │ │ │ ├── constants.go │ │ │ │ ├── fileinfo.go │ │ │ │ ├── fix.go │ │ │ │ ├── generate.go │ │ │ │ ├── kinds.go │ │ │ │ ├── known_go_imports.go │ │ │ │ ├── known_imports.go │ │ │ │ ├── known_proto_imports.go │ │ │ │ ├── lang.go │ │ │ │ ├── package.go │ │ │ │ ├── proto.csv │ │ │ │ └── resolve.go │ │ │ └── update.go │ │ ├── merger │ │ │ ├── fix.go │ │ │ └── merger.go │ │ ├── pathtools │ │ │ └── path.go │ │ ├── repo │ │ │ ├── remote.go │ │ │ └── repo.go │ │ ├── resolve │ │ │ ├── config.go │ │ │ └── index.go │ │ ├── rule │ │ │ ├── directives.go │ │ │ ├── expr.go │ │ │ ├── merge.go │ │ │ ├── platform.go │ │ │ ├── platform_strings.go │ │ │ ├── rule.go │ │ │ ├── sort_labels.go │ │ │ ├── types.go │ │ │ └── value.go │ │ ├── testtools │ │ │ ├── config.go │ │ │ └── files.go │ │ └── walk │ │ │ ├── config.go │ │ │ └── walk.go │ ├── buildtools │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── build │ │ │ ├── build_defs.bzl │ │ │ ├── lex.go │ │ │ ├── parse.y │ │ │ ├── parse.y.go │ │ │ ├── print.go │ │ │ ├── quote.go │ │ │ ├── rewrite.go │ │ │ ├── rule.go │ │ │ ├── syntax.go │ │ │ ├── utils.go │ │ │ └── walk.go │ │ └── tables │ │ │ ├── jsonparser.go │ │ │ └── tables.go │ └── rules_go │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE.txt │ │ └── go │ │ └── tools │ │ ├── bazel │ │ ├── bazel.go │ │ ├── empty.txt │ │ └── runfiles.go │ │ ├── bazel_testing │ │ ├── bazel_testing.go │ │ └── def.bzl │ │ └── internal │ │ └── txtar │ │ └── archive.go ├── bmatcuk │ └── doublestar │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doublestar.go │ │ └── v4 │ │ ├── .codecov.yml │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── UPGRADING.md │ │ ├── doublestar.go │ │ ├── glob.go │ │ ├── globoptions.go │ │ ├── globwalk.go │ │ ├── match.go │ │ ├── utils.go │ │ └── validate.go ├── davecgh │ └── go-spew │ │ ├── LICENSE │ │ └── spew │ │ ├── bypass.go │ │ ├── bypasssafe.go │ │ ├── common.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── dump.go │ │ ├── format.go │ │ └── spew.go ├── emicklei │ └── proto │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGES.md │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── comment.go │ │ ├── enum.go │ │ ├── extensions.go │ │ ├── field.go │ │ ├── group.go │ │ ├── import.go │ │ ├── message.go │ │ ├── noop_visitor.go │ │ ├── oneof.go │ │ ├── option.go │ │ ├── package.go │ │ ├── parent_accessor.go │ │ ├── parser.go │ │ ├── proto.go │ │ ├── range.go │ │ ├── reserved.go │ │ ├── service.go │ │ ├── syntax.go │ │ ├── token.go │ │ ├── visitor.go │ │ └── walk.go ├── google │ └── go-cmp │ │ ├── LICENSE │ │ └── cmp │ │ ├── cmpopts │ │ ├── equate.go │ │ ├── ignore.go │ │ ├── sort.go │ │ ├── struct_filter.go │ │ └── xform.go │ │ ├── compare.go │ │ ├── export.go │ │ ├── internal │ │ ├── diff │ │ │ ├── debug_disable.go │ │ │ ├── debug_enable.go │ │ │ └── diff.go │ │ ├── flags │ │ │ └── flags.go │ │ ├── function │ │ │ └── func.go │ │ └── value │ │ │ ├── name.go │ │ │ ├── pointer.go │ │ │ └── sort.go │ │ ├── options.go │ │ ├── path.go │ │ ├── report.go │ │ ├── report_compare.go │ │ ├── report_references.go │ │ ├── report_reflect.go │ │ ├── report_slices.go │ │ ├── report_text.go │ │ └── report_value.go ├── pmezard │ └── go-difflib │ │ ├── LICENSE │ │ └── difflib │ │ └── difflib.go └── stretchr │ └── testify │ ├── LICENSE │ └── assert │ ├── assertion_compare.go │ ├── assertion_compare_can_convert.go │ ├── assertion_compare_legacy.go │ ├── assertion_format.go │ ├── assertion_format.go.tmpl │ ├── assertion_forward.go │ ├── assertion_forward.go.tmpl │ ├── assertion_order.go │ ├── assertions.go │ ├── doc.go │ ├── errors.go │ ├── forward_assertions.go │ └── http_assertions.go ├── go.starlark.net ├── LICENSE ├── internal │ ├── compile │ │ ├── compile.go │ │ └── serial.go │ └── spell │ │ └── spell.go ├── resolve │ ├── binding.go │ └── resolve.go ├── starlark │ ├── debug.go │ ├── empty.s │ ├── eval.go │ ├── hashtable.go │ ├── int.go │ ├── int_generic.go │ ├── int_posix64.go │ ├── interp.go │ ├── library.go │ ├── profile.go │ ├── unpack.go │ └── value.go ├── starlarkstruct │ ├── module.go │ └── struct.go └── syntax │ ├── grammar.txt │ ├── options.go │ ├── parse.go │ ├── quote.go │ ├── scan.go │ ├── syntax.go │ └── walk.go ├── golang.org └── x │ ├── mod │ ├── LICENSE │ ├── PATENTS │ ├── internal │ │ └── lazyregexp │ │ │ └── lazyre.go │ ├── modfile │ │ ├── print.go │ │ ├── read.go │ │ ├── rule.go │ │ └── work.go │ ├── module │ │ ├── module.go │ │ └── pseudo.go │ └── semver │ │ └── semver.go │ ├── sync │ ├── LICENSE │ ├── PATENTS │ └── errgroup │ │ ├── errgroup.go │ │ ├── go120.go │ │ └── pre_go120.go │ ├── sys │ ├── LICENSE │ ├── PATENTS │ ├── execabs │ │ ├── execabs.go │ │ ├── execabs_go118.go │ │ └── execabs_go119.go │ └── unix │ │ ├── .gitignore │ │ ├── README.md │ │ ├── affinity_linux.go │ │ ├── aliases.go │ │ ├── asm_aix_ppc64.s │ │ ├── asm_bsd_386.s │ │ ├── asm_bsd_amd64.s │ │ ├── asm_bsd_arm.s │ │ ├── asm_bsd_arm64.s │ │ ├── asm_bsd_ppc64.s │ │ ├── asm_bsd_riscv64.s │ │ ├── asm_linux_386.s │ │ ├── asm_linux_amd64.s │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_arm64.s │ │ ├── asm_linux_loong64.s │ │ ├── asm_linux_mips64x.s │ │ ├── asm_linux_mipsx.s │ │ ├── asm_linux_ppc64x.s │ │ ├── asm_linux_riscv64.s │ │ ├── asm_linux_s390x.s │ │ ├── asm_openbsd_mips64.s │ │ ├── asm_solaris_amd64.s │ │ ├── asm_zos_s390x.s │ │ ├── bluetooth_linux.go │ │ ├── cap_freebsd.go │ │ ├── constants.go │ │ ├── dev_aix_ppc.go │ │ ├── dev_aix_ppc64.go │ │ ├── dev_darwin.go │ │ ├── dev_dragonfly.go │ │ ├── dev_freebsd.go │ │ ├── dev_linux.go │ │ ├── dev_netbsd.go │ │ ├── dev_openbsd.go │ │ ├── dev_zos.go │ │ ├── dirent.go │ │ ├── endian_big.go │ │ ├── endian_little.go │ │ ├── env_unix.go │ │ ├── epoll_zos.go │ │ ├── fcntl.go │ │ ├── fcntl_darwin.go │ │ ├── fcntl_linux_32bit.go │ │ ├── fdset.go │ │ ├── fstatfs_zos.go │ │ ├── gccgo.go │ │ ├── gccgo_c.c │ │ ├── gccgo_linux_amd64.go │ │ ├── ifreq_linux.go │ │ ├── ioctl_linux.go │ │ ├── ioctl_signed.go │ │ ├── ioctl_unsigned.go │ │ ├── ioctl_zos.go │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── mmap_nomremap.go │ │ ├── mremap.go │ │ ├── pagesize_unix.go │ │ ├── pledge_openbsd.go │ │ ├── ptrace_darwin.go │ │ ├── ptrace_ios.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── readdirent_getdents.go │ │ ├── readdirent_getdirentries.go │ │ ├── sockcmsg_dragonfly.go │ │ ├── sockcmsg_linux.go │ │ ├── sockcmsg_unix.go │ │ ├── sockcmsg_unix_other.go │ │ ├── syscall.go │ │ ├── syscall_aix.go │ │ ├── syscall_aix_ppc.go │ │ ├── syscall_aix_ppc64.go │ │ ├── syscall_bsd.go │ │ ├── syscall_darwin.go │ │ ├── syscall_darwin_amd64.go │ │ ├── syscall_darwin_arm64.go │ │ ├── syscall_darwin_libSystem.go │ │ ├── syscall_dragonfly.go │ │ ├── syscall_dragonfly_amd64.go │ │ ├── syscall_freebsd.go │ │ ├── syscall_freebsd_386.go │ │ ├── syscall_freebsd_amd64.go │ │ ├── syscall_freebsd_arm.go │ │ ├── syscall_freebsd_arm64.go │ │ ├── syscall_freebsd_riscv64.go │ │ ├── syscall_hurd.go │ │ ├── syscall_hurd_386.go │ │ ├── syscall_illumos.go │ │ ├── syscall_linux.go │ │ ├── syscall_linux_386.go │ │ ├── syscall_linux_alarm.go │ │ ├── syscall_linux_amd64.go │ │ ├── syscall_linux_amd64_gc.go │ │ ├── syscall_linux_arm.go │ │ ├── syscall_linux_arm64.go │ │ ├── syscall_linux_gc.go │ │ ├── syscall_linux_gc_386.go │ │ ├── syscall_linux_gc_arm.go │ │ ├── syscall_linux_gccgo_386.go │ │ ├── syscall_linux_gccgo_arm.go │ │ ├── syscall_linux_loong64.go │ │ ├── syscall_linux_mips64x.go │ │ ├── syscall_linux_mipsx.go │ │ ├── syscall_linux_ppc.go │ │ ├── syscall_linux_ppc64x.go │ │ ├── syscall_linux_riscv64.go │ │ ├── syscall_linux_s390x.go │ │ ├── syscall_linux_sparc64.go │ │ ├── syscall_netbsd.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_netbsd_arm64.go │ │ ├── syscall_openbsd.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_openbsd_arm.go │ │ ├── syscall_openbsd_arm64.go │ │ ├── syscall_openbsd_libc.go │ │ ├── syscall_openbsd_mips64.go │ │ ├── syscall_openbsd_ppc64.go │ │ ├── syscall_openbsd_riscv64.go │ │ ├── syscall_solaris.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix.go │ │ ├── syscall_unix_gc.go │ │ ├── syscall_unix_gc_ppc64x.go │ │ ├── syscall_zos_s390x.go │ │ ├── sysvshm_linux.go │ │ ├── sysvshm_unix.go │ │ ├── sysvshm_unix_other.go │ │ ├── timestruct.go │ │ ├── unveil_openbsd.go │ │ ├── xattr_bsd.go │ │ ├── zerrors_aix_ppc.go │ │ ├── zerrors_aix_ppc64.go │ │ ├── zerrors_darwin_amd64.go │ │ ├── zerrors_darwin_arm64.go │ │ ├── zerrors_dragonfly_amd64.go │ │ ├── zerrors_freebsd_386.go │ │ ├── zerrors_freebsd_amd64.go │ │ ├── zerrors_freebsd_arm.go │ │ ├── zerrors_freebsd_arm64.go │ │ ├── zerrors_freebsd_riscv64.go │ │ ├── zerrors_linux.go │ │ ├── zerrors_linux_386.go │ │ ├── zerrors_linux_amd64.go │ │ ├── zerrors_linux_arm.go │ │ ├── zerrors_linux_arm64.go │ │ ├── zerrors_linux_loong64.go │ │ ├── zerrors_linux_mips.go │ │ ├── zerrors_linux_mips64.go │ │ ├── zerrors_linux_mips64le.go │ │ ├── zerrors_linux_mipsle.go │ │ ├── zerrors_linux_ppc.go │ │ ├── zerrors_linux_ppc64.go │ │ ├── zerrors_linux_ppc64le.go │ │ ├── zerrors_linux_riscv64.go │ │ ├── zerrors_linux_s390x.go │ │ ├── zerrors_linux_sparc64.go │ │ ├── zerrors_netbsd_386.go │ │ ├── zerrors_netbsd_amd64.go │ │ ├── zerrors_netbsd_arm.go │ │ ├── zerrors_netbsd_arm64.go │ │ ├── zerrors_openbsd_386.go │ │ ├── zerrors_openbsd_amd64.go │ │ ├── zerrors_openbsd_arm.go │ │ ├── zerrors_openbsd_arm64.go │ │ ├── zerrors_openbsd_mips64.go │ │ ├── zerrors_openbsd_ppc64.go │ │ ├── zerrors_openbsd_riscv64.go │ │ ├── zerrors_solaris_amd64.go │ │ ├── zerrors_zos_s390x.go │ │ ├── zptrace_armnn_linux.go │ │ ├── zptrace_linux_arm64.go │ │ ├── zptrace_mipsnn_linux.go │ │ ├── zptrace_mipsnnle_linux.go │ │ ├── zptrace_x86_linux.go │ │ ├── zsyscall_aix_ppc.go │ │ ├── zsyscall_aix_ppc64.go │ │ ├── zsyscall_aix_ppc64_gc.go │ │ ├── zsyscall_aix_ppc64_gccgo.go │ │ ├── zsyscall_darwin_amd64.go │ │ ├── zsyscall_darwin_amd64.s │ │ ├── zsyscall_darwin_arm64.go │ │ ├── zsyscall_darwin_arm64.s │ │ ├── zsyscall_dragonfly_amd64.go │ │ ├── zsyscall_freebsd_386.go │ │ ├── zsyscall_freebsd_amd64.go │ │ ├── zsyscall_freebsd_arm.go │ │ ├── zsyscall_freebsd_arm64.go │ │ ├── zsyscall_freebsd_riscv64.go │ │ ├── zsyscall_illumos_amd64.go │ │ ├── zsyscall_linux.go │ │ ├── zsyscall_linux_386.go │ │ ├── zsyscall_linux_amd64.go │ │ ├── zsyscall_linux_arm.go │ │ ├── zsyscall_linux_arm64.go │ │ ├── zsyscall_linux_loong64.go │ │ ├── zsyscall_linux_mips.go │ │ ├── zsyscall_linux_mips64.go │ │ ├── zsyscall_linux_mips64le.go │ │ ├── zsyscall_linux_mipsle.go │ │ ├── zsyscall_linux_ppc.go │ │ ├── zsyscall_linux_ppc64.go │ │ ├── zsyscall_linux_ppc64le.go │ │ ├── zsyscall_linux_riscv64.go │ │ ├── zsyscall_linux_s390x.go │ │ ├── zsyscall_linux_sparc64.go │ │ ├── zsyscall_netbsd_386.go │ │ ├── zsyscall_netbsd_amd64.go │ │ ├── zsyscall_netbsd_arm.go │ │ ├── zsyscall_netbsd_arm64.go │ │ ├── zsyscall_openbsd_386.go │ │ ├── zsyscall_openbsd_386.s │ │ ├── zsyscall_openbsd_amd64.go │ │ ├── zsyscall_openbsd_amd64.s │ │ ├── zsyscall_openbsd_arm.go │ │ ├── zsyscall_openbsd_arm.s │ │ ├── zsyscall_openbsd_arm64.go │ │ ├── zsyscall_openbsd_arm64.s │ │ ├── zsyscall_openbsd_mips64.go │ │ ├── zsyscall_openbsd_mips64.s │ │ ├── zsyscall_openbsd_ppc64.go │ │ ├── zsyscall_openbsd_ppc64.s │ │ ├── zsyscall_openbsd_riscv64.go │ │ ├── zsyscall_openbsd_riscv64.s │ │ ├── zsyscall_solaris_amd64.go │ │ ├── zsyscall_zos_s390x.go │ │ ├── zsysctl_openbsd_386.go │ │ ├── zsysctl_openbsd_amd64.go │ │ ├── zsysctl_openbsd_arm.go │ │ ├── zsysctl_openbsd_arm64.go │ │ ├── zsysctl_openbsd_mips64.go │ │ ├── zsysctl_openbsd_ppc64.go │ │ ├── zsysctl_openbsd_riscv64.go │ │ ├── zsysnum_darwin_amd64.go │ │ ├── zsysnum_darwin_arm64.go │ │ ├── zsysnum_dragonfly_amd64.go │ │ ├── zsysnum_freebsd_386.go │ │ ├── zsysnum_freebsd_amd64.go │ │ ├── zsysnum_freebsd_arm.go │ │ ├── zsysnum_freebsd_arm64.go │ │ ├── zsysnum_freebsd_riscv64.go │ │ ├── zsysnum_linux_386.go │ │ ├── zsysnum_linux_amd64.go │ │ ├── zsysnum_linux_arm.go │ │ ├── zsysnum_linux_arm64.go │ │ ├── zsysnum_linux_loong64.go │ │ ├── zsysnum_linux_mips.go │ │ ├── zsysnum_linux_mips64.go │ │ ├── zsysnum_linux_mips64le.go │ │ ├── zsysnum_linux_mipsle.go │ │ ├── zsysnum_linux_ppc.go │ │ ├── zsysnum_linux_ppc64.go │ │ ├── zsysnum_linux_ppc64le.go │ │ ├── zsysnum_linux_riscv64.go │ │ ├── zsysnum_linux_s390x.go │ │ ├── zsysnum_linux_sparc64.go │ │ ├── zsysnum_netbsd_386.go │ │ ├── zsysnum_netbsd_amd64.go │ │ ├── zsysnum_netbsd_arm.go │ │ ├── zsysnum_netbsd_arm64.go │ │ ├── zsysnum_openbsd_386.go │ │ ├── zsysnum_openbsd_amd64.go │ │ ├── zsysnum_openbsd_arm.go │ │ ├── zsysnum_openbsd_arm64.go │ │ ├── zsysnum_openbsd_mips64.go │ │ ├── zsysnum_openbsd_ppc64.go │ │ ├── zsysnum_openbsd_riscv64.go │ │ ├── zsysnum_zos_s390x.go │ │ ├── ztypes_aix_ppc.go │ │ ├── ztypes_aix_ppc64.go │ │ ├── ztypes_darwin_amd64.go │ │ ├── ztypes_darwin_arm64.go │ │ ├── ztypes_dragonfly_amd64.go │ │ ├── ztypes_freebsd_386.go │ │ ├── ztypes_freebsd_amd64.go │ │ ├── ztypes_freebsd_arm.go │ │ ├── ztypes_freebsd_arm64.go │ │ ├── ztypes_freebsd_riscv64.go │ │ ├── ztypes_linux.go │ │ ├── ztypes_linux_386.go │ │ ├── ztypes_linux_amd64.go │ │ ├── ztypes_linux_arm.go │ │ ├── ztypes_linux_arm64.go │ │ ├── ztypes_linux_loong64.go │ │ ├── ztypes_linux_mips.go │ │ ├── ztypes_linux_mips64.go │ │ ├── ztypes_linux_mips64le.go │ │ ├── ztypes_linux_mipsle.go │ │ ├── ztypes_linux_ppc.go │ │ ├── ztypes_linux_ppc64.go │ │ ├── ztypes_linux_ppc64le.go │ │ ├── ztypes_linux_riscv64.go │ │ ├── ztypes_linux_s390x.go │ │ ├── ztypes_linux_sparc64.go │ │ ├── ztypes_netbsd_386.go │ │ ├── ztypes_netbsd_amd64.go │ │ ├── ztypes_netbsd_arm.go │ │ ├── ztypes_netbsd_arm64.go │ │ ├── ztypes_openbsd_386.go │ │ ├── ztypes_openbsd_amd64.go │ │ ├── ztypes_openbsd_arm.go │ │ ├── ztypes_openbsd_arm64.go │ │ ├── ztypes_openbsd_mips64.go │ │ ├── ztypes_openbsd_ppc64.go │ │ ├── ztypes_openbsd_riscv64.go │ │ ├── ztypes_solaris_amd64.go │ │ └── ztypes_zos_s390x.go │ └── tools │ └── go │ └── vcs │ ├── LICENSE │ ├── discovery.go │ ├── env.go │ ├── http.go │ └── vcs.go ├── gopkg.in └── yaml.v3 │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── modules.txt /.bazelignore: -------------------------------------------------------------------------------- 1 | docs/ 2 | node_modules 3 | plugin/bufbuild/node_modules 4 | plugin/stephenh/ts-proto/node_modules 5 | rules/ts/node_modules 6 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 6.4.0 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.bazelrc: -------------------------------------------------------------------------------- 1 | # This file contains Bazel settings to apply on CI only. 2 | # It is referenced with a --bazelrc option in the call to bazel in ci.yaml 3 | # Debug where options came from 4 | build --announce_rc 5 | # Don't rely on test logs being easily accessible from the test runner, 6 | # though it makes the log noisier. 7 | test --test_output=errors 8 | # This directory is configured in GitHub actions to be persisted between runs. 9 | build --disk_cache=$HOME/.cache/bazel 10 | build --repository_cache=$HOME/.cache/bazel-repo 11 | # Allows tests to run bazelisk-in-bazel, since this is the cache folder used 12 | test --test_env=XDG_CACHE_HOME 13 | # Keep until @io_bazel_rules_scala is upgraded 14 | build --incompatible_java_common_parameters=false 15 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | # Cut a release whenever a new tag is pushed to the repo. 2 | name: Release 3 | 4 | on: 5 | push: 6 | tags: 7 | - "v*.*.*" 8 | 9 | # Allows owner to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | jobs: 13 | test: 14 | # The type of runner that the job will run on 15 | runs-on: ubuntu-latest 16 | 17 | # Steps represent a sequence of tasks that will be executed as part of the job 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v3 21 | 22 | - name: Prepare workspace snippet 23 | run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt 24 | 25 | - name: Release 26 | uses: softprops/action-gh-release@v1 27 | with: 28 | prerelease: false 29 | # Use GH feature to populate the changelog automatically 30 | generate_release_notes: true 31 | body_path: release_notes.txt 32 | -------------------------------------------------------------------------------- /.github/workflows/workspace_snippet.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eufo pipefail 3 | 4 | # Set by GH actions, see 5 | # https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables 6 | TAG=${GITHUB_REF_NAME} 7 | PREFIX="rules_proto-${TAG:1}" 8 | SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}') 9 | 10 | cat << EOF 11 | WORKSPACE snippet: 12 | \`\`\`starlark 13 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 14 | 15 | http_archive( 16 | name = "build_stack_rules_proto", 17 | sha256 = "${SHA}", 18 | strip_prefix = "${PREFIX}", 19 | url = "https://github.com/stackb/rules_proto/archive/refs/tags/${TAG}.tar.gz", 20 | ) 21 | \`\`\` 22 | EOF 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bazel-* 2 | /.vscode 3 | __pycache__ 4 | docs/vendor 5 | node_modules 6 | vendor/**/BUILD.bazel 7 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | hoist=false 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | # 1.0.0 4 | 5 | The pre-v2 edition of rules_proto is archived on the `1.0.0` branch. Please see 6 | changelog there for previous history. -------------------------------------------------------------------------------- /cmd/depsgen/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") 2 | 3 | go_library( 4 | name = "depsgen_lib", 5 | srcs = [ 6 | "config.go", 7 | "depsgen.go", 8 | "generator.go", 9 | "template.go", 10 | ], 11 | importpath = "github.com/stackb/rules_proto/cmd/depsgen", 12 | visibility = ["//visibility:private"], 13 | ) 14 | 15 | go_binary( 16 | name = "depsgen", 17 | embed = [":depsgen_lib"], 18 | visibility = ["//visibility:public"], 19 | ) 20 | -------------------------------------------------------------------------------- /cmd/depsgen/depsgen.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | ) 7 | 8 | var config = flag.String("config_json", "", "The JSON configuration file") 9 | 10 | func main() { 11 | flag.Parse() 12 | 13 | if *config == "" { 14 | log.Fatalln("error: --config_json is required") 15 | } 16 | 17 | c, err := fromJSON(*config) 18 | if err != nil { 19 | log.Fatalf("depsgen: %v", err) 20 | } 21 | 22 | if err := generate(c); err != nil { 23 | log.Fatalf("depsgen: %v", err) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /cmd/depsgen/generator.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "text/template" 7 | ) 8 | 9 | func generate(c *Config) error { 10 | f, err := os.Create(c.Out) 11 | if err != nil { 12 | return fmt.Errorf("create %s: %v", c.Out, err) 13 | } 14 | defer f.Close() 15 | 16 | t := template.Must(template.New(c.Name + "_deps.bzl").Option("missingkey=error").Parse(depsBzl)) 17 | 18 | deps := collectDeps(c.Deps) 19 | loads := collectLoads(deps) 20 | data := &templateData{ 21 | Name: c.Name, 22 | Deps: deps, 23 | Loads: loads, 24 | } 25 | 26 | if err := t.Execute(f, data); err != nil { 27 | return fmt.Errorf("template %s: %v", c.Out, err) 28 | } 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /cmd/examplegen/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") 2 | 3 | go_library( 4 | name = "examplegen_lib", 5 | srcs = [ 6 | "config.go", 7 | "examplegen.go", 8 | "generator.go", 9 | "linewriter.go", 10 | "template.go", 11 | ], 12 | importpath = "github.com/stackb/rules_proto/cmd/examplegen", 13 | visibility = ["//visibility:private"], 14 | ) 15 | 16 | go_binary( 17 | name = "examplegen", 18 | embed = [":examplegen_lib"], 19 | visibility = ["//visibility:public"], 20 | ) 21 | -------------------------------------------------------------------------------- /cmd/examplegen/config.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io/ioutil" 7 | ) 8 | 9 | type Config struct { 10 | Name string 11 | Label string 12 | TestOut string 13 | TestContent string 14 | MarkdownOut string 15 | WorkspaceIn string 16 | StripPrefix string 17 | Files []string 18 | } 19 | 20 | // fromJSON constructs a Config struct from the given filename that contains a 21 | // JSON. 22 | func fromJSON(filename string) (*Config, error) { 23 | data, err := ioutil.ReadFile(filename) 24 | if err != nil { 25 | return nil, fmt.Errorf("read: %w", err) 26 | } 27 | 28 | var config Config 29 | if err := json.Unmarshal(data, &config); err != nil { 30 | return nil, fmt.Errorf("unmarshal: %w", err) 31 | } 32 | 33 | return &config, nil 34 | } 35 | -------------------------------------------------------------------------------- /cmd/examplegen/examplegen.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | ) 7 | 8 | var config = flag.String("config_json", "", "The JSON configuration file") 9 | 10 | func main() { 11 | flag.Parse() 12 | 13 | if *config == "" { 14 | log.Fatalln("error: --config_json is required") 15 | } 16 | 17 | c, err := fromJSON(*config) 18 | if err != nil { 19 | log.Fatalf("examplegen: %v", err) 20 | } 21 | 22 | if err := generateTest(c); err != nil { 23 | log.Fatalf("examplegen test: %v", err) 24 | } 25 | 26 | if err := generateMarkdown(c); err != nil { 27 | log.Fatalf("examplegen markdown: %v", err) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cmd/examplegen/template.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var testHeader = ` 4 | package main 5 | 6 | import ( 7 | "testing" 8 | "os" 9 | 10 | "github.com/bazelbuild/rules_go/go/tools/bazel_testing" 11 | "github.com/google/go-cmp/cmp" 12 | ) 13 | 14 | var ( 15 | // allow use of os package in other tests 16 | _os_Remove = os.Remove 17 | // allow use of cmp package in other tests 18 | _cmp_Diff = cmp.Diff 19 | ) 20 | 21 | func TestMain(m *testing.M) { 22 | bazel_testing.TestMain(m, bazel_testing.Args{ 23 | Main: txtar, 24 | }) 25 | } 26 | ` 27 | -------------------------------------------------------------------------------- /cmd/gazelle/internal/module/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "module", 5 | srcs = ["module.go"], 6 | importpath = "github.com/stackb/rules_proto/cmd/gazelle/internal/module", 7 | visibility = ["//:__subpackages__"], 8 | deps = ["@com_github_bazelbuild_buildtools//build:go_default_library"], 9 | ) 10 | 11 | filegroup( 12 | name = "all_files", 13 | testonly = True, 14 | srcs = [ 15 | "BUILD.bazel", 16 | "module.go", 17 | ], 18 | visibility = ["//visibility:public"], 19 | ) 20 | -------------------------------------------------------------------------------- /cmd/gazelle/internal/wspace/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "wspace", 5 | srcs = ["finder.go"], 6 | importpath = "github.com/stackb/rules_proto/cmd/gazelle/internal/wspace", 7 | visibility = ["//visibility:public"], 8 | ) 9 | 10 | go_test( 11 | name = "wspace_test", 12 | size = "small", 13 | srcs = ["finder_test.go"], 14 | embed = [":wspace"], 15 | ) 16 | 17 | filegroup( 18 | name = "all_files", 19 | testonly = True, 20 | srcs = [ 21 | "BUILD.bazel", 22 | "finder.go", 23 | "finder_test.go", 24 | ], 25 | visibility = ["//visibility:public"], 26 | ) 27 | -------------------------------------------------------------------------------- /cmd/gazelle/langs.go: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The Bazel Authors. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package main 17 | 18 | import ( 19 | "github.com/bazelbuild/bazel-gazelle/language" 20 | golang "github.com/bazelbuild/bazel-gazelle/language/go" 21 | "github.com/bazelbuild/bazel-gazelle/language/proto" 22 | "github.com/stackb/rules_proto/language/protobuf" 23 | ) 24 | 25 | var languages = []language.Language{ 26 | proto.NewLanguage(), 27 | protobuf.NewLanguage(), 28 | golang.NewLanguage(), 29 | } 30 | -------------------------------------------------------------------------------- /cmd/gazelle/print.go: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 The Bazel Authors. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "os" 21 | 22 | "github.com/bazelbuild/bazel-gazelle/config" 23 | "github.com/bazelbuild/bazel-gazelle/rule" 24 | ) 25 | 26 | func printFile(c *config.Config, f *rule.File) error { 27 | fmt.Printf(">>> %s\n", f.Path) 28 | content := f.Format() 29 | _, err := os.Stdout.Write(content) 30 | return err 31 | } 32 | -------------------------------------------------------------------------------- /deps/grpc_js_deps.bzl: -------------------------------------------------------------------------------- 1 | """ 2 | GENERATED FILE - DO NOT EDIT (created via @build_stack_rules_proto//cmd/depsgen) 3 | """ 4 | 5 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 6 | 7 | def _maybe(repo_rule, name, **kwargs): 8 | if name not in native.existing_rules(): 9 | repo_rule(name = name, **kwargs) 10 | 11 | def grpc_js_deps(): 12 | """grpc_js dependency macro 13 | """ 14 | com_github_stackb_grpc_js() # via 15 | 16 | def com_github_stackb_grpc_js(): 17 | _maybe( 18 | http_archive, 19 | name = "com_github_stackb_grpc_js", 20 | sha256 = "33042aa893625ec5bf6d59bf38b3954e5558b7e549b1cb2eeee66cd2ccf8ab29", 21 | strip_prefix = "grpc.js-c938ee76ee462abf4f83d758f63d52f03fa24c7c", 22 | urls = [ 23 | "https://github.com/stackb/grpc.js/archive/c938ee76ee462abf4f83d758f63d52f03fa24c7c.tar.gz", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /deps/js_core_deps.bzl: -------------------------------------------------------------------------------- 1 | """ 2 | GENERATED FILE - DO NOT EDIT (created via @build_stack_rules_proto//cmd/depsgen) 3 | """ 4 | 5 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 6 | 7 | def _maybe(repo_rule, name, **kwargs): 8 | if name not in native.existing_rules(): 9 | repo_rule(name = name, **kwargs) 10 | 11 | def js_core_deps(): 12 | """js_core dependency macro 13 | """ 14 | com_google_protobuf_javascript() # via 15 | 16 | def com_google_protobuf_javascript(): 17 | _maybe( 18 | http_archive, 19 | name = "com_google_protobuf_javascript", 20 | sha256 = "06fc35c7d35c48bdc99a6ab72211086532d1de2bc4ec28011cde607a4025ea95", 21 | strip_prefix = "protobuf-javascript-e1a52f9a897653985b0649cca17615cb1b0eb3b7", 22 | urls = [ 23 | "https://github.com/protocolbuffers/protobuf-javascript/archive/e1a52f9a897653985b0649cca17615cb1b0eb3b7.tar.gz", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /docs/.bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_PATH: "vendor/bundle" 3 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .jekyll-metadata 4 | -------------------------------------------------------------------------------- /docs/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.2 2 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | 18 | 19 |
20 |

404

21 | 22 |

Page not found :(

23 | 24 | 25 | 26 |

The requested page could not be found.

27 |
28 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | gem "github-pages", group: :jekyll_plugins 3 | 4 | # just-the-docs Jekyll theme 5 | gem "just-the-docs" 6 | 7 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 8 | gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] 9 | 10 | # Performance-booster for watching directories on Windows 11 | gem "wdm", "~> 0.1.0" if Gem.win_platform? 12 | 13 | gem "webrick", "~> 1.7" 14 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: ruby 2 | ruby: 3 | @ if [ ! $$(which ruby) ]; then \ 4 | echo "Please install ruby version 2.5.0 or higher"; \ 5 | fi 6 | 7 | .PHONY: bundle 8 | bundle: ruby 9 | @ if [ ! $$(which bundle) ]; then \ 10 | echo "Please install bundle: `gem install bundler`"; \ 11 | fi 12 | 13 | vendor/bundle: bundle 14 | bundle config set --local path 'vendor/bundle' 15 | bundle install 16 | 17 | .PHONY: serve 18 | serve: vendor/bundle 19 | bundle exec jekyll serve 20 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Docs 2 | 3 | This folder contains our Jekyll based docs site which is hosted at 4 | https://stackb.github.io/rules_proto. 5 | 6 | When making changes to this docs site, please test your changes locally: 7 | 8 | ```bash 9 | docs$ make serve 10 | ``` 11 | 12 | To run the docs site locally you will need Ruby at version 2.5.0 or higher and 13 | `bundle` (`gem install bundler` if you already have Ruby). 14 | -------------------------------------------------------------------------------- /docs/assets/images/protobuf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/docs/assets/images/protobuf.png -------------------------------------------------------------------------------- /docs/assets/js/custom.js: -------------------------------------------------------------------------------- 1 | alert('Hello, JTD!'); -------------------------------------------------------------------------------- /docs/assets/js/search-data.json: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | { 4 | {% for page in site.html_pages %}"{{ forloop.index0 }}": { 5 | "id": "{{ forloop.index0 }}", 6 | "title": "{{ page.title | xml_escape }}", 7 | "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\', ' ' }}", 8 | "url": "{{ page.url | absolute_url | xml_escape }}", 9 | "relUrl": "{{ page.url | xml_escape }}" 10 | }{% if forloop.last %}{% else %}, 11 | {% endif %}{% endfor %} 12 | } 13 | -------------------------------------------------------------------------------- /docs/examples.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Examples 4 | permalink: examples 5 | has_children: true 6 | nav_order: 5 7 | --- 8 | 9 | See [examples/golden/testdata](examples/golden/testdata) for a complete list of example test cases. 10 | 11 | Each one is tested as both a golden file test (`BUILD.in`, `BUILD.out`) as well 12 | as a 13 | [go_bazel_test](https://github.com/bazelbuild/rules_go/blob/4cd45a2ac59bd00ba54d23ebbdb7e5e2aed69007/go/tools/bazel_testing/def.bzl#L17) 14 | to ensure the configuration is functional. -------------------------------------------------------------------------------- /docs/goembed.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: goembed 4 | permalink: examples/goembed 5 | parent: Examples 6 | --- 7 | 8 | 9 | # goembed example 10 | 11 | `bazel test //example/golden:goembed_test` 12 | 13 | 14 | ## `BUILD.bazel` (after gazelle) 15 | 16 | ~~~python 17 | ~~~ 18 | 19 | 20 | ## `BUILD.bazel` (before gazelle) 21 | 22 | ~~~python 23 | ~~~ 24 | 25 | 26 | ## `WORKSPACE` 27 | 28 | ~~~python 29 | ~~~ 30 | 31 | -------------------------------------------------------------------------------- /docs/guides.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Guides 4 | permalink: guides 5 | has_children: true 6 | nav_order: 1 7 | --- 8 | 9 | Please use the following guides to get started: 10 | -------------------------------------------------------------------------------- /docs/logos/stack-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/docs/logos/stack-build.png -------------------------------------------------------------------------------- /docs/logos/stackb-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/docs/logos/stackb-full.png -------------------------------------------------------------------------------- /docs/php.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/docs/php.md -------------------------------------------------------------------------------- /example/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # gazelle:proto_language closure_js enable true 2 | # gazelle:proto_language cpp enable true 3 | # gazelle:proto_language go enable true 4 | # gazelle:proto_language java enable true 5 | # gazelle:proto_language node_js enable true 6 | # gazelle:proto_language python enable true 7 | # gazelle:proto_language scala enable true 8 | # gazelle:proto_language ts_proto enable true 9 | -------------------------------------------------------------------------------- /example/golden/builtin.WORKSPACE: -------------------------------------------------------------------------------- 1 | local_repository( 2 | name = "build_stack_rules_proto", 3 | path = "../build_stack_rules_proto", 4 | ) 5 | 6 | register_toolchains("@build_stack_rules_proto//toolchain:standard") 7 | 8 | # == Externals == 9 | 10 | load("@build_stack_rules_proto//deps:core_deps.bzl", "core_deps") 11 | 12 | core_deps() 13 | 14 | # == Go == 15 | 16 | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") 17 | 18 | go_rules_dependencies() 19 | 20 | go_register_toolchains(version = "1.18.2") 21 | 22 | # == Gazelle == 23 | 24 | load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") 25 | 26 | gazelle_dependencies() 27 | 28 | # == Protobuf == 29 | 30 | load("@build_stack_rules_proto//deps:protobuf_core_deps.bzl", "protobuf_core_deps") 31 | 32 | protobuf_core_deps() 33 | 34 | # == Python == 35 | 36 | load("@rules_python//python:repositories.bzl", "py_repositories") 37 | 38 | py_repositories() 39 | -------------------------------------------------------------------------------- /example/golden/golden_test.go: -------------------------------------------------------------------------------- 1 | package golden 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stackb/rules_proto/pkg/goldentest" 7 | ) 8 | 9 | func TestGoldens(t *testing.T) { 10 | goldentest. 11 | FromDir("example/golden"). 12 | Run(t, "gazelle") 13 | } 14 | -------------------------------------------------------------------------------- /example/golden/testdata/builtins/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 2 | # gazelle:proto_plugin cpp implementation builtin:cpp 3 | # gazelle:proto_plugin java implementation builtin:java 4 | # gazelle:proto_plugin closurejs implementation builtin:js:closure 5 | # gazelle:proto_plugin commonjs implementation builtin:js:common 6 | # gazelle:proto_plugin python implementation builtin:python 7 | # gazelle:proto_plugin pyi implementation builtin:pyi 8 | # gazelle:proto_plugin ruby implementation builtin:ruby 9 | # gazelle:proto_plugin objc implementation builtin:objc 10 | # gazelle:proto_language builtins rule proto_compile 11 | # gazelle:proto_language builtins plugin cpp 12 | # gazelle:proto_language builtins plugin java 13 | # gazelle:proto_language builtins plugin closurejs 14 | # gazelle:proto_language builtins plugin commonjs 15 | # gazelle:proto_language builtins plugin python 16 | # gazelle:proto_language builtins plugin pyi 17 | # gazelle:proto_language builtins plugin ruby 18 | # gazelle:proto_language builtins plugin objc 19 | -------------------------------------------------------------------------------- /example/golden/testdata/builtins/README.md: -------------------------------------------------------------------------------- 1 | # builtins 2 | 3 | This test demonstrates the behavior of the plugins built into protoc. The 4 | configuration aggregates all the plugins into a single language "builtins" with 5 | a single proto_compile rule. 6 | 7 | The predicted outputs for a simple proto_library are demonstrated. -------------------------------------------------------------------------------- /example/golden/testdata/builtins/WORKSPACE: -------------------------------------------------------------------------------- 1 | local_repository( 2 | name = "build_stack_rules_proto", 3 | path = "../build_stack_rules_proto", 4 | ) 5 | 6 | register_toolchains("@build_stack_rules_proto//toolchain:standard") 7 | 8 | # == Externals == 9 | 10 | load("@build_stack_rules_proto//deps:core_deps.bzl", "core_deps") 11 | 12 | core_deps() 13 | 14 | # == Go == 15 | 16 | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") 17 | 18 | go_rules_dependencies() 19 | 20 | go_register_toolchains(version = "1.18.2") 21 | 22 | # == Gazelle == 23 | 24 | load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") 25 | 26 | gazelle_dependencies() 27 | 28 | # == Protobuf == 29 | 30 | load("@build_stack_rules_proto//deps:protobuf_core_deps.bzl", "protobuf_core_deps") 31 | 32 | protobuf_core_deps() 33 | -------------------------------------------------------------------------------- /example/golden/testdata/builtins/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message BoolValue { 4 | bool value = 1; 5 | } 6 | 7 | enum PayloadType { 8 | COMPRESSABLE = 0; 9 | } 10 | 11 | message Payload { 12 | PayloadType type = 1; 13 | bytes body = 2; 14 | } 15 | 16 | message EchoStatus { 17 | int32 code = 1; 18 | string message = 2; 19 | } 20 | -------------------------------------------------------------------------------- /example/golden/testdata/closurejs/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/closurejs/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin closurejs plugin 5 | # gazelle:proto_plugin closurejs implementation builtin:js:closure 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language closurejs rule proto_compile 9 | # gazelle:proto_language closurejs plugin closurejs 10 | -------------------------------------------------------------------------------- /example/golden/testdata/closurejs/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/closurejs/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/closurejs/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/commonjs/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/commonjs/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin commonjs plugin 5 | # gazelle:proto_plugin commonjs implementation builtin:js:common 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language commonjs rule proto_compile 9 | # gazelle:proto_language commonjs plugin commonjs 10 | -------------------------------------------------------------------------------- /example/golden/testdata/commonjs/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/commonjs/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/commonjs/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/cpp/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | -------------------------------------------------------------------------------- /example/golden/testdata/cpp/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin cpp plugin 5 | # gazelle:proto_plugin cpp implementation builtin:cpp 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language cpp rule proto_compile 9 | # gazelle:proto_language cpp plugin cpp 10 | -------------------------------------------------------------------------------- /example/golden/testdata/cpp/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # "proto_rule" instantiates the proto_compile rule 5 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 6 | 7 | # "proto_plugin" instantiates the builtin cpp plugin 8 | # gazelle:proto_plugin cpp implementation builtin:cpp 9 | 10 | # "proto_language" binds the rule(s) and plugin(s) together 11 | # gazelle:proto_language cpp rule proto_compile 12 | # gazelle:proto_language cpp plugin cpp 13 | 14 | proto_library( 15 | name = "example_proto", 16 | srcs = ["example.proto"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | 20 | proto_compile( 21 | name = "example_cpp_compile", 22 | outputs = [ 23 | "example.pb.cc", 24 | "example.pb.h", 25 | ], 26 | plugins = ["@build_stack_rules_proto//plugin/builtin:cpp"], 27 | proto = "example_proto", 28 | ) 29 | -------------------------------------------------------------------------------- /example/golden/testdata/cpp/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/cpp/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/cpp/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/csharp/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/csharp/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin csharp plugin 5 | # gazelle:proto_plugin csharp implementation builtin:csharp 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language csharp rule proto_compile 9 | # gazelle:proto_language csharp plugin csharp 10 | -------------------------------------------------------------------------------- /example/golden/testdata/csharp/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # "proto_rule" instantiates the proto_compile rule 5 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 6 | 7 | # "proto_plugin" instantiates the builtin csharp plugin 8 | # gazelle:proto_plugin csharp implementation builtin:csharp 9 | 10 | # "proto_language" binds the rule(s) and plugin(s) together 11 | # gazelle:proto_language csharp rule proto_compile 12 | # gazelle:proto_language csharp plugin csharp 13 | 14 | proto_library( 15 | name = "example_proto", 16 | srcs = ["example.proto"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | 20 | proto_compile( 21 | name = "example_csharp_compile", 22 | outputs = ["Example.cs"], 23 | plugins = ["@build_stack_rules_proto//plugin/builtin:csharp"], 24 | proto = "example_proto", 25 | ) 26 | -------------------------------------------------------------------------------- /example/golden/testdata/csharp/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/csharp/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/csharp/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/go/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | -------------------------------------------------------------------------------- /example/golden/testdata/go/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_plugin protoc-gen-go implementation golang:protobuf:protoc-gen-go 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | # gazelle:proto_rule proto_go_library implementation stackb:rules_proto:proto_go_library 4 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//reflect/protoreflect 5 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//runtime/protoimpl 6 | # gazelle:proto_rule proto_go_library resolve google/protobuf/([a-z]+).proto @org_golang_google_protobuf//types/known/${1}pb 7 | # gazelle:proto_rule proto_go_library visibility //visibility:public 8 | # gazelle:proto_language go plugin protoc-gen-go 9 | # gazelle:proto_language go rule proto_compile 10 | # gazelle:proto_language go rule proto_go_library 11 | -------------------------------------------------------------------------------- /example/golden/testdata/go/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/go/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/go/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option go_package = "./;pb"; 4 | 5 | enum Enum{ 6 | UNKNOWN = 0; 7 | } 8 | 9 | message Message{} 10 | 11 | service Service{} 12 | -------------------------------------------------------------------------------- /example/golden/testdata/goembed/.bazelrc: -------------------------------------------------------------------------------- 1 | #build --bes_backend=grpc://127.0.0.1:1080 2 | #build --bes_results_url=http://127.0.0.1:8080/pipeline 3 | #build --bes_timeout=5s 4 | #build --build_event_publish_all_actions 5 | -------------------------------------------------------------------------------- /example/golden/testdata/goembed/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto file 2 | 3 | # gazelle:proto_plugin protoc-gen-go implementation golang:protobuf:protoc-gen-go 4 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 5 | # gazelle:proto_rule proto_go_library implementation stackb:rules_proto:proto_go_library 6 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//reflect/protoreflect 7 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//runtime/protoimpl 8 | # gazelle:proto_rule proto_go_library resolve google/protobuf/([a-z]+).proto @org_golang_google_protobuf//types/known/${1}pb 9 | # gazelle:proto_rule proto_go_library visibility //visibility:public 10 | # gazelle:proto_language go plugin protoc-gen-go 11 | # gazelle:proto_language go rule proto_compile 12 | # gazelle:proto_language go rule proto_go_library 13 | -------------------------------------------------------------------------------- /example/golden/testdata/goembed/BUILD.out: -------------------------------------------------------------------------------- 1 | # gazelle:proto file 2 | 3 | # gazelle:proto_plugin protoc-gen-go implementation golang:protobuf:protoc-gen-go 4 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 5 | # gazelle:proto_rule proto_go_library implementation stackb:rules_proto:proto_go_library 6 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//reflect/protoreflect 7 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//runtime/protoimpl 8 | # gazelle:proto_rule proto_go_library resolve google/protobuf/([a-z]+).proto @org_golang_google_protobuf//types/known/${1}pb 9 | # gazelle:proto_rule proto_go_library visibility //visibility:public 10 | # gazelle:proto_language go plugin protoc-gen-go 11 | # gazelle:proto_language go rule proto_compile 12 | # gazelle:proto_language go rule proto_go_library 13 | -------------------------------------------------------------------------------- /example/golden/testdata/goembed/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/bar/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/proto/bar/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/bar/body.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package proto.bar; 4 | 5 | option go_package = "github.com/example/foo"; 6 | import "google/protobuf/struct.proto"; 7 | 8 | message Body{ 9 | google.protobuf.Struct payload = 1; 10 | } 11 | -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/bar/content/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/proto/bar/content/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/bar/content/BUILD.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/proto/bar/content/BUILD.out -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/foo/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/proto/foo/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/foo/content/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/proto/foo/content/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/foo/content/BUILD.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/goembed/proto/foo/content/BUILD.out -------------------------------------------------------------------------------- /example/golden/testdata/goembed/proto/foo/foo.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package proto.foo; 4 | 5 | option go_package = "github.com/example/foo"; 6 | 7 | import "proto/bar/body.proto"; 8 | import "google/protobuf/any.proto"; 9 | 10 | enum Enum{ 11 | UNKNOWN = 0; 12 | } 13 | 14 | message Message{ 15 | string id = 1; 16 | proto.bar.Body body = 2; 17 | google.protobuf.Any any = 3; 18 | } 19 | -------------------------------------------------------------------------------- /example/golden/testdata/gogo/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/gogo/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin gogo plugin 5 | # gazelle:proto_plugin gogo implementation gogo:protobuf:protoc-gen-gogo 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language gogo rule proto_compile 9 | # gazelle:proto_language gogo plugin gogo 10 | -------------------------------------------------------------------------------- /example/golden/testdata/gogo/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/gogo/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/gogo/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto file 2 | 3 | # gazelle:proto_plugin protoc-gen-go implementation golang:protobuf:protoc-gen-go 4 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 5 | # gazelle:proto_rule proto_go_library implementation stackb:rules_proto:proto_go_library 6 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//reflect/protoreflect 7 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//runtime/protoimpl 8 | # gazelle:proto_rule proto_go_library resolve google/protobuf/([a-z]+).proto @org_golang_google_protobuf//types/known/${1}pb 9 | # gazelle:proto_rule proto_go_library visibility //visibility:public 10 | # gazelle:proto_language go plugin protoc-gen-go 11 | # gazelle:proto_language go rule proto_compile 12 | # gazelle:proto_language go rule proto_go_library 13 | -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/BUILD.out: -------------------------------------------------------------------------------- 1 | # gazelle:proto file 2 | 3 | # gazelle:proto_plugin protoc-gen-go implementation golang:protobuf:protoc-gen-go 4 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 5 | # gazelle:proto_rule proto_go_library implementation stackb:rules_proto:proto_go_library 6 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//reflect/protoreflect 7 | # gazelle:proto_rule proto_go_library deps @org_golang_google_protobuf//runtime/protoimpl 8 | # gazelle:proto_rule proto_go_library resolve google/protobuf/([a-z]+).proto @org_golang_google_protobuf//types/known/${1}pb 9 | # gazelle:proto_rule proto_go_library visibility //visibility:public 10 | # gazelle:proto_language go plugin protoc-gen-go 11 | # gazelle:proto_language go rule proto_compile 12 | # gazelle:proto_language go rule proto_go_library 13 | -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/gomerge/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/proto/foo/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/gomerge/proto/foo/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/proto/foo/body.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package proto.foo; 4 | 5 | option go_package = "github.com/example/foo"; 6 | import "google/protobuf/struct.proto"; 7 | 8 | message Body{ 9 | google.protobuf.Struct payload = 1; 10 | } 11 | -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/proto/foo/content/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/gomerge/proto/foo/content/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/proto/foo/content/BUILD.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/gomerge/proto/foo/content/BUILD.out -------------------------------------------------------------------------------- /example/golden/testdata/gomerge/proto/foo/foo.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package proto.foo; 4 | 5 | option go_package = "github.com/example/foo"; 6 | 7 | import "proto/foo/body.proto"; 8 | import "google/protobuf/any.proto"; 9 | 10 | enum Enum{ 11 | UNKNOWN = 0; 12 | } 13 | 14 | message Message{ 15 | string id = 1; 16 | proto.foo.Body body = 2; 17 | google.protobuf.Any any = 3; 18 | } 19 | -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/.gazelle.args: -------------------------------------------------------------------------------- 1 | -proto_imports_in=imports.csv -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/imports_csv/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | 3 | proto_library( 4 | name = "test_proto", 5 | srcs = ["example.proto"], 6 | visibility = ["//visibility:public"], 7 | deps = ["@protoapis//google/protobuf:any_proto"], 8 | ) 9 | -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/README.md: -------------------------------------------------------------------------------- 1 | # imports_csv 2 | 3 | This test demonstrates the `-proto_imports_in` flag. A csv file is loaded that 4 | installs resolve directives into gazelle. Typically this file would be 5 | generated inside an external repository using the `proto_repository` rule. 6 | 7 | In this case we've overridden the expected location of a well-known proto. -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/imports_csv/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "google/protobuf/any.proto"; 4 | 5 | option go_package = "github.com/example/test"; 6 | 7 | message Message{ 8 | google.protobuf.Any body = 1; 9 | } 10 | -------------------------------------------------------------------------------- /example/golden/testdata/imports_csv/imports.csv: -------------------------------------------------------------------------------- 1 | proto,proto,google/protobuf/any.proto,@protoapis//google/protobuf:any_proto -------------------------------------------------------------------------------- /example/golden/testdata/java/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin java plugin 5 | # gazelle:proto_plugin java implementation builtin:java 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language java rule proto_compile 9 | # gazelle:proto_language java plugin java 10 | -------------------------------------------------------------------------------- /example/golden/testdata/java/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # "proto_rule" instantiates the proto_compile rule 5 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 6 | 7 | # "proto_plugin" instantiates the builtin java plugin 8 | # gazelle:proto_plugin java implementation builtin:java 9 | 10 | # "proto_language" binds the rule(s) and plugin(s) together 11 | # gazelle:proto_language java rule proto_compile 12 | # gazelle:proto_language java plugin java 13 | 14 | proto_library( 15 | name = "example_proto", 16 | srcs = ["example.proto"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | 20 | proto_compile( 21 | name = "example_java_compile", 22 | outs = {"@build_stack_rules_proto//plugin/builtin:java": "example.srcjar"}, 23 | outputs = ["example.srcjar"], 24 | plugins = ["@build_stack_rules_proto//plugin/builtin:java"], 25 | proto = "example_proto", 26 | ) 27 | -------------------------------------------------------------------------------- /example/golden/testdata/java/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/java/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/java/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/mappingsmerge/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/mappingsmerge/README.md: -------------------------------------------------------------------------------- 1 | # mappingsmerge 2 | 3 | In this test we are simulating adding a new `support.proto` to an existing set of build rules. -------------------------------------------------------------------------------- /example/golden/testdata/mappingsmerge/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/mappingsmerge/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/mappingsmerge/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option go_package = "github.com/stackb/rules_proto/example/golden/mappingsmerge"; 4 | 5 | enum Enum{ 6 | UNKNOWN = 0; 7 | } 8 | 9 | message Message{} 10 | 11 | service Service{} 12 | -------------------------------------------------------------------------------- /example/golden/testdata/mappingsmerge/support.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option go_package = "github.com/stackb/rules_proto/example/golden/mappingsmerge"; 4 | 5 | message M{} 6 | 7 | service S{} 8 | -------------------------------------------------------------------------------- /example/golden/testdata/objc/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/objc/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin objc plugin 5 | # gazelle:proto_plugin objc implementation builtin:objc 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language objc rule proto_compile 9 | # gazelle:proto_language objc plugin objc 10 | -------------------------------------------------------------------------------- /example/golden/testdata/objc/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # "proto_rule" instantiates the proto_compile rule 5 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 6 | 7 | # "proto_plugin" instantiates the builtin objc plugin 8 | # gazelle:proto_plugin objc implementation builtin:objc 9 | 10 | # "proto_language" binds the rule(s) and plugin(s) together 11 | # gazelle:proto_language objc rule proto_compile 12 | # gazelle:proto_language objc plugin objc 13 | 14 | proto_library( 15 | name = "example_proto", 16 | srcs = ["example.proto"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | 20 | proto_compile( 21 | name = "example_objc_compile", 22 | outputs = [ 23 | "Example.pbobjc.h", 24 | "Example.pbobjc.m", 25 | ], 26 | plugins = ["@build_stack_rules_proto//plugin/builtin:objc"], 27 | proto = "example_proto", 28 | ) 29 | -------------------------------------------------------------------------------- /example/golden/testdata/objc/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/objc/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/objc/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/.bazelversion: -------------------------------------------------------------------------------- 1 | 6.4.0 2 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/BUILD.in: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_compile_assets.bzl", "proto_compile_assets") 2 | 3 | # gazelle:proto_plugin python implementation builtin:python 4 | # gazelle:proto_rule proto_compiled_sources implementation stackb:rules_proto:proto_compiled_sources 5 | # gazelle:proto_rule proto_compiled_sources visibility //visibility:public 6 | # gazelle:proto_language python rule proto_compiled_sources 7 | # gazelle:proto_language python plugin python 8 | 9 | proto_compile_assets( 10 | name = "assets", 11 | deps = [ 12 | "//api/v1:api_v1_python_compiled_sources", 13 | "//src/idl:svc_python_compiled_sources", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_compile_assets.bzl", "proto_compile_assets") 2 | 3 | # gazelle:proto_plugin python implementation builtin:python 4 | # gazelle:proto_rule proto_compiled_sources implementation stackb:rules_proto:proto_compiled_sources 5 | # gazelle:proto_rule proto_compiled_sources visibility //visibility:public 6 | # gazelle:proto_language python rule proto_compiled_sources 7 | # gazelle:proto_language python plugin python 8 | 9 | proto_compile_assets( 10 | name = "assets", 11 | deps = [ 12 | "//api/v1:api_v1_python_compiled_sources", 13 | "//src/idl:svc_python_compiled_sources", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/README.md: -------------------------------------------------------------------------------- 1 | # proto_compiled_sources 2 | 3 | This test case demonstrates usage of proto_compiled_sources and 4 | proto_compile_assets. 5 | 6 | The api/v1 subdirectory contains a typical proto. 7 | 8 | The src/idl subdirectory contains a proto that also uses 9 | strip_import_prefix (see 10 | [#358](https://github.com/stackb/rules_proto/issues/358)). -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/proto_compiled_sources/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/api/v1/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/proto_compiled_sources/api/v1/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/api/v1/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compiled_sources.bzl", "proto_compiled_sources") 3 | 4 | proto_library( 5 | name = "api_v1_proto", 6 | srcs = ["v1.proto"], 7 | visibility = ["//visibility:public"], 8 | ) 9 | 10 | proto_compiled_sources( 11 | name = "api_v1_python_compiled_sources", 12 | srcs = ["v1_pb2.py"], 13 | plugins = ["@build_stack_rules_proto//plugin/builtin:python"], 14 | proto = "api_v1_proto", 15 | visibility = ["//visibility:public"], 16 | ) 17 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/api/v1/v1.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package api.v1; 4 | 5 | message Data { 6 | string id = 1; 7 | } 8 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/src/idl/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_strip_import_prefix /src 2 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/src/idl/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compiled_sources.bzl", "proto_compiled_sources") 3 | 4 | # gazelle:proto_strip_import_prefix /src 5 | 6 | proto_library( 7 | name = "svc_proto", 8 | srcs = ["svc.proto"], 9 | strip_import_prefix = "/src", 10 | visibility = ["//visibility:public"], 11 | ) 12 | 13 | proto_compiled_sources( 14 | name = "svc_python_compiled_sources", 15 | srcs = ["svc_pb2.py"], 16 | output_mappings = ["svc_pb2.py=/idl/svc_pb2.py"], 17 | plugins = ["@build_stack_rules_proto//plugin/builtin:python"], 18 | proto = "svc_proto", 19 | visibility = ["//visibility:public"], 20 | ) -------------------------------------------------------------------------------- /example/golden/testdata/proto_compiled_sources/src/idl/svc.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message Request { 4 | string id = 1; 5 | } 6 | 7 | message Response { 8 | string id = 1; 9 | } 10 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_repository/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_repository/.gazelle.args: -------------------------------------------------------------------------------- 1 | -proto_configs=config.yaml 2 | -proto_imports_in=imports.csv 3 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_repository/imports.csv: -------------------------------------------------------------------------------- 1 | proto,proto,google/api/annotations.proto,@googleapis//google/api:annotations_proto 2 | proto,proto,google/api/field_behavior.proto,@googleapis//google/api:field_behavior_proto 3 | protobuf,proto_go_library,google/api/annotations.proto,@googleapis//google/api:annotations_go_proto 4 | protobuf,proto_go_library,google/api/field_behavior.proto,@googleapis//google/api:annotations_go_proto 5 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_repository/proto/foo/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/proto_repository/proto/foo/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/proto_repository/proto/foo/app.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package proto; 4 | 5 | option go_package = "github.com/example/app"; 6 | 7 | import "google/api/annotations.proto"; 8 | import "google/api/field_behavior.proto"; 9 | 10 | message Request { 11 | string id = 1 [(google.api.field_behavior) = REQUIRED]; 12 | } 13 | 14 | message Response { 15 | string id = 1 [(google.api.field_behavior) = REQUIRED]; 16 | } 17 | 18 | service Echoer { 19 | rpc Echo(Request) returns (Response) { 20 | option (google.api.http) = { 21 | post: "/v1/example/echo" 22 | body: "*" 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/golden/testdata/proto_repository/starlark/plugins.star: -------------------------------------------------------------------------------- 1 | """starlark plugin definitions""" 2 | 3 | def _configure_protoc_gen_java(ctx): 4 | """_configure_protoc_gen_java prepares the PluginConfiguration for a fictitious protoc java plugin. 5 | 6 | Args: 7 | ctx (protoc.PluginContext): The context object. 8 | Returns: 9 | config (PluginConfiguration): The configured PluginConfiguration object. 10 | """ 11 | 12 | srcjar = ctx.proto_library.base_name + ".srcjar" 13 | if ctx.rel: 14 | srcjar = "/".join([ctx.rel, srcjar]) 15 | 16 | config = protoc.PluginConfiguration( 17 | label = "@build_stack_rules_proto//plugin/builtin:java", 18 | outputs = [srcjar], 19 | out = srcjar, 20 | options = ctx.plugin_config.options, 21 | ) 22 | 23 | return config 24 | 25 | protoc.Plugin( 26 | name = "protoc-gen-java", 27 | configure = _configure_protoc_gen_java, 28 | ) 29 | -------------------------------------------------------------------------------- /example/golden/testdata/python/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/python/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin python plugin 5 | # gazelle:proto_plugin python implementation builtin:python 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language python rule proto_compile 9 | # gazelle:proto_language python plugin python 10 | -------------------------------------------------------------------------------- /example/golden/testdata/python/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # "proto_rule" instantiates the proto_compile rule 5 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 6 | 7 | # "proto_plugin" instantiates the builtin python plugin 8 | # gazelle:proto_plugin python implementation builtin:python 9 | 10 | # "proto_language" binds the rule(s) and plugin(s) together 11 | # gazelle:proto_language python rule proto_compile 12 | # gazelle:proto_language python plugin python 13 | 14 | proto_library( 15 | name = "example_proto", 16 | srcs = ["example.proto"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | 20 | proto_compile( 21 | name = "example_python_compile", 22 | outputs = ["example_pb2.py"], 23 | plugins = ["@build_stack_rules_proto//plugin/builtin:python"], 24 | proto = "example_proto", 25 | ) 26 | -------------------------------------------------------------------------------- /example/golden/testdata/python/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/python/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/python/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/ruby/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | 3 | -------------------------------------------------------------------------------- /example/golden/testdata/ruby/BUILD.in: -------------------------------------------------------------------------------- 1 | # "proto_rule" instantiates the proto_compile rule 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | 4 | # "proto_plugin" instantiates the builtin ruby plugin 5 | # gazelle:proto_plugin ruby implementation builtin:ruby 6 | 7 | # "proto_language" binds the rule(s) and plugin(s) together 8 | # gazelle:proto_language ruby rule proto_compile 9 | # gazelle:proto_language ruby plugin ruby 10 | -------------------------------------------------------------------------------- /example/golden/testdata/ruby/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # "proto_rule" instantiates the proto_compile rule 5 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 6 | 7 | # "proto_plugin" instantiates the builtin ruby plugin 8 | # gazelle:proto_plugin ruby implementation builtin:ruby 9 | 10 | # "proto_language" binds the rule(s) and plugin(s) together 11 | # gazelle:proto_language ruby rule proto_compile 12 | # gazelle:proto_language ruby plugin ruby 13 | 14 | proto_library( 15 | name = "example_proto", 16 | srcs = ["example.proto"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | 20 | proto_compile( 21 | name = "example_ruby_compile", 22 | outputs = ["example_pb.rb"], 23 | plugins = ["@build_stack_rules_proto//plugin/builtin:ruby"], 24 | proto = "example_proto", 25 | ) 26 | -------------------------------------------------------------------------------- /example/golden/testdata/ruby/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/ruby/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/ruby/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum Enum{ 4 | UNKNOWN = 0; 5 | } 6 | 7 | message Message{} 8 | 9 | service Service{} 10 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | build --incompatible_java_common_parameters=false 3 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/.gazelle.args: -------------------------------------------------------------------------------- 1 | -proto_configs=config.yaml 2 | -proto_imports_in=imports.csv 3 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/BUILD.in: -------------------------------------------------------------------------------- 1 | exports_files(["config.yaml"]) 2 | 3 | # gazelle:proto_language scala enabled true 4 | # gazelle:proto_rule proto_scala_library attr exports @com_google_protobuf//:protobuf_java 5 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/BUILD.out: -------------------------------------------------------------------------------- 1 | exports_files(["config.yaml"]) 2 | 3 | # gazelle:proto_language scala enabled true 4 | # gazelle:proto_rule proto_scala_library attr exports @com_google_protobuf//:protobuf_java 5 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/imports.csv: -------------------------------------------------------------------------------- 1 | proto,proto,scalapb/scalapb.proto,@scalaapis//scalapb:scalapb_proto 2 | protobuf,scala,scalapb/scalapb.proto,@scalaapis//scalapb:scalapb_proto_scala_library 3 | protobuf,scala,lib.WithSnapshot,//lib:scala 4 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/lib/BUILD.in: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") 2 | 3 | scala_library( 4 | name = "scala", 5 | srcs = ["WithSnapshot.scala"], 6 | visibility = ["//visibility:public"], 7 | deps = [ 8 | "//proto:proto_proto_scala_library", 9 | "@maven_scala//:com_thesamet_scalapb_lenses_2_12", 10 | "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_2_12", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/lib/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") 2 | 3 | scala_library( 4 | name = "scala", 5 | srcs = ["WithSnapshot.scala"], 6 | visibility = ["//visibility:public"], 7 | deps = [ 8 | "//proto:proto_proto_scala_library", 9 | "@maven_scala//:com_thesamet_scalapb_lenses_2_12", 10 | "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_2_12", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/lib/WithSnapshot.scala: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import proto.Complete 4 | 5 | /** 6 | * An interface intended for extending ScalaPB generated case classes, but may 7 | * be used more generically. 8 | * 9 | * @tparam Message The type used for either snapshot messages or updates. 10 | * @tparam A The class to which this interface is being added. 11 | */ 12 | trait WithSnapshot[Message, A] { 13 | def withMessage(message: Message): A 14 | 15 | def withComplete(complete: Complete): A 16 | 17 | def getMessage: Message 18 | 19 | def getComplete: Complete 20 | 21 | final def toEither(isComplete: PartialFunction[WithSnapshot[_, _], Boolean]): Either[Message, Complete] = 22 | if (isComplete.lift(this).contains(true)) { 23 | Right(getComplete) 24 | } else { 25 | Left(getMessage) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/proto/complete.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package proto; 4 | 5 | /** 6 | * Used to signify the end of the snapshot portion of a stream 7 | */ 8 | message Complete { 9 | /* The number of snapshot messages sent */ 10 | required uint32 expected_messages = 1; 11 | } 12 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/syntax/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/scala/syntax/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/scala/syntax/noun.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package syntax; 4 | 5 | import "syntax/pronoun.proto"; 6 | 7 | message Noun { 8 | repeated Pronoun pronoun = 1; 9 | } 10 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/syntax/package.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package syntax; 4 | 5 | import "scalapb/scalapb.proto"; 6 | 7 | option (scalapb.options) = { 8 | scope: PACKAGE 9 | preserve_unknown_fields: false 10 | }; 11 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/syntax/pronoun.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package syntax; 4 | 5 | import "scalapb/scalapb.proto"; 6 | import "proto/complete.proto"; 7 | 8 | option (scalapb.options) = { 9 | import: "lib.WithSnapshot" 10 | }; 11 | 12 | message Pronoun { 13 | string name = 1; 14 | } 15 | -------------------------------------------------------------------------------- /example/golden/testdata/scala/syntax/service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package syntax; 4 | 5 | import "syntax/noun.proto"; 6 | 7 | message SpellCheckRequest { 8 | Noun noun = 1; // contrived, I know 9 | } 10 | 11 | message SpellCheckResponse { 12 | Noun noun = 1; // contrived, I know 13 | } 14 | 15 | service SpellChecker { 16 | rpc SpellCheck(stream SpellCheckRequest) returns (stream SpellCheckResponse); 17 | } 18 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/.gazelle.args: -------------------------------------------------------------------------------- 1 | -proto_plugin=lib/plugins.star%java 2 | -proto_rule=lib/rules.star%java_library 3 | -proto_rule=lib/rules.star%java_wrapper 4 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 2 | # gazelle:proto_rule java_wrapper implementation lib/rules.star%java_wrapper 3 | # gazelle:proto_rule java_library implementation lib/rules.star%java_library 4 | # gazelle:proto_rule java_library deps @com_google_protobuf//:protobuf_java 5 | # gazelle:proto_rule java_library deps @com_google_protobuf//java/core 6 | # gazelle:proto_rule java_library visibility //visibility:public 7 | # gazelle:proto_plugin java implementation lib/plugins.star%java 8 | # gazelle:proto_language java rule proto_compile 9 | # gazelle:proto_language java rule java_library 10 | # gazelle:proto_language java rule java_wrapper 11 | # gazelle:proto_language java plugin java 12 | # gazelle:proto_language java enabled true 13 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/BUILD.out: -------------------------------------------------------------------------------- 1 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 2 | # gazelle:proto_rule java_wrapper implementation lib/rules.star%java_wrapper 3 | # gazelle:proto_rule java_library implementation lib/rules.star%java_library 4 | # gazelle:proto_rule java_library deps @com_google_protobuf//:protobuf_java 5 | # gazelle:proto_rule java_library deps @com_google_protobuf//java/core 6 | # gazelle:proto_rule java_library visibility //visibility:public 7 | # gazelle:proto_plugin java implementation lib/plugins.star%java 8 | # gazelle:proto_language java rule proto_compile 9 | # gazelle:proto_language java rule java_library 10 | # gazelle:proto_language java rule java_wrapper 11 | # gazelle:proto_language java plugin java 12 | # gazelle:proto_language java enabled true 13 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/WORKSPACE: -------------------------------------------------------------------------------- 1 | # Using scala_deps here because it provides rules_jvm_external, there is nothing 2 | # scala-specific about this example. 3 | load("@build_stack_rules_proto//deps:scala_deps.bzl", "scala_deps") 4 | 5 | scala_deps() 6 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/customer/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/starlark_java/customer/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/customer/customer.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package customer; 4 | 5 | option java_multiple_files = true; 6 | option java_package = "com.github.stackb.rules_proto.example.golden.testdata.starlark_java.customer"; 7 | 8 | message Customer { 9 | string name = 1; 10 | } 11 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/defs.bzl: -------------------------------------------------------------------------------- 1 | def java_wrapper(**_kwargs): 2 | pass 3 | -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/order/BUILD.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/starlark_java/order/BUILD.in -------------------------------------------------------------------------------- /example/golden/testdata/starlark_java/order/order.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package order; 4 | 5 | import "customer/customer.proto"; 6 | 7 | option java_multiple_files = true; 8 | option java_package = "com.github.stackb.rules_proto.example.golden.testdata.starlark_java.order"; 9 | 10 | message Order { 11 | customer.Customer customer = 1; 12 | } 13 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/.bazelrc: -------------------------------------------------------------------------------- 1 | build --proto_compiler=@build_stack_rules_proto//toolchain:protoc.exe 2 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/.bazelversion: -------------------------------------------------------------------------------- 1 | 6.4.0 2 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_plugin python implementation builtin:python 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | # gazelle:proto_rule proto_python_library implementation stackb:rules_proto:proto_py_library 4 | # gazelle:proto_rule proto_python_library visibility //visibility:public 5 | # gazelle:proto_rule proto_python_library deps @com_google_protobuf//:protobuf_python 6 | # gazelle:proto_language python rule proto_compile 7 | # gazelle:proto_language python rule proto_python_library 8 | # gazelle:proto_language python plugin python 9 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/BUILD.out: -------------------------------------------------------------------------------- 1 | # gazelle:proto_plugin python implementation builtin:python 2 | # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 3 | # gazelle:proto_rule proto_python_library implementation stackb:rules_proto:proto_py_library 4 | # gazelle:proto_rule proto_python_library visibility //visibility:public 5 | # gazelle:proto_rule proto_python_library deps @com_google_protobuf//:protobuf_python 6 | # gazelle:proto_language python rule proto_compile 7 | # gazelle:proto_language python rule proto_python_library 8 | # gazelle:proto_language python plugin python 9 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/example/golden/testdata/strip_import_prefix/WORKSPACE -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_app/app/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_strip_import_prefix /module_app 2 | 3 | py_binary( 4 | name = "app_py", 5 | srcs = ["app_py.py"], 6 | deps = ["app_py_library"], 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_app/app/api.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package app; 4 | 5 | import "util/date.proto"; 6 | 7 | message ApiRequest { 8 | repeated string resource_names = 1; 9 | util.Date date = 2; 10 | } 11 | 12 | message ApiResponse { 13 | message Resource { 14 | string name = 1; 15 | } 16 | repeated Resource resources = 1; 17 | } 18 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_app/app/app_py.py: -------------------------------------------------------------------------------- 1 | from module_app.app import api_pb2 2 | from util import date_pb2 3 | 4 | request = api_pb2.ApiRequest( 5 | resource_names = ["foo", "bar", "baz"], 6 | date = date_pb2.Date( 7 | year = "2023", 8 | month = "12", 9 | day = "20", 10 | ), 11 | ) 12 | 13 | print(request) 14 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_lib/util/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_strip_import_prefix /module_lib 2 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_lib/util/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules/py:proto_py_library.bzl", "proto_py_library") 3 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 4 | 5 | # gazelle:proto_strip_import_prefix /module_lib 6 | 7 | proto_library( 8 | name = "util_proto", 9 | srcs = ["date.proto"], 10 | strip_import_prefix = "/module_lib", 11 | visibility = ["//visibility:public"], 12 | ) 13 | 14 | proto_compile( 15 | name = "util_python_compile", 16 | output_mappings = ["date_pb2.py=/util/date_pb2.py"], 17 | outputs = ["date_pb2.py"], 18 | plugins = ["@build_stack_rules_proto//plugin/builtin:python"], 19 | proto = "util_proto", 20 | ) 21 | 22 | proto_py_library( 23 | name = "util_py_library", 24 | srcs = ["date_pb2.py"], 25 | imports = [".."], 26 | visibility = ["//visibility:public"], 27 | deps = ["@com_google_protobuf//:protobuf_python"], 28 | ) 29 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_lib/util/date.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package util; 4 | 5 | message Date { 6 | string year = 1; 7 | string month = 2; 8 | string day = 3; 9 | } 10 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_lib/util/nested/prefix/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_strip_import_prefix /module_lib/util/nested 2 | -------------------------------------------------------------------------------- /example/golden/testdata/strip_import_prefix/module_lib/util/nested/prefix/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package prefix.test; 4 | 5 | message Data { 6 | int64 id = 1; 7 | } 8 | -------------------------------------------------------------------------------- /example/person/person.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package example.person; 4 | 5 | option go_package = "github.com/stackb/rules_proto/example/person;person"; 6 | 7 | import "example/place/place.proto"; 8 | 9 | message Person { 10 | // name identifies a Person 11 | string name = 1; 12 | // place is where the Person is located. 13 | example.place.Place place = 2; 14 | } -------------------------------------------------------------------------------- /example/place/place.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package example.place; 4 | 5 | option go_package = "github.com/stackb/rules_proto/example/place;place"; 6 | 7 | import "example/thing/thing.proto"; 8 | 9 | message Place { 10 | string name = 1; 11 | example.thing.Thing thing = 2; 12 | } -------------------------------------------------------------------------------- /example/routeguide/cc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | cc_library( 2 | name = "helper", 3 | srcs = ["helper.cc"], 4 | hdrs = ["helper.h"], 5 | deps = ["//example/routeguide:routeguide_grpc_cc_library"], 6 | ) 7 | 8 | cc_binary( 9 | name = "client", 10 | srcs = ["client.cc"], 11 | data = ["//example/routeguide:features"], 12 | deps = [":helper"], 13 | ) 14 | 15 | cc_binary( 16 | name = "server", 17 | srcs = ["server.cc"], 18 | data = ["//example/routeguide:features"], 19 | deps = [":helper"], 20 | ) 21 | -------------------------------------------------------------------------------- /example/routeguide/closure/client_test.js: -------------------------------------------------------------------------------- 1 | goog.module('example.routeguide.closure.GrpcJsClientTest'); 2 | 3 | goog.setTestOnly('example.routeguide.closure.GrpcJsClientTest'); 4 | 5 | const Client = goog.require('proto.example.routeguide.RouteguideClient'); 6 | const Rectangle = goog.require('proto.example.routeguide.Rectangle'); 7 | 8 | const asserts = goog.require('goog.testing.asserts'); 9 | const testSuite = goog.require('goog.testing.testSuite'); 10 | 11 | goog.require('goog.testing.jsunit'); 12 | 13 | testSuite({ 14 | testListFeatures: () => { 15 | const client = new Client(); 16 | return client.getRouteGuide().listFeatures(new Rectangle(), feature => { 17 | // no features should be returned so this should fail the test 18 | asserts.assertNull(feature); 19 | }); 20 | }, 21 | }); -------------------------------------------------------------------------------- /example/routeguide/closure/main.js: -------------------------------------------------------------------------------- 1 | goog.provide('example.routeguide.closure.main'); 2 | 3 | /** 4 | * Main entry point 5 | * @export 6 | */ 7 | example.routeguide.closure.main = function () { 8 | const Client = goog.require('example.routeguide.closure.GrpcJsClient'); 9 | const client = new Client(); 10 | client.run(); 11 | }; -------------------------------------------------------------------------------- /example/routeguide/java/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@rules_java//java:defs.bzl", "java_binary", "java_library") 2 | 3 | java_library( 4 | name = "util", 5 | srcs = ["RouteGuideUtil.java"], 6 | resources = ["//example/routeguide:feature_db"], 7 | exports = ["//example/routeguide:routeguide_grpc_java_library"], 8 | deps = [ 9 | "//example/routeguide:routeguide_grpc_java_library", 10 | "@com_google_protobuf//java/util", 11 | ], 12 | ) 13 | 14 | java_binary( 15 | name = "client", 16 | srcs = ["RouteGuideClient.java"], 17 | main_class = "example.routeguide.java.RouteGuideClient", 18 | deps = [ 19 | ":util", 20 | "@io_grpc_grpc_java//netty", 21 | ], 22 | ) 23 | 24 | java_binary( 25 | name = "server", 26 | srcs = ["RouteGuideServer.java"], 27 | main_class = "example.routeguide.java.RouteGuideServer", 28 | deps = [ 29 | ":util", 30 | "@io_grpc_grpc_java//netty", 31 | ], 32 | ) 33 | -------------------------------------------------------------------------------- /example/routeguide/nodejs/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@aspect_rules_js//js:defs.bzl", "js_binary") 2 | 3 | js_binary( 4 | name = "client", 5 | data = [ 6 | "//:node_modules/@grpc/grpc-js", 7 | "//:node_modules/google-protobuf", 8 | "//example/routeguide:features_json", 9 | "//example/routeguide:routeguide_grpc_nodejs_library", 10 | ], 11 | entry_point = "client.js", 12 | ) 13 | 14 | js_binary( 15 | name = "server", 16 | data = [ 17 | "//:node_modules/@grpc/grpc-js", 18 | "//:node_modules/google-protobuf", 19 | "//example/routeguide:features_json", 20 | "//example/routeguide:routeguide_grpc_nodejs_library", 21 | ], 22 | entry_point = "server.js", 23 | ) 24 | -------------------------------------------------------------------------------- /example/routeguide/scala/AtomicRef.scala: -------------------------------------------------------------------------------- 1 | package example.routeguide.scala 2 | 3 | import java.util.concurrent.atomic.AtomicReference 4 | 5 | import scala.annotation.tailrec 6 | 7 | class AtomicRef[T](initial: T) { 8 | private val ref: AtomicReference[T] = new AtomicReference[T](initial) 9 | 10 | def get: T = ref.get() 11 | 12 | @tailrec final def updateAndGet(update: T => T): T = { 13 | val oldValue = ref.get 14 | val newValue = update(oldValue) 15 | if (ref.compareAndSet(oldValue, newValue)) { 16 | newValue 17 | } else { 18 | updateAndGet(update) 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /example/thing/thing.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package example.thing; 4 | 5 | option java_multiple_files = true; 6 | option java_package = "com.github.stackb.rules_proto.example.thing"; 7 | option go_package = "github.com/stackb/rules_proto/example/thing;thing"; 8 | 9 | import "google/protobuf/timestamp.proto"; 10 | 11 | message Thing { 12 | string id = 1; 13 | google.protobuf.Timestamp created_at = 2; 14 | } 15 | 16 | enum Status { 17 | UNKNOWN = 0; 18 | OK = 1; 19 | } -------------------------------------------------------------------------------- /example/toolchain/prebuilt/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test") 2 | 3 | # gazelle:ignore 4 | 5 | go_bazel_test( 6 | name = "prebuilt_test", 7 | srcs = ["prebuilt_test.go"], 8 | rule_files = ["//:all_files"], 9 | ) 10 | -------------------------------------------------------------------------------- /example/toolchain/prebuilt/README.md: -------------------------------------------------------------------------------- 1 | # Prebuilt Toolchain Configuration 2 | 3 | Demonstrates the minimum WORKSPACE configuration for the prebuilt toolchain. 4 | Assert that we can run protoc. -------------------------------------------------------------------------------- /example/toolchain/prebuilt/prebuilt_test.go: -------------------------------------------------------------------------------- 1 | package prebuilt 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/bazelbuild/rules_go/go/tools/bazel_testing" 7 | ) 8 | 9 | func TestMain(m *testing.M) { 10 | bazel_testing.TestMain(m, bazel_testing.Args{ 11 | Main: ` 12 | -- WORKSPACE -- 13 | local_repository( 14 | name = "build_stack_rules_proto", 15 | path = "../build_stack_rules_proto", 16 | ) 17 | 18 | register_toolchains("@build_stack_rules_proto//toolchain:prebuilt") 19 | 20 | load("@build_stack_rules_proto//deps:prebuilt_protoc_deps.bzl", "prebuilt_protoc_deps") 21 | 22 | prebuilt_protoc_deps() 23 | 24 | -- BUILD.bazel -- 25 | # empty file 26 | `, 27 | }) 28 | } 29 | 30 | func TestRun(t *testing.T) { 31 | if err := bazel_testing.RunBazel("run", "@build_stack_rules_proto//toolchain:protoc.exe"); err != nil { 32 | t.Fatal(err) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example/toolchain/standard/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test") 2 | 3 | # gazelle:ignore 4 | 5 | go_bazel_test( 6 | name = "standard_test", 7 | srcs = ["standard_test.go"], 8 | rule_files = ["//:all_files"], 9 | ) 10 | -------------------------------------------------------------------------------- /example/toolchain/standard/README.md: -------------------------------------------------------------------------------- 1 | # Standard Toolchain Configuration 2 | 3 | Demonstrates the minimum WORKSPACE configuration for the standard toolchain. 4 | Assert that we can run protoc. -------------------------------------------------------------------------------- /example/toolchain/standard/standard_test.go: -------------------------------------------------------------------------------- 1 | package standard 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/bazelbuild/rules_go/go/tools/bazel_testing" 7 | ) 8 | 9 | func TestMain(m *testing.M) { 10 | bazel_testing.TestMain(m, bazel_testing.Args{ 11 | Main: txtar, 12 | }) 13 | } 14 | 15 | func TestRun(t *testing.T) { 16 | if err := bazel_testing.RunBazel("run", "@com_google_protobuf//:protoc"); err != nil { 17 | t.Fatal(err) 18 | } 19 | } 20 | 21 | var txtar = ` 22 | -- WORKSPACE -- 23 | local_repository( 24 | name = "build_stack_rules_proto", 25 | path = "../build_stack_rules_proto", 26 | ) 27 | 28 | register_toolchains("@build_stack_rules_proto//toolchain:standard") 29 | 30 | load("@build_stack_rules_proto//deps:protobuf_core_deps.bzl", "protobuf_core_deps") 31 | 32 | protobuf_core_deps() 33 | 34 | load("@rules_python//python:repositories.bzl", "py_repositories") 35 | 36 | py_repositories() 37 | 38 | -- BUILD.bazel -- 39 | # empty file 40 | ` 41 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/stackb/rules_proto 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/bazelbuild/bazel-gazelle v0.35.0 7 | github.com/bazelbuild/buildtools v0.0.0-20231115204819-d4c9dccdfbb1 8 | github.com/bazelbuild/rules_go v0.44.1 9 | github.com/bmatcuk/doublestar v1.3.4 10 | github.com/emicklei/proto v1.13.0 11 | github.com/google/go-cmp v0.6.0 12 | github.com/pmezard/go-difflib v1.0.0 13 | github.com/stretchr/testify v1.8.4 14 | go.starlark.net v0.0.0-20231121155337-90ade8b19d09 15 | gopkg.in/yaml.v3 v3.0.1 16 | ) 17 | 18 | require ( 19 | github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect 20 | github.com/davecgh/go-spew v1.1.1 // indirect 21 | golang.org/x/mod v0.14.0 // indirect 22 | golang.org/x/sync v0.5.0 // indirect 23 | golang.org/x/sys v0.15.0 // indirect 24 | golang.org/x/tools/go/vcs v0.1.0-deprecated // indirect 25 | ) 26 | -------------------------------------------------------------------------------- /language/example/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "example", 5 | srcs = ["example.go"], 6 | importpath = "github.com/stackb/rules_proto/language/example", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/language/noop", 10 | "@bazel_gazelle//language:go_default_library", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /language/example/example.go: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/language" 5 | 6 | "github.com/stackb/rules_proto/pkg/language/noop" 7 | // Put your own imports here! 8 | // _ "github.com/org/repo/pkg/plugin/foo" 9 | ) 10 | 11 | // NewLanguage is called by Gazelle to install this language extension in a 12 | // binary. 13 | func NewLanguage() language.Language { 14 | return noop.NewNoOpLanguage("my-project-name") 15 | } 16 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/gogo/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | 3 | proto_library( 4 | name = "test_proto", 5 | srcs = ["test.proto"], 6 | visibility = ["//visibility:public"], 7 | ) 8 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/gogo/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_language gogofast plugin gogofast 2 | # gazelle:proto_language gogofast rule proto_compiled_sources 3 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/gogo/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compiled_sources.bzl", "proto_compiled_sources") 3 | 4 | # gazelle:proto_language gogofast plugin gogofast 5 | # gazelle:proto_language gogofast rule proto_compiled_sources 6 | 7 | proto_library( 8 | name = "test_proto", 9 | srcs = ["test.proto"], 10 | visibility = ["//visibility:public"], 11 | ) 12 | 13 | proto_compiled_sources( 14 | name = "test_gogofast_compiled_sources", 15 | srcs = ["test.pb.go"], 16 | plugins = ["@build_stack_rules_proto//gogo/protobuf:gogofast_plugin"], 17 | proto = "test_proto", 18 | ) 19 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/gogo/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/language/protobuf/oldtestdata/gogo/WORKSPACE -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/gogo/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message BoolValue { 4 | bool value = 1; 5 | } 6 | 7 | enum PayloadType { 8 | COMPRESSABLE = 0; 9 | } 10 | 11 | message Payload { 12 | PayloadType type = 1; 13 | bytes body = 2; 14 | } 15 | 16 | message EchoStatus { 17 | int32 code = 1; 18 | string message = 2; 19 | } 20 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/java/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | 3 | proto_library( 4 | name = "test_proto", 5 | srcs = ["test.proto"], 6 | visibility = ["//visibility:public"], 7 | ) 8 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/java/BUILD.in: -------------------------------------------------------------------------------- 1 | # gazelle:proto_language java plugin java_proto 2 | # gazelle:proto_language java plugin java_grpc 3 | # gazelle:proto_language java rule proto_compile 4 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/java/BUILD.out: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 3 | 4 | # gazelle:proto_language java plugin java_proto 5 | # gazelle:proto_language java plugin java_grpc 6 | # gazelle:proto_language java rule proto_compile 7 | 8 | proto_library( 9 | name = "test_proto", 10 | srcs = ["test.proto"], 11 | visibility = ["//visibility:public"], 12 | ) 13 | 14 | proto_compile( 15 | name = "test_java_compile", 16 | outputs = ["test.srcjar"], 17 | plugins = ["@build_stack_rules_proto//protocolbuffers/protobuf:java_plugin"], 18 | proto = "test_proto", 19 | ) 20 | -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/java/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/language/protobuf/oldtestdata/java/WORKSPACE -------------------------------------------------------------------------------- /language/protobuf/oldtestdata/java/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message BoolValue { 4 | bool value = 1; 5 | } 6 | 7 | enum PayloadType { 8 | COMPRESSABLE = 0; 9 | } 10 | 11 | message Payload { 12 | PayloadType type = 1; 13 | bytes body = 2; 14 | } 15 | 16 | message EchoStatus { 17 | int32 code = 1; 18 | string message = 2; 19 | } 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@nestjs/common": "10.1.3", 4 | "@nestjs/core": "10.1.3", 5 | "@nestjs/microservices": "10.1.3", 6 | "@types/node": "^20.4.9", 7 | "long": "5.2.3", 8 | "protobufjs": "7.2.4", 9 | "reflect-metadata": "0.1.13", 10 | "rxjs": "7.8.1", 11 | "typescript": "5.1.6", 12 | "@grpc/grpc-js": "1.9.0", 13 | "google-protobuf": "3.21.2" 14 | } 15 | } -------------------------------------------------------------------------------- /pkg/goldentest/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "goldentest", 5 | testonly = True, 6 | srcs = ["cases.go"], 7 | importpath = "github.com/stackb/rules_proto/pkg/goldentest", 8 | visibility = ["//visibility:public"], 9 | deps = [ 10 | "@bazel_gazelle//testtools:go_default_library", 11 | "@io_bazel_rules_go//go/tools/bazel:go_default_library", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /pkg/language/noop/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "noop", 5 | srcs = ["noop.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/language/noop", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "@bazel_gazelle//config:go_default_library", 10 | "@bazel_gazelle//label:go_default_library", 11 | "@bazel_gazelle//language:go_default_library", 12 | "@bazel_gazelle//repo:go_default_library", 13 | "@bazel_gazelle//resolve:go_default_library", 14 | "@bazel_gazelle//rule:go_default_library", 15 | ], 16 | ) 17 | -------------------------------------------------------------------------------- /pkg/language/protobuf/fix.go: -------------------------------------------------------------------------------- 1 | package protobuf 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/config" 5 | "github.com/bazelbuild/bazel-gazelle/rule" 6 | ) 7 | 8 | // Fix repairs deprecated usage of language-specific rules in f. This is called 9 | // before the file is indexed. Unless c.ShouldFix is true, fixes that delete or 10 | // rename rules should not be performed. 11 | func (*protobufLang) Fix(c *config.Config, f *rule.File) {} 12 | -------------------------------------------------------------------------------- /pkg/plugin/akka/akka_grpc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "akka_grpc", 5 | srcs = ["protoc_gen_akka_grpc.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/akka/akka_grpc", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | go_test( 15 | name = "akka_grpc_test", 16 | srcs = ["protoc_gen_akka_grpc_test.go"], 17 | deps = [ 18 | ":akka_grpc", 19 | "//pkg/plugintest", 20 | ], 21 | ) 22 | 23 | filegroup( 24 | name = "all_files", 25 | testonly = True, 26 | srcs = [ 27 | "BUILD.bazel", 28 | ] + glob(["*.go"]), 29 | visibility = ["//pkg:__pkg__"], 30 | ) 31 | -------------------------------------------------------------------------------- /pkg/plugin/bufbuild/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "bufbuild", 5 | srcs = [ 6 | "connect_es_plugin.go", 7 | "es_plugin.go", 8 | ], 9 | importpath = "github.com/stackb/rules_proto/pkg/plugin/bufbuild", 10 | visibility = ["//visibility:public"], 11 | deps = [ 12 | "//pkg/protoc", 13 | "@bazel_gazelle//label:go_default_library", 14 | ], 15 | ) 16 | 17 | go_test( 18 | name = "bufbuild_test", 19 | srcs = ["es_plugin_test.go"], 20 | deps = [ 21 | ":bufbuild", 22 | "//pkg/plugintest", 23 | ], 24 | ) 25 | 26 | filegroup( 27 | name = "all_files", 28 | testonly = True, 29 | srcs = [ 30 | "BUILD.bazel", 31 | ] + glob(["*.go"]), 32 | visibility = ["//pkg:__pkg__"], 33 | ) 34 | -------------------------------------------------------------------------------- /pkg/plugin/bufbuild/es_plugin_test.go: -------------------------------------------------------------------------------- 1 | package bufbuild_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stackb/rules_proto/pkg/plugin/bufbuild" 7 | "github.com/stackb/rules_proto/pkg/plugintest" 8 | ) 9 | 10 | func TestProtocGenTsProtoPlugin(t *testing.T) { 11 | plugintest.Cases(t, &bufbuild.EsProto{}, map[string]plugintest.Case{ 12 | "simple": { 13 | Input: "message M{}", 14 | Directives: plugintest.WithDirectives( 15 | "proto_plugin", "es implementation bufbuild:connect-es", 16 | ), 17 | PluginName: "es", 18 | Configuration: plugintest.WithConfiguration( 19 | plugintest.WithLabel(t, "@build_stack_rules_proto//plugin/bufbuild:es"), 20 | plugintest.WithOptions("keep_empty_files=true", "target=ts"), 21 | plugintest.WithOutputs("test_pb.ts"), 22 | ), 23 | SkipIntegration: true, 24 | }, 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /pkg/plugin/builtin/cpp_plugin.go: -------------------------------------------------------------------------------- 1 | package builtin 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/label" 5 | "github.com/stackb/rules_proto/pkg/protoc" 6 | ) 7 | 8 | func init() { 9 | protoc.Plugins().MustRegisterPlugin(&CppPlugin{}) 10 | } 11 | 12 | // CppPlugin implements Plugin for the built-in protoc C++ plugin. 13 | type CppPlugin struct{} 14 | 15 | // Name implements part of the Plugin interface. 16 | func (p *CppPlugin) Name() string { 17 | return "builtin:cpp" 18 | } 19 | 20 | // Configure implements part of the Plugin interface. 21 | func (p *CppPlugin) Configure(ctx *protoc.PluginContext) *protoc.PluginConfiguration { 22 | return &protoc.PluginConfiguration{ 23 | Label: label.New("build_stack_rules_proto", "plugin/builtin", "cpp"), 24 | Outputs: protoc.FlatMapFiles( 25 | protoc.ImportPrefixRelativeFileNameWithExtensions(ctx.ProtoLibrary.StripImportPrefix(), ctx.Rel, ".pb.cc", ".pb.h"), 26 | protoc.Always, 27 | ctx.ProtoLibrary.Files()..., 28 | ), 29 | Options: ctx.PluginConfig.GetOptions(), 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/plugin/builtin/java_plugin.go: -------------------------------------------------------------------------------- 1 | package builtin 2 | 3 | import ( 4 | "path" 5 | 6 | "github.com/bazelbuild/bazel-gazelle/label" 7 | "github.com/stackb/rules_proto/pkg/protoc" 8 | ) 9 | 10 | func init() { 11 | protoc.Plugins().MustRegisterPlugin(&JavaPlugin{}) 12 | } 13 | 14 | // JavaPlugin implements Plugin for the built-in protoc java plugin. 15 | type JavaPlugin struct{} 16 | 17 | // Name implements part of the Plugin interface. 18 | func (p *JavaPlugin) Name() string { 19 | return "builtin:java" 20 | } 21 | 22 | // Configure implements part of the Plugin interface. 23 | func (p *JavaPlugin) Configure(ctx *protoc.PluginContext) *protoc.PluginConfiguration { 24 | srcjar := path.Join(ctx.Rel, ctx.ProtoLibrary.BaseName()+".srcjar") 25 | return &protoc.PluginConfiguration{ 26 | Label: label.New("build_stack_rules_proto", "plugin/builtin", "java"), 27 | Outputs: []string{srcjar}, 28 | Out: srcjar, 29 | Options: ctx.PluginConfig.GetOptions(), 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/plugin/builtin/ruby_plugin.go: -------------------------------------------------------------------------------- 1 | package builtin 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/label" 5 | "github.com/stackb/rules_proto/pkg/protoc" 6 | ) 7 | 8 | func init() { 9 | protoc.Plugins().MustRegisterPlugin(&RubyPlugin{}) 10 | } 11 | 12 | // RubyPlugin implements Plugin for the built-in protoc ruby plugin. 13 | type RubyPlugin struct{} 14 | 15 | // Name implements part of the Plugin interface. 16 | func (p *RubyPlugin) Name() string { 17 | return "builtin:ruby" 18 | } 19 | 20 | // Configure implements part of the Plugin interface. 21 | func (p *RubyPlugin) Configure(ctx *protoc.PluginContext) *protoc.PluginConfiguration { 22 | return &protoc.PluginConfiguration{ 23 | Label: label.New("build_stack_rules_proto", "plugin/builtin", "ruby"), 24 | Outputs: protoc.FlatMapFiles( 25 | protoc.RelativeFileNameWithExtensions(ctx.Rel, "_pb.rb"), 26 | protoc.Always, 27 | ctx.ProtoLibrary.Files()..., 28 | ), 29 | Options: ctx.PluginConfig.GetOptions(), 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/plugin/gogo/protobuf/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "protobuf", 5 | srcs = ["protoc-gen-gogo.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/gogo/protobuf", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | testonly = True, 17 | srcs = [ 18 | "BUILD.bazel", 19 | ] + glob(["*.go"]), 20 | visibility = ["//pkg:__pkg__"], 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/plugin/grpc/grpc/grpc_test.go: -------------------------------------------------------------------------------- 1 | package grpc_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/bazelbuild/rules_go/go/tools/bazel_testing" 7 | ) 8 | 9 | func TestMain(m *testing.M) { 10 | bazel_testing.TestMain(m, bazel_testing.Args{ 11 | Main: txtar, 12 | }) 13 | } 14 | 15 | func TestBuild(t *testing.T) { 16 | if err := bazel_testing.RunBazel("build", ":all"); err != nil { 17 | t.Fatal(err) 18 | } 19 | } 20 | 21 | var txtar = ` 22 | -- WORKSPACE -- 23 | local_repository( 24 | name = "build_stack_rules_proto", 25 | path = "../../build_stack_rules_proto", 26 | ) 27 | 28 | -- BUILD.bazel -- 29 | 30 | # gazelle:proto_language builtins rule proto_compile 31 | # gazelle:proto_language builtins plugin grpc:grpc:protoc-gen-grpc-python 32 | 33 | -- foo.proto -- 34 | syntax = "proto3"; 35 | 36 | message FooRequest { 37 | string name = 1; 38 | } 39 | 40 | message Foo { 41 | string name = 1; 42 | } 43 | 44 | service Fooer { 45 | rpc GetFoo(FooRequest) returns (Foo) {} 46 | } 47 | ` 48 | -------------------------------------------------------------------------------- /pkg/plugin/grpc/grpcgo/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "grpcgo", 5 | srcs = ["protoc-gen-go-grpc.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/grpc/grpcgo", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/plugin/golang/protobuf", 10 | "//pkg/protoc", 11 | "@bazel_gazelle//label:go_default_library", 12 | "@bazel_gazelle//rule:go_default_library", 13 | ], 14 | ) 15 | 16 | filegroup( 17 | name = "all_files", 18 | testonly = True, 19 | srcs = [ 20 | "BUILD.bazel", 21 | ] + glob(["*.go"]), 22 | visibility = ["//pkg:__pkg__"], 23 | ) 24 | -------------------------------------------------------------------------------- /pkg/plugin/grpc/grpcjava/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "grpcjava", 5 | srcs = ["protoc-gen-grpc-java.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/grpc/grpcjava", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | testonly = True, 17 | srcs = [ 18 | "BUILD.bazel", 19 | ] + glob(["*.go"]), 20 | visibility = ["//pkg:__pkg__"], 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/plugin/grpc/grpcnode/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "grpcnode", 5 | srcs = ["protoc-gen-grpc-node.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/grpc/grpcnode", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | testonly = True, 17 | srcs = [ 18 | "BUILD.bazel", 19 | ] + glob(["*.go"]), 20 | visibility = ["//pkg:__pkg__"], 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/plugin/grpc/grpcweb/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "grpcweb", 5 | srcs = ["protoc-gen-grpc-web.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/grpc/grpcweb", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | testonly = True, 17 | srcs = [ 18 | "BUILD.bazel", 19 | ] + glob(["*.go"]), 20 | visibility = ["//pkg:__pkg__"], 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/plugin/grpcecosystem/grpcgateway/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "grpcgateway", 5 | srcs = ["protoc-gen-grpc-gateway.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/grpcecosystem/grpcgateway", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | testonly = True, 17 | srcs = [ 18 | "BUILD.bazel", 19 | ] + glob(["*.go"]), 20 | visibility = ["//pkg:__pkg__"], 21 | ) 22 | 23 | go_test( 24 | name = "grpcgateway_test", 25 | srcs = ["protoc-gen-grpc-gateway_test.go"], 26 | embed = [":grpcgateway"], 27 | deps = ["//pkg/plugintest"], 28 | ) 29 | -------------------------------------------------------------------------------- /pkg/plugin/scalapb/scalapb/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "scalapb", 5 | srcs = ["protoc_gen_scala.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/scalapb/scalapb", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | go_test( 15 | name = "scalapb_test", 16 | srcs = ["protoc_gen_scala_test.go"], 17 | data = [":protoc"], 18 | deps = [ 19 | ":scalapb", 20 | "//pkg/plugintest", 21 | ], 22 | ) 23 | 24 | genrule( 25 | name = "protoc_tool", 26 | outs = ["protoc"], 27 | cmd = "cp $(location @com_google_protobuf//:protoc) $@", 28 | executable = True, 29 | tools = ["@com_google_protobuf//:protoc"], 30 | ) 31 | 32 | filegroup( 33 | name = "all_files", 34 | testonly = True, 35 | srcs = [ 36 | "BUILD.bazel", 37 | ] + glob(["*.go"]), 38 | visibility = ["//pkg:__pkg__"], 39 | ) 40 | -------------------------------------------------------------------------------- /pkg/plugin/scalapb/zio_grpc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "zio_grpc", 5 | srcs = ["protoc_gen_zio_grpc.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/scalapb/zio_grpc", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | go_test( 15 | name = "zio_grpc_test", 16 | srcs = ["protoc_gen_zio_grpc_test.go"], 17 | deps = [ 18 | ":zio_grpc", 19 | "//pkg/plugintest", 20 | ], 21 | ) 22 | 23 | filegroup( 24 | name = "all_files", 25 | testonly = True, 26 | srcs = [ 27 | "BUILD.bazel", 28 | ] + glob(["*.go"]), 29 | visibility = ["//pkg:__pkg__"], 30 | ) 31 | -------------------------------------------------------------------------------- /pkg/plugin/stackb/grpc_js/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "grpc_js", 5 | srcs = ["protoc-gen-grpc-js.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/stackb/grpc_js", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | testonly = True, 17 | srcs = [ 18 | "BUILD.bazel", 19 | ] + glob(["*.go"]), 20 | visibility = ["//pkg:__pkg__"], 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/plugin/stephenh/ts-proto/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "ts-proto", 5 | srcs = ["protoc-gen-ts-proto.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/plugin/stephenh/ts-proto", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//label:go_default_library", 11 | ], 12 | ) 13 | 14 | go_test( 15 | name = "ts-proto_test", 16 | srcs = ["protoc-gen-ts-proto_test.go"], 17 | deps = [ 18 | ":ts-proto", 19 | "//pkg/plugintest", 20 | ], 21 | ) 22 | 23 | filegroup( 24 | name = "all_files", 25 | testonly = True, 26 | srcs = [ 27 | "BUILD.bazel", 28 | ] + glob(["*.go"]), 29 | visibility = ["//pkg:__pkg__"], 30 | ) 31 | -------------------------------------------------------------------------------- /pkg/plugintest/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "plugintest", 5 | testonly = True, 6 | srcs = [ 7 | "case.go", 8 | "doc.go", 9 | "utils.go", 10 | ], 11 | importpath = "github.com/stackb/rules_proto/pkg/plugintest", 12 | visibility = ["//visibility:public"], 13 | deps = [ 14 | "//pkg/protoc", 15 | "@bazel_gazelle//label:go_default_library", 16 | "@bazel_gazelle//rule:go_default_library", 17 | "@com_github_google_go_cmp//cmp", 18 | "@com_github_google_go_cmp//cmp/cmpopts", 19 | ], 20 | ) 21 | 22 | filegroup( 23 | name = "all_files", 24 | testonly = True, 25 | srcs = [ 26 | "BUILD.bazel", 27 | ] + glob(["*.go"]), 28 | visibility = ["//pkg:__pkg__"], 29 | ) 30 | -------------------------------------------------------------------------------- /pkg/plugintest/doc.go: -------------------------------------------------------------------------------- 1 | // plugintest provides utilities for black-box testing of protoc.Plugin 2 | // implementations. 3 | package plugintest 4 | -------------------------------------------------------------------------------- /pkg/protoc/intent.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import ( 4 | "sort" 5 | "strings" 6 | ) 7 | 8 | // intent represents an action for an attribute name or "value" optionally 9 | // prefixed by a '+' or '-'. If the prefix is missing, the intent is not 10 | // negative. 11 | type intent struct { 12 | Value string 13 | Want bool 14 | } 15 | 16 | func parseIntent(value string) *intent { 17 | value = strings.TrimSpace(value) 18 | negative := strings.HasPrefix(value, "-") 19 | positive := strings.HasPrefix(value, "+") 20 | if negative || positive { 21 | value = value[1:] 22 | } 23 | return &intent{Value: value, Want: !negative} 24 | } 25 | 26 | // ForIntent reduces a dict to a list by the given intent. 27 | func ForIntent(in map[string]bool, want bool) []string { 28 | vals := make([]string, 0) 29 | for val, intent := range in { 30 | if intent != want { 31 | continue 32 | } 33 | vals = append(vals, val) 34 | } 35 | sort.Strings(vals) 36 | return vals 37 | } 38 | -------------------------------------------------------------------------------- /pkg/protoc/intent_test.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import "testing" 4 | 5 | func TestParseIntent(t *testing.T) { 6 | for name, tc := range map[string]struct { 7 | in string 8 | wantValue string 9 | want bool 10 | }{ 11 | "": { 12 | in: "", 13 | wantValue: "", 14 | want: true, 15 | }, 16 | "bare": { 17 | in: "foo", 18 | wantValue: "foo", 19 | want: true, 20 | }, 21 | "+": { 22 | in: "+foo", 23 | wantValue: "foo", 24 | want: true, 25 | }, 26 | "-": { 27 | in: "-foo", 28 | wantValue: "foo", 29 | want: false, 30 | }, 31 | } { 32 | t.Run(name, func(t *testing.T) { 33 | intent := parseIntent(tc.in) 34 | if tc.wantValue != intent.Value { 35 | t.Errorf("value: want %s, got %s", tc.wantValue, intent.Value) 36 | } 37 | if tc.want != intent.Want { 38 | t.Errorf("value: want %t, got %t", tc.want, intent.Want) 39 | } 40 | }) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /pkg/protoc/language_rule.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import "github.com/bazelbuild/bazel-gazelle/rule" 4 | 5 | // LanguageRule is capable of taking a compilation and deriving another rule 6 | // based on it. For example, a java_proto_library LanguageRule implementation 7 | // might collect all the emitted *.srcjar files from the protoc configuration 8 | // and wrap it with a java_library. 9 | type LanguageRule interface { 10 | // Name returns the name of the rule 11 | Name() string 12 | // LoadInfo returns the gazelle LoadInfo. 13 | LoadInfo() rule.LoadInfo 14 | // KindInfo returns the gazelle KindInfo. 15 | KindInfo() rule.KindInfo 16 | // ProvideRule takes the given configration and compilation and emits a 17 | // RuleProvider. If the state of the ProtocConfiguration is such that the 18 | // rule should not be emitted, implementation should return nil. 19 | ProvideRule(rc *LanguageRuleConfig, pc *ProtocConfiguration) RuleProvider 20 | } 21 | -------------------------------------------------------------------------------- /pkg/protoc/plugin.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/label" 5 | "github.com/bazelbuild/bazel-gazelle/rule" 6 | ) 7 | 8 | // Plugin implementations are capable of predicting the sources that are 9 | // generated by a particular protoc plugin. 10 | type Plugin interface { 11 | // Name is the name of the plugin and its associated configuration. 12 | Name() string 13 | // Configure creates the plugin configuration. If nil is returned, the 14 | // plugin should be skipped for the current package/library. 15 | Configure(ctx *PluginContext) *PluginConfiguration 16 | } 17 | 18 | // PluginOptionsResolver is an optional interface that a plugin can implement. 19 | // This works in conjunction with proto_compile for plugins that need to do late 20 | // determination of options. Rule is the rule being generated, and from is the 21 | // label for that rule. 22 | type PluginOptionsResolver interface { 23 | ResolvePluginOptions(ctx *PluginConfiguration, r *rule.Rule, from label.Label) []string 24 | } 25 | -------------------------------------------------------------------------------- /pkg/protoc/plugin_context.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | // PluginContext represents the environment available to the plugin when 4 | // invoked. 5 | type PluginContext struct { 6 | // Rel is the relative path of the package. 7 | Rel string 8 | // ProtoLibrary is the proto_library under observation. 9 | ProtoLibrary ProtoLibrary 10 | // PackageConfig is the configuration for the package. 11 | PackageConfig PackageConfig 12 | // PluginConfig is the configuration object associated with the plugin. 13 | PluginConfig LanguagePluginConfig 14 | // Plugin is a reference to the plugin implementation 15 | Plugin Plugin 16 | } 17 | 18 | // type PluginContextResolver func(c *config.Config, ix *resolve.RuleIndex, r *rule.Rule, imports []string, from label.Label) 19 | -------------------------------------------------------------------------------- /pkg/protoc/proto_library.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/rule" 5 | ) 6 | 7 | // ProtoLibrary represents a proto_library target and its associated parsed 8 | // .proto files. 9 | type ProtoLibrary interface { 10 | // Name returns the name of the rule (e.g. foo_proto) 11 | Name() string 12 | // BaseName returns the name of the rule (e.g. foo). This is typically 13 | // derived from the proto file package or name. 14 | BaseName() string 15 | // Rule returns the underlying rule 16 | Rule() *rule.Rule 17 | // Srcs() returns the relative path of srcs, including args.Rel 18 | Srcs() []string 19 | // Deps lists all direct library dependencies. 20 | Deps() []string 21 | // Imports lists all direct library proto import filenames. 22 | Imports() []string 23 | // StripImportPrefix returns the strip_import_prefix or the empty string. 24 | StripImportPrefix() string 25 | // Files returns the list of proto files in the rule. 26 | Files() []*File 27 | } 28 | -------------------------------------------------------------------------------- /pkg/protoc/rule_registry.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import "errors" 4 | 5 | // ErrUnknownRule is the error returned when a rule is not known. 6 | var ErrUnknownRule = errors.New("unknown rule") 7 | 8 | // RuleRegistry represents a library of rule implementations. 9 | type RuleRegistry interface { 10 | // RuleNames returns a sorted list of rule names. 11 | RuleNames() []string 12 | // LookupRule returns the implementation under the given name. If the rule 13 | // is not found, ErrUnknownRule is returned. 14 | LookupRule(name string) (LanguageRule, error) 15 | // MustRegisterRule installs a LanguageRule implementation under the given 16 | // name in the global rule registry. Panic will occur if the same rule is 17 | // registered multiple times. 18 | MustRegisterRule(name string, rule LanguageRule) RuleRegistry 19 | } 20 | -------------------------------------------------------------------------------- /pkg/protoc/ruleindex.go: -------------------------------------------------------------------------------- 1 | package protoc 2 | 3 | import ( 4 | "github.com/bazelbuild/bazel-gazelle/label" 5 | "github.com/bazelbuild/bazel-gazelle/rule" 6 | ) 7 | 8 | type RuleIndex interface { 9 | // Put records the association of the rule under the given label. 10 | Put(label.Label, *rule.Rule) 11 | // Get returns the rule under the given label, or nil if not known. 12 | Get(label.Label) *rule.Rule 13 | } 14 | 15 | // GlobalRuleIndex returns a reference to the global RuleIndex 16 | func GlobalRuleIndex() RuleIndex { 17 | return globalRuleIndex 18 | } 19 | 20 | // globalRuleIndex is the default resolver singleton. 21 | var globalRuleIndex = &ruleIndex{ 22 | rules: make(map[label.Label]*rule.Rule), 23 | } 24 | 25 | // ruleIndex implements RuleIndex. 26 | type ruleIndex struct { 27 | rules map[label.Label]*rule.Rule 28 | } 29 | 30 | func (r *ruleIndex) Put(from label.Label, rule *rule.Rule) { 31 | r.rules[from] = rule 32 | } 33 | 34 | func (r *ruleIndex) Get(from label.Label) *rule.Rule { 35 | return r.rules[from] 36 | } 37 | -------------------------------------------------------------------------------- /pkg/rule/rules_cc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "rules_cc", 5 | srcs = [ 6 | "cc_library.go", 7 | "grpc_cc_library.go", 8 | "proto_cc_library.go", 9 | ], 10 | importpath = "github.com/stackb/rules_proto/pkg/rule/rules_cc", 11 | visibility = ["//visibility:public"], 12 | deps = [ 13 | "//pkg/protoc", 14 | "@bazel_gazelle//config:go_default_library", 15 | "@bazel_gazelle//label:go_default_library", 16 | "@bazel_gazelle//resolve:go_default_library", 17 | "@bazel_gazelle//rule:go_default_library", 18 | ], 19 | ) 20 | 21 | filegroup( 22 | name = "all_files", 23 | testonly = True, 24 | srcs = [ 25 | "BUILD.bazel", 26 | ] + glob(["*.go"]), 27 | visibility = ["//pkg:__pkg__"], 28 | ) 29 | -------------------------------------------------------------------------------- /pkg/rule/rules_closure/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "rules_closure", 5 | srcs = [ 6 | "closure_js_library.go", 7 | "grpc_closure_js_library.go", 8 | "proto_closure_js_library.go", 9 | ], 10 | importpath = "github.com/stackb/rules_proto/pkg/rule/rules_closure", 11 | visibility = ["//visibility:public"], 12 | deps = [ 13 | "//pkg/protoc", 14 | "@bazel_gazelle//config:go_default_library", 15 | "@bazel_gazelle//label:go_default_library", 16 | "@bazel_gazelle//resolve:go_default_library", 17 | "@bazel_gazelle//rule:go_default_library", 18 | ], 19 | ) 20 | 21 | filegroup( 22 | name = "all_files", 23 | testonly = True, 24 | srcs = [ 25 | "BUILD.bazel", 26 | ] + glob(["*.go"]), 27 | visibility = ["//pkg:__pkg__"], 28 | ) 29 | -------------------------------------------------------------------------------- /pkg/rule/rules_go/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "rules_go", 5 | srcs = ["go_library.go"], 6 | importpath = "github.com/stackb/rules_proto/pkg/rule/rules_go", 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | "//pkg/protoc", 10 | "@bazel_gazelle//config:go_default_library", 11 | "@bazel_gazelle//label:go_default_library", 12 | "@bazel_gazelle//resolve:go_default_library", 13 | "@bazel_gazelle//rule:go_default_library", 14 | ], 15 | ) 16 | 17 | go_test( 18 | name = "rules_go_test", 19 | srcs = ["go_library_test.go"], 20 | embed = [":rules_go"], 21 | deps = [ 22 | "//pkg/protoc", 23 | "@bazel_gazelle//rule:go_default_library", 24 | ], 25 | ) 26 | 27 | filegroup( 28 | name = "all_files", 29 | testonly = True, 30 | srcs = [ 31 | "BUILD.bazel", 32 | ] + glob(["*.go"]), 33 | visibility = ["//pkg:__pkg__"], 34 | ) 35 | -------------------------------------------------------------------------------- /pkg/rule/rules_java/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "rules_java", 5 | srcs = [ 6 | "grpc_java_library.go", 7 | "java_library.go", 8 | "proto_java_library.go", 9 | ], 10 | importpath = "github.com/stackb/rules_proto/pkg/rule/rules_java", 11 | visibility = ["//visibility:public"], 12 | deps = [ 13 | "//pkg/protoc", 14 | "@bazel_gazelle//config:go_default_library", 15 | "@bazel_gazelle//label:go_default_library", 16 | "@bazel_gazelle//resolve:go_default_library", 17 | "@bazel_gazelle//rule:go_default_library", 18 | ], 19 | ) 20 | 21 | filegroup( 22 | name = "all_files", 23 | testonly = True, 24 | srcs = [ 25 | "BUILD.bazel", 26 | ] + glob(["*.go"]), 27 | visibility = ["//pkg:__pkg__"], 28 | ) 29 | -------------------------------------------------------------------------------- /pkg/rule/rules_nodejs/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "rules_nodejs", 5 | srcs = [ 6 | "grpc_nodejs_library.go", 7 | "grpc_web_js_library.go", 8 | "js_library.go", 9 | "proto_nodejs_library.go", 10 | "proto_ts_library.go", 11 | ], 12 | importpath = "github.com/stackb/rules_proto/pkg/rule/rules_nodejs", 13 | visibility = ["//visibility:public"], 14 | deps = [ 15 | "//pkg/protoc", 16 | "@bazel_gazelle//config:go_default_library", 17 | "@bazel_gazelle//label:go_default_library", 18 | "@bazel_gazelle//resolve:go_default_library", 19 | "@bazel_gazelle//rule:go_default_library", 20 | ], 21 | ) 22 | 23 | filegroup( 24 | name = "all_files", 25 | testonly = True, 26 | srcs = [ 27 | "BUILD.bazel", 28 | ] + glob(["*.go"]), 29 | visibility = ["//pkg:__pkg__"], 30 | ) 31 | -------------------------------------------------------------------------------- /plugin/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "//plugin/akka/akka-grpc:all_files", 7 | "//plugin/bufbuild:all_files", 8 | "//plugin/builtin:all_files", 9 | "//plugin/gogo/protobuf:all_files", 10 | "//plugin/golang/protobuf:all_files", 11 | "//plugin/grpc/grpc:all_files", 12 | "//plugin/grpc/grpc-go:all_files", 13 | "//plugin/grpc/grpc-java:all_files", 14 | "//plugin/grpc/grpc-node:all_files", 15 | "//plugin/scalapb/scalapb:all_files", 16 | "//plugin/stackb/grpc_js:all_files", 17 | "//plugin/stephenh/ts-proto:all_files", 18 | ], 19 | visibility = ["//visibility:public"], 20 | ) 21 | -------------------------------------------------------------------------------- /plugin/akka/akka-grpc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-akka-grpc", 5 | out = "{BIN_DIR}/{PACKAGE}/{PROTO_LIBRARY_BASENAME}_akka_grpc.srcjar", 6 | options = [ 7 | "flat_package", 8 | "generate_client=true", 9 | "generate_server=true", 10 | "language=scala", 11 | "server_power_apis", 12 | ], 13 | tool = ":akka_grpc_codegen", 14 | use_built_in_shell_environment = True, 15 | visibility = ["//visibility:public"], 16 | ) 17 | 18 | java_binary( 19 | name = "akka_grpc_codegen", 20 | main_class = "akka.grpc.gen.Main", 21 | visibility = ["//visibility:public"], 22 | runtime_deps = [ 23 | "@maven_akka//:com_lightbend_akka_grpc_akka_grpc_codegen_2_12_2_1_3", 24 | ], 25 | ) 26 | 27 | filegroup( 28 | name = "all_files", 29 | testonly = True, 30 | srcs = ["BUILD.bazel"], 31 | visibility = ["//plugin:__pkg__"], 32 | ) 33 | -------------------------------------------------------------------------------- /plugin/bufbuild/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | load("@npm_ts_proto//plugin/bufbuild:@bufbuild/protoc-gen-es/package_json.bzl", gen_bin = "bin") 3 | load("@npm_ts_proto//plugin/bufbuild:@bufbuild/protoc-gen-connect-es/package_json.bzl", connect_bin = "bin") 4 | 5 | gen_bin.protoc_gen_es_binary( 6 | name = "protoc-gen-es", 7 | ) 8 | 9 | connect_bin.protoc_gen_connect_es_binary( 10 | name = "protoc-gen-connect", 11 | ) 12 | 13 | proto_plugin( 14 | name = "connect-es", 15 | tool = ":protoc-gen-connect", 16 | visibility = ["//visibility:public"], 17 | ) 18 | 19 | proto_plugin( 20 | name = "es", 21 | tool = ":protoc-gen-es", 22 | visibility = ["//visibility:public"], 23 | ) 24 | 25 | filegroup( 26 | name = "all_files", 27 | testonly = True, 28 | srcs = ["BUILD.bazel"], 29 | visibility = ["//plugin:__pkg__"], 30 | ) 31 | -------------------------------------------------------------------------------- /plugin/bufbuild/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@bufbuild/protobuf": "1.3.0", 4 | "@bufbuild/protoc-gen-es": "1.3.0", 5 | "@bufbuild/protoc-gen-connect-es": "0.12.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plugin/gogo/protobuf/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | load( 3 | "@io_bazel_rules_go//proto/wkt:well_known_types.bzl", 4 | "GOGO_WELL_KNOWN_TYPE_REMAPS", 5 | ) 6 | load(":variants.bzl", "GOGO_VARIANTS") 7 | 8 | [proto_plugin( 9 | name = "protoc-gen-" + variant, 10 | options = GOGO_WELL_KNOWN_TYPE_REMAPS, 11 | tool = "@com_github_gogo_protobuf//protoc-gen-" + variant, 12 | visibility = ["//visibility:public"], 13 | ) for variant in GOGO_VARIANTS] 14 | 15 | filegroup( 16 | name = "all_files", 17 | testonly = True, 18 | srcs = [ 19 | "BUILD.bazel", 20 | "variants.bzl", 21 | ], 22 | visibility = ["//plugin:__pkg__"], 23 | ) 24 | -------------------------------------------------------------------------------- /plugin/gogo/protobuf/variants.bzl: -------------------------------------------------------------------------------- 1 | """variants.bzl 2 | """ 3 | GOGO_VARIANTS = [ 4 | "combo", 5 | "gogo", 6 | "gogofast", 7 | "gogofaster", 8 | "gogoslick", 9 | "gogotypes", 10 | "gostring", 11 | ] 12 | -------------------------------------------------------------------------------- /plugin/golang/protobuf/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-go", 5 | tool = "@org_golang_google_protobuf//cmd/protoc-gen-go", 6 | visibility = ["//visibility:public"], 7 | ) 8 | 9 | filegroup( 10 | name = "all_files", 11 | testonly = True, 12 | srcs = ["BUILD.bazel"], 13 | visibility = ["//plugin:__pkg__"], 14 | ) 15 | -------------------------------------------------------------------------------- /plugin/grpc-ecosystem/grpc-gateway/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-grpc-gateway", 5 | options = ["paths=source_relative"], 6 | tool = "@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway", 7 | visibility = ["//visibility:public"], 8 | ) 9 | 10 | proto_plugin( 11 | name = "protoc-gen-swagger", 12 | tool = "@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-swagger", 13 | visibility = ["//visibility:public"], 14 | ) 15 | 16 | filegroup( 17 | name = "all_files", 18 | testonly = True, 19 | srcs = ["BUILD.bazel"], 20 | visibility = ["//plugin:__pkg__"], 21 | ) 22 | -------------------------------------------------------------------------------- /plugin/grpc/grpc-go/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-go-grpc", 5 | tool = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc", 6 | visibility = ["//visibility:public"], 7 | ) 8 | 9 | filegroup( 10 | name = "all_files", 11 | testonly = True, 12 | srcs = ["BUILD.bazel"], 13 | visibility = ["//plugin:__pkg__"], 14 | ) 15 | -------------------------------------------------------------------------------- /plugin/grpc/grpc-java/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-grpc-java", 5 | out = "{BIN_DIR}/{PACKAGE}/{PROTO_LIBRARY_BASENAME}_grpc.srcjar", 6 | tool = "@io_grpc_grpc_java//compiler:grpc_java_plugin", 7 | visibility = ["//visibility:public"], 8 | ) 9 | 10 | filegroup( 11 | name = "all_files", 12 | testonly = True, 13 | srcs = ["BUILD.bazel"], 14 | visibility = ["//plugin:__pkg__"], 15 | ) 16 | -------------------------------------------------------------------------------- /plugin/grpc/grpc-node/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-grpc-node", 5 | tool = "@com_github_grpc_grpc_node_packages_grpc_tools_src//:grpc_node_plugin", 6 | visibility = ["//visibility:public"], 7 | ) 8 | 9 | filegroup( 10 | name = "all_files", 11 | testonly = True, 12 | srcs = ["BUILD.bazel"], 13 | visibility = ["//plugin:__pkg__"], 14 | ) 15 | -------------------------------------------------------------------------------- /plugin/grpc/grpc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-grpc-cpp", 5 | tool = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin", 6 | visibility = ["//visibility:public"], 7 | ) 8 | 9 | proto_plugin( 10 | name = "protoc-gen-grpc-python", 11 | tool = "@com_github_grpc_grpc//src/compiler:grpc_python_plugin", 12 | visibility = ["//visibility:public"], 13 | ) 14 | 15 | filegroup( 16 | name = "all_files", 17 | testonly = True, 18 | srcs = ["BUILD.bazel"], 19 | visibility = ["//plugin:__pkg__"], 20 | ) 21 | -------------------------------------------------------------------------------- /plugin/scalapb/zio-grpc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-zio-grpc", 5 | out = "{BIN_DIR}/{PACKAGE}/{PROTO_LIBRARY_BASENAME}_zio_grpc.srcjar", 6 | options = ["flat_package"], 7 | tool = ":zio_grpc_codegen", 8 | use_built_in_shell_environment = True, 9 | visibility = ["//visibility:public"], 10 | ) 11 | 12 | java_binary( 13 | name = "zio_grpc_codegen", 14 | main_class = "scalapb.zio_grpc.ZioCodeGenerator", 15 | visibility = ["//visibility:public"], 16 | runtime_deps = [ 17 | "@maven_zio//:com_thesamet_scalapb_zio_grpc_zio_grpc_codegen_2_12", 18 | ], 19 | ) 20 | 21 | filegroup( 22 | name = "all_files", 23 | testonly = True, 24 | srcs = ["BUILD.bazel"], 25 | visibility = ["//plugin:__pkg__"], 26 | ) 27 | -------------------------------------------------------------------------------- /plugin/stackb/grpc_js/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | 3 | proto_plugin( 4 | name = "protoc-gen-grpc-js", 5 | tool = "@com_github_stackb_grpc_js//protoc-gen-grpc-js", 6 | visibility = ["//visibility:public"], 7 | ) 8 | 9 | filegroup( 10 | name = "all_files", 11 | testonly = True, 12 | srcs = ["BUILD.bazel"], 13 | visibility = ["//plugin:__pkg__"], 14 | ) 15 | -------------------------------------------------------------------------------- /plugin/stephenh/ts-proto/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin") 2 | load("@npm_ts_proto//plugin/stephenh/ts-proto:ts-proto/package_json.bzl", ts_proto = "bin") 3 | 4 | ts_proto.protoc_gen_ts_proto_binary( 5 | name = "ts-proto", 6 | ) 7 | 8 | proto_plugin( 9 | name = "protoc-gen-ts-proto", 10 | tool = ":ts-proto", 11 | visibility = ["//visibility:public"], 12 | ) 13 | 14 | filegroup( 15 | name = "all_files", 16 | srcs = ["BUILD.bazel"], 17 | visibility = ["//plugin:__pkg__"], 18 | ) 19 | -------------------------------------------------------------------------------- /plugin/stephenh/ts-proto/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "ts-proto": "1.156.0" 4 | } 5 | } -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - plugin/stephenh/ts-proto 3 | - plugin/bufbuild -------------------------------------------------------------------------------- /rules/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = glob(["*.bzl"]) + [ 5 | "BUILD.bazel", 6 | "//rules/cc:all_files", 7 | "//rules/closure:all_files", 8 | "//rules/go:all_files", 9 | "//rules/java:all_files", 10 | "//rules/nodejs:all_files", 11 | "//rules/private:all_files", 12 | "//rules/proto:all_files", 13 | "//rules/py:all_files", 14 | "//rules/scala:all_files", 15 | ], 16 | visibility = ["//:__pkg__"], 17 | ) 18 | -------------------------------------------------------------------------------- /rules/cc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "grpc_cc_library.bzl", 7 | "proto_cc_library.bzl", 8 | ], 9 | visibility = ["//rules:__pkg__"], 10 | ) 11 | -------------------------------------------------------------------------------- /rules/cc/grpc_cc_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_cc_library.bzl provides a cc_library for gRPC source files." 2 | 3 | load("@rules_cc//cc:defs.bzl", "cc_library") 4 | 5 | def grpc_cc_library(**kwargs): 6 | cc_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/cc/proto_cc_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_cc_library.bzl provides a cc_library for proto files." 2 | 3 | load("@rules_cc//cc:defs.bzl", "cc_library") 4 | 5 | def proto_cc_library(**kwargs): 6 | cc_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/closure/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "grpc_closure_js_library.bzl", 7 | "proto_closure_js_library.bzl", 8 | ], 9 | visibility = ["//rules:__pkg__"], 10 | ) 11 | -------------------------------------------------------------------------------- /rules/closure/proto_closure_js_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_closure_js_library.bzl provides a closure_js_library for proto files." 2 | 3 | load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") 4 | 5 | def proto_closure_js_library(**kwargs): 6 | suppress = kwargs.pop("suppress", []) 7 | suppress += [ 8 | "JSC_LATE_PROVIDE_ERROR", 9 | "JSC_UNDEFINED_VARIABLE", 10 | "JSC_IMPLICITLY_NULLABLE_JSDOC", 11 | "JSC_STRICT_INEXISTENT_PROPERTY", 12 | "JSC_POSSIBLE_INEXISTENT_PROPERTY", 13 | "JSC_UNRECOGNIZED_TYPE_ERROR", 14 | "JSC_DEPRECATED_PROP_REASON", 15 | "JSC_MISSING_REQUIRE_TYPE_IN_PROVIDES_FILE", 16 | ] 17 | 18 | deps = kwargs.pop("deps", []) 19 | deps.append("@io_bazel_rules_closure//closure/protobuf:jspb") 20 | 21 | closure_js_library( 22 | deps = deps, 23 | suppress = suppress, 24 | **kwargs 25 | ) 26 | -------------------------------------------------------------------------------- /rules/go/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "proto_go_library.bzl", 7 | ], 8 | visibility = ["//rules:__pkg__"], 9 | ) 10 | -------------------------------------------------------------------------------- /rules/go/proto_go_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_go_library.bzl provides a go_library for proto files." 2 | 3 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 4 | 5 | def proto_go_library(**kwargs): 6 | go_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/java/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "grpc_java_library.bzl", 7 | "proto_java_library.bzl", 8 | ], 9 | visibility = ["//rules:__pkg__"], 10 | ) 11 | -------------------------------------------------------------------------------- /rules/java/grpc_java_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_java_library.bzl provides a java_library for grpc files." 2 | 3 | def grpc_java_library(**kwargs): 4 | native.java_library(**kwargs) 5 | -------------------------------------------------------------------------------- /rules/java/proto_java_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_java_library.bzl provides a java_library for proto files." 2 | 3 | def proto_java_library(**kwargs): 4 | native.java_library(**kwargs) 5 | -------------------------------------------------------------------------------- /rules/nodejs/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "grpc_nodejs_library.bzl", 7 | "grpc_web_js_library.bzl", 8 | "proto_nodejs_library.bzl", 9 | ], 10 | visibility = ["//rules:__pkg__"], 11 | ) 12 | -------------------------------------------------------------------------------- /rules/nodejs/grpc_nodejs_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_nodejs_library.bzl provides a js_library for grpc files." 2 | 3 | load("@build_bazel_rules_nodejs//:index.bzl", "js_library") 4 | 5 | def grpc_nodejs_library(**kwargs): 6 | js_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/nodejs/grpc_web_js_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_web_js_library.bzl provides a js_library for grpc files." 2 | 3 | load("@build_bazel_rules_nodejs//:index.bzl", "js_library") 4 | 5 | def grpc_web_js_library(**kwargs): 6 | js_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/nodejs/proto_nodejs_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_nodejs_library.bzl provides a js_library for proto files." 2 | 3 | load("@build_bazel_rules_nodejs//:index.bzl", "js_library") 4 | 5 | def proto_nodejs_library(**kwargs): 6 | js_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/private/BUILD.bazel: -------------------------------------------------------------------------------- 1 | exports_files( 2 | ["list_repository_tools_srcs.go"], 3 | visibility = ["//visibility:public"], 4 | ) 5 | 6 | filegroup( 7 | name = "all_files", 8 | testonly = True, 9 | srcs = [ 10 | "BUILD.bazel", 11 | "execution.bzl", 12 | "list_repository_tools_srcs.go", 13 | "proto_repository_tools.bzl", 14 | "proto_repository_tools_srcs.bzl", 15 | ], 16 | visibility = ["//rules:__pkg__"], 17 | ) 18 | -------------------------------------------------------------------------------- /rules/proto/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "proto_repository.bzl", 7 | ], 8 | visibility = ["//rules:__pkg__"], 9 | ) 10 | -------------------------------------------------------------------------------- /rules/proto_compile_assets.bzl: -------------------------------------------------------------------------------- 1 | "proto_compile_assets.bzl provides the files copy rule." 2 | 3 | load(":proto_compile_gencopy.bzl", "proto_compile_gencopy_run") 4 | 5 | def proto_compile_assets(**kwargs): 6 | """proto_compile_assets copies generated files to the source tree 7 | 8 | Args: 9 | **kwargs: the kwargs macro dict. Should have 'name' and 'deps' attributes. 10 | Deps must provide ProtoCompileInfo. 11 | """ 12 | name = kwargs.pop("name") 13 | deps = kwargs.pop("deps", []) 14 | 15 | proto_compile_gencopy_run( 16 | name = name, 17 | deps = deps, 18 | mode = "update", 19 | update_target_label_name = name, 20 | ) 21 | -------------------------------------------------------------------------------- /rules/proto_compiled_source_update.bzl: -------------------------------------------------------------------------------- 1 | "proto_compiled_source_update.bzl provides the proto_compiled_source_update rule." 2 | 3 | load(":proto_compile_gencopy.bzl", "proto_compile_gencopy_run") 4 | 5 | def proto_compiled_source_update(**kwargs): 6 | name = kwargs.pop("name") 7 | deps = kwargs.pop("deps", []) 8 | name_update = name 9 | 10 | proto_compile_gencopy_run( 11 | name = name_update, 12 | deps = deps, 13 | mode = "update", 14 | update_target_label_name = name, 15 | ) 16 | -------------------------------------------------------------------------------- /rules/proto_descriptor_set.bzl: -------------------------------------------------------------------------------- 1 | "proto_descriptor_set.bzl wraps the proto_descriptor_set rule from @rules_proto." 2 | 3 | load("@rules_proto//proto:defs.bzl", _proto_descriptor_set = "proto_descriptor_set") 4 | 5 | def rules_proto_descriptor_set(**kwargs): 6 | _proto_descriptor_set(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/py/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "grpc_py_library.bzl", 7 | "proto_py_library.bzl", 8 | ], 9 | visibility = ["//rules:__pkg__"], 10 | ) 11 | -------------------------------------------------------------------------------- /rules/py/grpc_py_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_py_library.bzl provides a py_library for grpc files." 2 | 3 | load("@rules_python//python:defs.bzl", "py_library") 4 | 5 | def grpc_py_library(**kwargs): 6 | py_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/py/proto_py_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_py_library.bzl provides a py_library for proto files." 2 | 3 | load("@rules_python//python:defs.bzl", "py_library") 4 | 5 | def proto_py_library(**kwargs): 6 | py_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/scala/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "grpc_scala_library.bzl", 7 | "grpc_zio_scala_library.bzl", 8 | "proto_scala_library.bzl", 9 | "scala_proto_library.bzl", 10 | ], 11 | visibility = ["//rules:__pkg__"], 12 | ) 13 | -------------------------------------------------------------------------------- /rules/scala/grpc_scala_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_scala_library.bzl provides a scala_library for grpc files." 2 | 3 | load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") 4 | 5 | def grpc_scala_library(**kwargs): 6 | scala_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/scala/grpc_zio_scala_library.bzl: -------------------------------------------------------------------------------- 1 | "grpc_zio_scala_library.bzl provides a scala_library for grpc files." 2 | 3 | load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") 4 | 5 | def grpc_zio_scala_library(**kwargs): 6 | scala_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/scala/proto_scala_library.bzl: -------------------------------------------------------------------------------- 1 | "proto_scala_library.bzl provides a scala_library for proto files." 2 | 3 | load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") 4 | 5 | def proto_scala_library(**kwargs): 6 | scala_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/scala/scala_proto_library.bzl: -------------------------------------------------------------------------------- 1 | "scala_proto_library.bzl is a thin wrapper for @io_bazel_rules_scala//scala:scala_proto.bzl%scala_proto_library." 2 | 3 | load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", _scala_proto_library = "scala_proto_library") 4 | 5 | def scala_proto_library(**kwargs): 6 | _scala_proto_library(**kwargs) 7 | -------------------------------------------------------------------------------- /rules/ts/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/rules/ts/BUILD.bazel -------------------------------------------------------------------------------- /third_party/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "all_files", 3 | testonly = True, 4 | srcs = [ 5 | "BUILD.bazel", 6 | "bazel-gazelle-revert-1152.patch", 7 | "zlib.BUILD", 8 | ], 9 | visibility = ["//:__pkg__"], 10 | ) 11 | 12 | exports_files([ 13 | "bazel-gazelle-revert-1152.patch", 14 | ]) 15 | -------------------------------------------------------------------------------- /third_party/bazel-gazelle-revert-1152.patch: -------------------------------------------------------------------------------- 1 | diff --git a/language/proto/generate.go b/language/proto/generate.go 2 | index 725597e..cf09cbe 100644 3 | --- a/language/proto/generate.go 4 | +++ b/language/proto/generate.go 5 | @@ -235,11 +235,6 @@ func generateProto(pc *ProtoConfig, rel string, pkg *Package, shouldSetVisibilit 6 | r.SetPrivateAttr(PackageKey, *pkg) 7 | imports := make([]string, 0, len(pkg.Imports)) 8 | for i := range pkg.Imports { 9 | - // If the proto import is a self import (an import between the same package), skip it 10 | - if _, ok := pkg.Files[path.Base(i)]; ok && getPrefix(pc, path.Dir(i)) == getPrefix(pc, rel) { 11 | - delete(pkg.Imports, i) 12 | - continue 13 | - } 14 | imports = append(imports, i) 15 | } 16 | sort.Strings(imports) 17 | -------------------------------------------------------------------------------- /toolchain/toolchain.bzl: -------------------------------------------------------------------------------- 1 | "toolchain.bzl provides the protoc toolchain rule" 2 | 3 | def _protoc_impl(ctx): 4 | return [platform_common.ToolchainInfo( 5 | protoc_target = ctx.attr.tool, 6 | protoc_executable = ctx.executable.tool, 7 | )] 8 | 9 | protoc = rule( 10 | implementation = _protoc_impl, 11 | attrs = { 12 | "tool": attr.label( 13 | doc = "The protocol compiler tool", 14 | allow_single_file = True, 15 | executable = True, 16 | cfg = "exec", 17 | ), 18 | }, 19 | provides = [platform_common.ToolchainInfo], 20 | ) 21 | -------------------------------------------------------------------------------- /vendor/github.com/bazelbuild/bazel-gazelle/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of authors for copyright purposes. 2 | # Names should be added to this file as: 3 | # Name or Organization 4 | # The email address is not required for organizations. 5 | 6 | Andy Hochhaus 7 | Antoine Pelisse 8 | GinFungYJF <645116215@qq.com> 9 | Google Inc. 10 | Improbable Worlds Ltd 11 | Jeff Hodges 12 | John Millikin 13 | Melinda Lu 14 | Peter McAlpine 15 | RS 16 | Rodrigo Queiro 17 | Tom Payne 18 | Yuki Yugui Sonoda 19 | -------------------------------------------------------------------------------- /vendor/github.com/bazelbuild/bazel-gazelle/language/proto/fix.go: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The Bazel Authors. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package proto 17 | 18 | import ( 19 | "github.com/bazelbuild/bazel-gazelle/config" 20 | "github.com/bazelbuild/bazel-gazelle/rule" 21 | ) 22 | 23 | func (*protoLang) Fix(c *config.Config, f *rule.File) { 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/bazelbuild/buildtools/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # People who have agreed to one of the CLAs and can contribute patches. 2 | # The AUTHORS file lists the copyright holders; this file 3 | # lists people. For example, Google employees are listed here 4 | # but not in AUTHORS, because Google holds the copyright. 5 | # 6 | # https://developers.google.com/open-source/cla/individual 7 | # https://developers.google.com/open-source/cla/corporate 8 | # 9 | # Names should be added to this file as: 10 | # Name 11 | Paul Bethe 12 | Russ Cox 13 | Laurent Le Brun 14 | Justine Alexandra Roberts Tunney 15 | Nilton Volpato 16 | Matthew C Brown 17 | -------------------------------------------------------------------------------- /vendor/github.com/bazelbuild/rules_go/AUTHORS: -------------------------------------------------------------------------------- 1 | # This the official list of Bazel authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as: 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | Benjamin Staffin 10 | Brian Silverman 11 | David Santiago 12 | Google Inc. 13 | Jake Voytko 14 | Yuki Yugui Sonoda 15 | -------------------------------------------------------------------------------- /vendor/github.com/bazelbuild/rules_go/go/tools/bazel/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackb/rules_proto/3b147a8ef41e49ae6524a938c4c187e8acf004e2/vendor/github.com/bazelbuild/rules_go/go/tools/bazel/empty.txt -------------------------------------------------------------------------------- /vendor/github.com/bmatcuk/doublestar/.gitignore: -------------------------------------------------------------------------------- 1 | # vi 2 | *~ 3 | *.swp 4 | *.swo 5 | 6 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 7 | *.o 8 | *.a 9 | *.so 10 | 11 | # Folders 12 | _obj 13 | _test 14 | 15 | # Architecture specific extensions/prefixes 16 | *.[568vq] 17 | [568vq].out 18 | 19 | *.cgo1.go 20 | *.cgo2.c 21 | _cgo_defun.c 22 | _cgo_gotypes.go 23 | _cgo_export.* 24 | 25 | _testmain.go 26 | 27 | *.exe 28 | *.test 29 | *.prof 30 | 31 | # test directory 32 | test/ 33 | -------------------------------------------------------------------------------- /vendor/github.com/bmatcuk/doublestar/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.12 5 | - 1.13 6 | - 1.14 7 | 8 | os: 9 | - linux 10 | - windows 11 | 12 | before_install: 13 | - go get -t -v ./... 14 | 15 | script: 16 | - go test -race -coverprofile=coverage.txt -covermode=atomic 17 | 18 | after_success: 19 | - bash <(curl -s https://codecov.io/bash) 20 | 21 | -------------------------------------------------------------------------------- /vendor/github.com/bmatcuk/doublestar/v4/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | threshold: 1% 6 | patch: 7 | default: 8 | target: 70% 9 | ignore: 10 | - globoptions.go 11 | -------------------------------------------------------------------------------- /vendor/github.com/bmatcuk/doublestar/v4/.gitignore: -------------------------------------------------------------------------------- 1 | # vi 2 | *~ 3 | *.swp 4 | *.swo 5 | 6 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 7 | *.o 8 | *.a 9 | *.so 10 | 11 | # Folders 12 | _obj 13 | _test 14 | 15 | # Architecture specific extensions/prefixes 16 | *.[568vq] 17 | [568vq].out 18 | 19 | *.cgo1.go 20 | *.cgo2.c 21 | _cgo_defun.c 22 | _cgo_gotypes.go 23 | _cgo_export.* 24 | 25 | _testmain.go 26 | 27 | *.exe 28 | *.test 29 | *.prof 30 | 31 | # test directory 32 | test/ 33 | -------------------------------------------------------------------------------- /vendor/github.com/bmatcuk/doublestar/v4/doublestar.go: -------------------------------------------------------------------------------- 1 | package doublestar 2 | 3 | import ( 4 | "errors" 5 | "path" 6 | ) 7 | 8 | // ErrBadPattern indicates a pattern was malformed. 9 | var ErrBadPattern = path.ErrBadPattern 10 | 11 | // ErrPatternNotExist indicates that the pattern passed to Glob, GlobWalk, or 12 | // FilepathGlob references a path that does not exist. 13 | var ErrPatternNotExist = errors.New("pattern does not exist") 14 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/emicklei/proto/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | /.tmp/ 3 | /.vscode/ 4 | /bin/ 5 | debug.test 6 | .DS_Store 7 | coverage.txt 8 | -------------------------------------------------------------------------------- /vendor/github.com/emicklei/proto/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.12.x 4 | script: 5 | - make 6 | after_success: 7 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !cmp_debug 6 | // +build !cmp_debug 7 | 8 | package diff 9 | 10 | var debug debugger 11 | 12 | type debugger struct{} 13 | 14 | func (debugger) Begin(_, _ int, f EqualFunc, _, _ *EditScript) EqualFunc { 15 | return f 16 | } 17 | func (debugger) Update() {} 18 | func (debugger) Finish() {} 19 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flags 6 | 7 | // Deterministic controls whether the output of Diff should be deterministic. 8 | // This is only used for testing. 9 | var Deterministic bool 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package value 6 | 7 | import ( 8 | "reflect" 9 | "unsafe" 10 | ) 11 | 12 | // Pointer is an opaque typed pointer and is guaranteed to be comparable. 13 | type Pointer struct { 14 | p unsafe.Pointer 15 | t reflect.Type 16 | } 17 | 18 | // PointerOf returns a Pointer from v, which must be a 19 | // reflect.Ptr, reflect.Slice, or reflect.Map. 20 | func PointerOf(v reflect.Value) Pointer { 21 | // The proper representation of a pointer is unsafe.Pointer, 22 | // which is necessary if the GC ever uses a moving collector. 23 | return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} 24 | } 25 | 26 | // IsNil reports whether the pointer is nil. 27 | func (p Pointer) IsNil() bool { 28 | return p.p == nil 29 | } 30 | 31 | // Uintptr returns the pointer as a uintptr. 32 | func (p Pointer) Uintptr() uintptr { 33 | return uintptr(p.p) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go: -------------------------------------------------------------------------------- 1 | //go:build go1.17 2 | // +build go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_legacy.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Wrapper around reflect.Value.CanConvert, for compatibility 13 | // reasons. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return value.CanConvert(to) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.17 2 | // +build !go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_can_convert.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Older versions of Go does not have the reflect.Value.CanConvert 13 | // method. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return false 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" 17 | -------------------------------------------------------------------------------- /vendor/go.starlark.net/starlark/empty.s: -------------------------------------------------------------------------------- 1 | // The presence of this file allows the package to use the 2 | // "go:linkname" hack to call non-exported functions in the 3 | // Go runtime, such as hardware-accelerated string hashing. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sync/errgroup/go120.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.20 6 | 7 | package errgroup 8 | 9 | import "context" 10 | 11 | func withCancelCause(parent context.Context) (context.Context, func(error)) { 12 | return context.WithCancelCause(parent) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sync/errgroup/pre_go120.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.20 6 | 7 | package errgroup 8 | 9 | import "context" 10 | 11 | func withCancelCause(parent context.Context) (context.Context, func(error)) { 12 | ctx, cancel := context.WithCancel(parent) 13 | return ctx, func(error) { cancel() } 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/execabs/execabs_go118.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.19 6 | 7 | package execabs 8 | 9 | import "os/exec" 10 | 11 | func isGo119ErrDot(err error) bool { 12 | return false 13 | } 14 | 15 | func isGo119ErrFieldSet(cmd *exec.Cmd) bool { 16 | return false 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/execabs/execabs_go119.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.19 6 | 7 | package execabs 8 | 9 | import ( 10 | "errors" 11 | "os/exec" 12 | ) 13 | 14 | func isGo119ErrDot(err error) bool { 15 | return errors.Is(err, exec.ErrDot) 16 | } 17 | 18 | func isGo119ErrFieldSet(cmd *exec.Cmd) bool { 19 | return cmd.Err != nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | type Signal = syscall.Signal 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 11 | // 12 | 13 | TEXT ·syscall6(SB),NOSPLIT,$0-88 14 | JMP syscall·syscall6(SB) 15 | 16 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSyscall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for 386 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-28 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for AMD64 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for ARM BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-28 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 21 | B syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 24 | B syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 27 | B syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for ARM64 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ppc64, BSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for RISCV64 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for mips64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | HCI_CHANNEL_LOGGING = 4 27 | ) 28 | 29 | // Socketoption Level 30 | const ( 31 | SOL_BLUETOOTH = 0x112 32 | SOL_HCI = 0x0 33 | SOL_L2CAP = 0x6 34 | SOL_RFCOMM = 0x12 35 | SOL_SCO = 0x11 36 | ) 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix && ppc 6 | 7 | // Functions to access/create device major and minor numbers matching the 8 | // encoding used by AIX. 9 | 10 | package unix 11 | 12 | // Major returns the major component of a Linux device number. 13 | func Major(dev uint64) uint32 { 14 | return uint32((dev >> 16) & 0xffff) 15 | } 16 | 17 | // Minor returns the minor component of a Linux device number. 18 | func Minor(dev uint64) uint32 { 19 | return uint32(dev & 0xffff) 20 | } 21 | 22 | // Mkdev returns a Linux device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | return uint64(((major) << 16) | (minor)) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix && ppc64 6 | 7 | // Functions to access/create device major and minor numbers matching the 8 | // encoding used AIX. 9 | 10 | package unix 11 | 12 | // Major returns the major component of a Linux device number. 13 | func Major(dev uint64) uint32 { 14 | return uint32((dev & 0x3fffffff00000000) >> 32) 15 | } 16 | 17 | // Minor returns the minor component of a Linux device number. 18 | func Minor(dev uint64) uint32 { 19 | return uint32((dev & 0x00000000ffffffff) >> 0) 20 | } 21 | 22 | // Mkdev returns a Linux device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | var DEVNO64 uint64 26 | DEVNO64 = 0x8000000000000000 27 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_zos.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build zos && s390x 6 | 7 | // Functions to access/create device major and minor numbers matching the 8 | // encoding used by z/OS. 9 | // 10 | // The information below is extracted and adapted from macros. 11 | 12 | package unix 13 | 14 | // Major returns the major component of a z/OS device number. 15 | func Major(dev uint64) uint32 { 16 | return uint32((dev >> 16) & 0x0000FFFF) 17 | } 18 | 19 | // Minor returns the minor component of a z/OS device number. 20 | func Minor(dev uint64) uint32 { 21 | return uint32(dev & 0x0000FFFF) 22 | } 23 | 24 | // Mkdev returns a z/OS device number generated from the given major and minor 25 | // components. 26 | func Mkdev(major, minor uint32) uint64 { 27 | return (uint64(major) << 16) | uint64(minor) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | 20 | // FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command. 21 | func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error { 22 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore)))) 23 | return err 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fdset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | 7 | package unix 8 | 9 | // Set adds fd to the set fds. 10 | func (fds *FdSet) Set(fd int) { 11 | fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS)) 12 | } 13 | 14 | // Clear removes fd from the set fds. 15 | func (fds *FdSet) Clear(fd int) { 16 | fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS)) 17 | } 18 | 19 | // IsSet returns whether fd is in the set fds. 20 | func (fds *FdSet) IsSet(fd int) bool { 21 | return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 0 22 | } 23 | 24 | // Zero clears the set fds. 25 | func (fds *FdSet) Zero() { 26 | for i := range fds.Bits { 27 | fds.Bits[i] = 0 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gccgo && linux && amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mmap_nomremap.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || openbsd || solaris 6 | 7 | package unix 8 | 9 | var mapper = &mmapper{ 10 | active: make(map[*byte][]byte), 11 | mmap: mmap, 12 | munmap: munmap, 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ptrace_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && !ios 6 | 7 | package unix 8 | 9 | func ptrace(request int, pid int, addr uintptr, data uintptr) error { 10 | return ptrace1(request, pid, addr, data) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ptrace_ios.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ios 6 | 7 | package unix 8 | 9 | func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { 10 | return ENOTSUP 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin && race) || (linux && race) || (freebsd && race) 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdents.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd 6 | 7 | package unix 8 | 9 | // ReadDirent reads directory entries from fd and writes them into buf. 10 | func ReadDirent(fd int, buf []byte) (n int, err error) { 11 | return Getdents(fd, buf) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdirentries.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // ReadDirent reads directory entries from fd and writes them into buf. 12 | func ReadDirent(fd int, buf []byte) (n int, err error) { 13 | // Final argument is (basep *uintptr) and the syscall doesn't take nil. 14 | // 64 bits should be enough. (32 bits isn't even on 386). Since the 15 | // actual system call is getdirentries64, 64 is a good guess. 16 | // TODO(rsc): Can we use a single global basep for all calls? 17 | var base = (*uintptr)(unsafe.Pointer(new(uint64))) 18 | return Getdirentries(fd, buf, base) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | // Round the length of a raw sockaddr up to align it properly. 8 | func cmsgAlignOf(salen int) int { 9 | salign := SizeofPtr 10 | if SizeofPtr == 8 && !supportsABI(_dragonflyABIChangeVersion) { 11 | // 64-bit Dragonfly before the September 2019 ABI changes still requires 12 | // 32-bit aligned access to network subsystem. 13 | salign = 4 14 | } 15 | return (salen + salign - 1) & ^(salign - 1) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_hurd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build hurd 6 | 7 | package unix 8 | 9 | /* 10 | #include 11 | int ioctl(int, unsigned long int, uintptr_t); 12 | */ 13 | import "C" 14 | 15 | func ioctl(fd int, req uint, arg uintptr) (err error) { 16 | r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg)) 17 | if r0 == -1 && er != nil { 18 | err = er 19 | } 20 | return 21 | } 22 | 23 | func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { 24 | r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(uintptr(arg))) 25 | if r0 == -1 && er != nil { 26 | err = er 27 | } 28 | return 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_hurd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 && hurd 6 | 7 | package unix 8 | 9 | const ( 10 | TIOCGETA = 0x62251713 11 | ) 12 | 13 | type Winsize struct { 14 | Row uint16 15 | Col uint16 16 | Xpixel uint16 17 | Ypixel uint16 18 | } 19 | 20 | type Termios struct { 21 | Iflag uint32 22 | Oflag uint32 23 | Cflag uint32 24 | Lflag uint32 25 | Cc [20]uint8 26 | Ispeed int32 27 | Ospeed int32 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_alarm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64) 6 | 7 | package unix 8 | 9 | // SYS_ALARM is not defined on arm or riscv, but is available for other GOARCH 10 | // values. 11 | 12 | //sys Alarm(seconds uint) (remaining uint, err error) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && linux && gc 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //go:noescape 12 | func gettimeofday(tv *Timeval) (err syscall.Errno) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gc 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gc && 386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && gc && linux 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gccgo && arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (msghdr *Msghdr) SetIovlen(length int) { 22 | msghdr.Iovlen = int32(length) 23 | } 24 | 25 | func (cmsg *Cmsghdr) SetLen(length int) { 26 | cmsg.Len = uint32(length) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 12 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (ppc64le || ppc64) && gc 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 12 | return syscall.Syscall(trap, a1, a2, a3) 13 | } 14 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 15 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 16 | } 17 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | return syscall.RawSyscall(trap, a1, a2, a3) 19 | } 20 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 21 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sysvshm_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // SysvShmCtl performs control operations on the shared memory segment 12 | // specified by id. 13 | func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { 14 | if runtime.GOARCH == "arm" || 15 | runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { 16 | cmd |= ipc_64 17 | } 18 | 19 | return shmctl(id, cmd, desc) 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sysvshm_unix_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && !ios 6 | 7 | package unix 8 | 9 | // SysvShmCtl performs control operations on the shared memory segment 10 | // specified by id. 11 | func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { 12 | return shmctl(id, cmd, desc) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtraceRegSet("arm64"). DO NOT EDIT. 2 | 3 | package unix 4 | 5 | import "unsafe" 6 | 7 | // PtraceGetRegSetArm64 fetches the registers used by arm64 binaries. 8 | func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error { 9 | iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))} 10 | return ptracePtr(PTRACE_GETREGSET, pid, uintptr(addr), unsafe.Pointer(&iovec)) 11 | } 12 | 13 | // PtraceSetRegSetArm64 sets the registers used by arm64 binaries. 14 | func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error { 15 | iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))} 16 | return ptracePtr(PTRACE_SETREGSET, pid, uintptr(addr), unsafe.Pointer(&iovec)) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | --------------------------------------------------------------------------------