Commit Graph

87 Commits

Author SHA1 Message Date
Paul Stemmet bfe04468f3
internal: ensure proto_compile copies files not links
at least in bazel 7.2, this leads to dangling symlink issues, and
the remote cache complains about absolute symlinks.
2024-09-27 17:14:40 +00:00
Adam Liddell f2cc8a3369 Align rulegen and buildifier 2023-09-08 12:20:17 +01:00
Adam Liddell 284f8985ff Fix incorrectly merged line... 2023-09-08 11:46:22 +01:00
Adam Liddell 6d0eadd0ab
Merge branch 'master' into rust-prost-tonic 2023-09-08 11:44:10 +01:00
Adam Liddell 79d04faea1
Apply buildifier 2023-09-07 15:36:13 +01:00
Dirk Müller c17fe86581 Provide a path conversion from snake_case to dashed-case 2023-09-07 15:19:15 +01:00
Jonathan Rudenberg 0830cf211c Replace rust rules with new prost and tonic rules 2023-06-05 22:28:40 -07:00
Adam Liddell b4bc48d312
Merge pull request #253 from danny-skydio/master
Fix capitalization on Objective-C outputs containing digits
2023-05-03 12:43:44 +01:00
danny 092451c918 Fix capitalization on Objective-C outputs
The function in objectivec_helpers.cc also splits segments if they come
after a digit, which wasn't being handled correctly.

e.g. vector_3f -> Vector3F

This sadly makes this function a lot more complicated. I naively
transliterated the function, so I have no doubt that this could be
improved. I'd be slightly concerned about starlark performance if you
were using this for some absurd number of types.
2023-04-05 17:01:22 -07:00
Adam Liddell ce4d886ea6
Merge pull request #247 from gonzojive/bzl-library
Add bzl_library build targets.
2023-03-05 23:01:00 +00:00
Red Daly 1ff4d46b8d Add bzl_library build targets.
The targets seem to be required for using "stardoc_with_diff_test" in
rules_ts_proto.
2023-01-31 21:13:09 -08:00
Adam Liddell d7b0490501 Apply buildifier 2023-01-15 23:28:12 +00:00
Adam Liddell c064d11050 Add args.use_param_file, closes #241 2023-01-15 23:16:10 +00:00
Adam Liddell fbd914b6a2 Apply buildifier 2022-12-04 22:35:50 +00:00
Adam Liddell 41e64b0247 Source protoc plugin env from the proto_plugin env attr
This attr was previously ignored. To support the requirement of
providing a dynamic bindir env var, the template variable
{bindir} is available
2022-12-04 22:32:48 +00:00
Adam Liddell d9c51d210d Add env attr to docs for proto_plugin 2022-12-04 22:15:30 +00:00
Adam Liddell ecdc994462
Fix my bad merge 2022-12-04 22:08:18 +00:00
Adam Liddell 5f3a435c2b
Merge branch 'dev' into customize-env 2022-12-04 22:02:54 +00:00
Adam Liddell 71b47729cd Improve custom plugins docs 2022-12-04 21:52:01 +00:00
Adam Liddell b5c64a09dc Apply buildifier 2022-12-01 22:13:20 +00:00
Adam Liddell aed1a01df3 Rename var 2022-12-01 21:53:45 +00:00
Adam Liddell 339b5370f3 Forward all Bazel common attrs in library macros
Closes #218
2022-12-01 21:45:56 +00:00
Adam Liddell c0779536d2 Apply fix for paths containing special chars from #228 2022-11-30 22:17:01 +00:00
Red Daly b9e6b2922d Allow greater customization of environment variables by plugins.
* Add an "env" property to ProtoPluginInfo that contains an environment variable
  dictionary.

* Add a corresponding "env" attribute to the the proto_plugin rule.

* For cases where environment variables must specified based on ctx, as
  described in https://github.com/bazelbuild/bazel/issues/15470 and
  https://github.com/aspect-build/rules_js/issues/397, modify proto_compile_impl
  and proto_compile to accept a base_env dictionary argument. Example usage is
  below:

```starlark

def _ts_proto_compile_impl(ctx):
    """
    Implementation function for ts_proto_compile.

    Args:
        ctx: The Bazel rule execution context object.

    Returns:
        Providers:
            - ProtoCompileInfo
            - DefaultInfo

    """
    base_env = {
        # Make up for https://github.com/bazelbuild/bazel/issues/15470.
        "BAZEL_BINDIR": ctx.bin_dir.path,
    }
    return proto_compile_impl(ctx, base_env = base_env)

ts_proto_compile = rule(
    implementation = _ts_proto_compile_impl,
    attrs = dict(
        proto_compile_attrs,
        _plugins = attr.label_list(
            providers = [ProtoPluginInfo],
            default = [
                Label("//bazel/web/targets:ts_proto_compile"),
            ],
            doc = "List of protoc plugins to apply",
        ),
    ),
    toolchains = [
        str(Label("@rules_proto_grpc//protobuf:toolchain_type")),
    ],
)
```

```starlark
load("@npm//:ts-proto/package_json.bzl", _ts_proto_bin_factories = "bin")
load("@rules_proto_grpc//:defs.bzl", "proto_plugin")

_ts_proto_bin_factories.protoc_gen_ts_proto_binary(
    name = "protoc-gen-ts-proto",
)

proto_plugin(
    name = "ts_proto_compile",
    outputs = ["{protopath}.ts"],
    protoc_plugin_name = "ts_proto",
    tool = "//bazel/web/targets:protoc-gen-ts-proto",
    use_built_in_shell_environment = False,
    visibility = ["//visibility:public"],
)
```
2022-11-19 13:41:24 -08:00
Adam Liddell 20fe8d869c
Merge pull request #213 from thefallentree/patch-1
make sure destination directory exists when copying output
2022-08-23 22:12:52 +00:00
Yucong Sun 342b8b7520
Update compile.bzl 2022-08-14 22:15:40 -07:00
Yucong Sun ce65fc8701
make sure destination directory exists when copying output 2022-08-14 21:31:50 -07:00
Adam Liddell e75d48555b Merge branch 'dev' of github.com:rules-proto-grpc/rules_proto_grpc into python-output-mode-package-root 2022-04-24 00:56:02 +01:00
Neil Isaac 0989b36c9f
Merge branch 'master' into python-output-mode-package-root 2022-04-12 09:45:03 -04:00
Adam Liddell bd67159410
Merge pull request #182 from jesseschalken/patch-2
Set use_built_in_shell_environment default to True
2022-03-27 21:38:22 +01:00
Jesse Schalken 65d1b6297f
Set use_built_in_shell_environment default to True
This is required for a protoc compiled with MinGW, which has a dependency on C:\msys64\mingw64\bin\libstdc++-6.dll and thus requires C:\msys64\mingw64\bin to be in the PATH.
2022-03-14 12:18:55 +11:00
Dimitris Koutsogiorgas 3330e15acb [ObjC] Properly handle protos with dashes in their filenames. 2022-02-13 11:44:37 -08:00
Adam Liddell 4b7a0e70db Add provider doc strings 2021-11-28 22:32:25 +00:00
neilisaac f3b8ad878c Add output_mode NO_PREFIX_FLAT to output files directly in the current package without mirroring the package tree 2021-11-12 02:11:31 +00:00
Adam Liddell 3a3a8837b7 Apply buildifier 2021-10-04 14:41:39 +01:00
Adam Liddell 347830932e Fix plugin options attr being ignored 2021-10-04 14:30:14 +01:00
Adam Liddell 28537b2f69 Improve docstrings 2021-09-21 10:04:35 +01:00
Adam Liddell eb9cd331f7 Add output_mode attr to select where files are written to 2021-09-21 00:39:44 +01:00
Adam Liddell d143d46d42 Add doc_template_compile, closes #121 2021-09-21 00:20:19 +01:00
Adam Liddell dc306425db Apply buildifier 2021-09-17 18:54:58 +00:00
Adam Liddell 8d09a4d73e Drop transitive aspect-based compilation. Closes #137 2021-09-17 18:25:48 +00:00
Adam Liddell 9bf9c3be8a Update transitivity link 2021-04-05 23:59:23 +00:00
Adam Liddell 51ed584b75 Update transitivity docs link 2021-04-05 21:05:17 +00:00
Adam Liddell 61a5d192ba Reshuffle doc file locations 2021-04-05 20:47:00 +00:00
Adam Liddell 92d4f039e7 Restructure docs 2021-04-05 19:54:37 +00:00
Adam Liddell e541af70de Disable tool resolution with Buf 2021-03-02 23:35:05 +00:00
Adam Liddell 863e63888c Revert removing resolve_tools 2021-03-02 23:26:03 +00:00
Adam Liddell 4cbbbe3d32 Add Buf lint and breaking rules 2021-03-02 23:11:51 +00:00
Adam Liddell a94d4c3b85 Remove resolve_tools and support short paths 2021-02-28 22:57:02 +00:00
Adam Liddell 8dda9a424f Return list of args rather than args object 2021-02-28 22:02:15 +00:00