-
Notifications
You must be signed in to change notification settings - Fork 657
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
Be able to specify path for Generated code #2019
Comments
Actually, i'd prefer swagger to generate files outside The generated code shouldn't be checked in source control because it duplicates information with the Can you detail a bit more what your use cases would be ? Maybe there's a way to do it without adding files in the main source set ? |
Closing due to inactivity, please reopen if needed. |
We have the same issue. Other uses cases are IDE integration (auto completion) which sometimes doesn't work / needs special configuration, and usage with the Java module system. You also don't necessarily have to have the code under version control, simply add So I hope this issue could be reopened. Thanks! |
This comment has been minimized.
This comment has been minimized.
Hi @tobiasdiez !
If autocomplete doesn't work, it's definitely a bug that should be addressed either in Apollo Android or IntelliJ/Android Studio. Would you have a small reproducer we could dig into?
Can you elaborate a bit more what is specific to the Java module system? I was under the impression that the generated files would be part of the module where the apollo plugin is applied but maybe I'm missing something. Overall I'm not opposed to making the outputDir configurable but it seems that would hide other issues that we could fix in another better way. |
Thanks for your quick response.
I had this problem using VS Code (which admittedly doesn't have the best Java integration). Everything in
We are still experimenting with the module system integration (see #3152), but the short version is that one needs to specify the path of the module(s), see https://docs.oracle.com/javase/9/tools/jlink.htm. Thus the In summary, nothing that (probably) cannot be fixed by some configuration of the external tools. It would be just easier if one could instruct the apollo plugin to generate the code in the same folder as other generated code so that this configuration has to be done only once. By the way, here is a good overview of the different conventions where to put generated code: https://stackoverflow.com/questions/22912900/location-of-generated-source-files-for-maven-directory-structure/64612308#64612308 (the build folder is not mentioned). |
Thanks for all the context! VSCode makes sense. I don't think they have any kind of Gradle integration so little can they know about the generated folder. I don't think we want to move away from But we could make it configurable I think. It's used here. Maybe it's simply a matter of exposing the property to the extension. |
This is also a problem with Eclipse: apollo {
onCompilationUnit {
outputDir.set(file("src-gen/main/java/")) // TODO not working yet
// Overwrite some options here for single CompilationUnit if needed
}
} |
Starting with apollo {
outputDir.set("src-gen/main/java/")
} |
Is your feature request related to a problem? Please describe.
I would like a way to provide the path for generated code for a service.
Describe the solution you'd like
Right now the code is generated in
{project_dir/build/generated/source/apollo/main/{service name}/{rootPackagePath}
path. It would nice to specify a path separately, related to the project dir. E.g. something like{project_dir}/src/main/generated/...
. This is to be able to merge generated code in Git, similar to Swagger type behavior.What I am using:
gradle 6.2.1
'com.apollographql.apollo' version '1.3.2'
Java 8
My build.gradle task:
The text was updated successfully, but these errors were encountered: