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

Intellij source folder should be marked as generated #222

Closed
dcabasson opened this issue Apr 17, 2018 · 10 comments
Closed

Intellij source folder should be marked as generated #222

dcabasson opened this issue Apr 17, 2018 · 10 comments

Comments

@dcabasson
Copy link
Contributor

Currently source folders in the Intellij configuration are not set as generated :
<sourceFolder url="file://$MODULE_DIR$/src/generated-sources/main/java" isTestSource="false"/>

See https://www.jetbrains.com/help/idea/creating-and-managing-modules.html#folder-categories for context

@dcabasson
Copy link
Contributor Author

I guess this is why you have a TODO in the code :
// TODO(zpencer): switch to model.module.generatedSourceDirs when that API becomes stable

@pgelinas
Copy link

Yeah, that is still marked as "incubating" in the gradle doc. Simple workaround is add it yourself in your gradle build:

def generatedJava = file("${protobuf.generatedFilesBaseDir}/main/java")
def generatedGrpc = file("${protobuf.generatedFilesBaseDir}/main/grpc")
idea {
    module {
        generatedSourceDirs += generatedJava
        generatedSourceDirs += generatedGrpc
    }
}

image

@zpencer
Copy link
Contributor

zpencer commented Jun 6, 2018

Right, the only reason they are not marked as generated is because that API is unstable. Out of curiosity, is this causing any issues for your IDE workflow?

@saturnism
Copy link

quick ping on this issue. having to mark individual source folders is difficult for a large project w/ multiple proto sources.

@timothybasanov
Copy link

Would it be possible to add an option to protobuf plugin to optionally use this incubating API?
Incorrectly marked source folders make it harder to navigate bigger projects.

@timothybasanov
Copy link

@zpencer: As of Gradle 5.0 this is no longer an incubating API, would you consider checking Gradle version and switching to generated sources?
https://docs.gradle.org/5.0/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html#org.gradle.plugins.ide.idea.model.IdeaModule:generatedSourceDirs

As for UI reasons, it does not break anything per se, but generated sources are shown/sorted differently in UI. It makes it easier to distinguish between "real" application code and "generated".

@zpencer
Copy link
Contributor

zpencer commented Jul 16, 2019

I don't have cycles to work on this plugin at the moment but PRs are welcome as usual :)

@timothybasanov
Copy link

@zpencer Would it be ok to just enable it? Or do you want me to check Gradle version and only enable it if 5.x is detected?

@zpencer
Copy link
Contributor

zpencer commented Jul 17, 2019

I think the safest way is to make sure the gradle version is at least 5.0. There may be users of the plugin at lower versions.

@voidzcy
Copy link
Collaborator

voidzcy commented May 6, 2021

Closing, this should have been fixed by #477.

@voidzcy voidzcy closed this as completed May 6, 2021
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

6 participants