Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protobufExcludeFilters #175

Merged
merged 1 commit into from
Mar 5, 2024
Merged

protobufExcludeFilters #175

merged 1 commit into from
Mar 5, 2024

Conversation

eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Mar 5, 2024

Fixes #98

Problem

When compiling complex protobuf schema, you often
run into a situation where you need some external
schema during the compilation, but you don't
necessarily want to include the resulting Java
output as your own output because there's already
a precompiled or well-known bytecode version of
the class.
A good example of this is classes under com/google/protobuf, but there are others as well.

In theory #29 has added excludeFilter support,
but in practice sbt's file filter doesn't work
for directory name matching.

Solution

This reimplements the protobuf file filtering
using the new Glob, which can match directory names.

As a demonstration, protobufExcludeFilters is
initialized to glob Glob(d.toPath()) / "google" / "protobuf" / "*.proto". This will filter out protobuf sources which
are precompiled in "com.google.protobuf" % "protobuf-java".

**Problem**
When compiling complex protobuf schema, you often
run into a situation where you need some external
schema during the compilation, but you don't
necessarily want to include the resulting Java
output as your own output because there's already
a precompiled or well-known bytecode version of
the class.
A good example of this is classes under com/google/protobuf,
but there are others as well.

In theory sbt#29 has added excludeFilter support,
but in practice sbt's file filter doesn't work
for directory name matching.

**Solution**
This reimplements the protobuf file filtering
using the new Glob, which can match directory names.

As a demonstration, `protobufExcludeFilters` is
initialized to glob `Glob(d.toPath()) / "google" / "protobuf" / "*.proto"`.
This will filter out protobuf sources which
are precompiled in "com.google.protobuf" % "protobuf-java".
@eed3si9n eed3si9n requested a review from xuwei-k as a code owner March 5, 2024 08:33
@eed3si9n eed3si9n requested a review from adpi2 March 5, 2024 16:03
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

LGTM

@eed3si9n eed3si9n merged commit ae22aa1 into sbt:main Mar 5, 2024
4 checks passed
@eed3si9n eed3si9n deleted the wip/exclude3 branch March 5, 2024 17:19
@eed3si9n eed3si9n added this to the 0.8.0 milestone Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add protobufExcludePaths setting key
2 participants