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

Generated files base directory should be exposed as public property or at least a provider #722

Open
grossws opened this issue Jul 13, 2023 · 2 comments

Comments

@grossws
Copy link

grossws commented Jul 13, 2023

The com.google.protobuf plugin (as of version 0.9.3) has ProtobufExtension#getGeneratedFilesBaseDirProperty method with @PackageScope. This prevents at least Kotlin DSL users from modifying this directory except via deprecated setter method.

I would expect this method to be public and return DirectoryProperty (or Provider<Directory> if you intend to prevent modification). To allow user to address its subdirectories.

Also the plugin use generated/source/proto/<sourceSet> instead of more conventional generated/sources/proto/<sourceSet> (word sources in plural) alongside annotation processors output.

I currently have 3 cases where I want to access this property:

  • to mark relevant directories as generated sources in the IDE
  • to add them to the sources jar
  • to place them under generated/sources/
@grossws grossws changed the title Generated files base directory should be exposed as public property Generated files base directory should be exposed as public property or at least a provider Jul 13, 2023
@grossws
Copy link
Author

grossws commented Jul 13, 2023

Looking at #33 and #636 I could guess that users (ab)used this parameter to put generated files under <projectDir>/src/ so I totally understand reluctance to expose it as a property but Provider<Directory> would still be safe in that case.

@ejona86
Copy link
Collaborator

ejona86 commented Jul 13, 2023

What's needed here is a new property completely separate from that old thing. The new thing would clear the directory before generating output. Also, as we see below, maybe this doesn't need configuration to change the output dir.

to mark relevant directories as generated sources in the IDE

This should be addressed by adding the idle or eclipse plugins to your build. That is detected by this plugin to eagerly create the tasks and eagerly create the directories. That's the biggest issue with the IDEs: they expect the source directories to exist before the tasks are run.

to add them to the sources jar

#714 may fix that, since we're actually about to use source sets for Kotlin now. You might not to do anything after the next release.

to place them under generated/sources/

That's just a change to the plugin. The plugin is quite old, so may actually predate that convention.

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

No branches or pull requests

2 participants