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

generatedFileDir does not follow Gradle Java Plugin conventions (nor can you) #16

Closed
Xorlev opened this issue May 29, 2015 · 8 comments
Closed

Comments

@Xorlev
Copy link

Xorlev commented May 29, 2015

In the plugin, generatedSourceDir is always set to ${generatedSourceDir}/${sourceSet.name}.

Given generatedFileDir = "${projectDir}/src", this dumps the compiled sources into subproject/src/main/com/test vs. a more canonical subproject/src/main/java/com/test. Since the sourceSet.name is always appended to the generatedFileDir, there's no good way to get the latter behavior.

The default behavior of the Java Plugin would be ${project.projectDir}/src/${sourceSet.name}/java

I'm afraid I'm not familiar enough with Gradle internals to suggest a better solution, but I'd almost rather just be able to say generatedFileDir = "${projectDir}/src/main/java and not worry about the sourceSet name.

@zhangkun83
Copy link
Collaborator

This is a duplicate of #13. I think it makes sense to let java_out to be ${project.projectDir}/src/${sourceSet.name}/java.

Then javanano_out to be ${project.projectDir}/src/${sourceSet.name}/javanano, and grpc_out to be ${project.projectDir}/src/${sourceSet.name}/grpc?

@ejona86
Copy link
Collaborator

ejona86 commented Jun 1, 2015

This actually looks like something the user should be able to configure to be something else. We can by default put it some place, but it should be able to be overridden.

@debasish-raychawdhuri
Copy link

It not only looks bad, but also causes problem in setting up directory structure when sourceSet.name is artificially added to it. Gradle default practice is to have a java directory inside its source set, but its impossible use that structure currently.

@zhangkun83
Copy link
Collaborator

I am working on a new version that will change the default output path to "$buildDir/generated/source/proto/$sourceSet/$name", where $name is java, python etc. This will align with Gradle default practice. I will possibly make the prefix, i.e., "$buildDir/generated/source/proto/" configurable through a property named generatedBaseDir if desired.

@zhangkun83
Copy link
Collaborator

This actually looks like something the user should be able to configure to be something else. We can by default put it some place, but it should be able to be overridden.

@ejona86 Allow overriding the outputDir on the codegen plugin or task granularity is hard to implement correctly (see #13 (comment)). So far, people have been just wanting that generated files of different codegen plugins can be in separate directories, which doesn't require fine-grained customization.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 19, 2015

@zhangkun83
Copy link
Collaborator

@ejona86 this is a use case for customizing the global base dir, which we can still support.

@zhangkun83
Copy link
Collaborator

Let's move discussions to #13

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

4 participants