-
Notifications
You must be signed in to change notification settings - Fork 525
Convoluted codegen build process #58
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
Comments
|
taowen
added a commit
that referenced
this issue
May 23, 2017
What about generating bytecode directly (form class files and using reflection) instead of java code? Just like annotation processors usually do... |
I can provide that as an option. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can not wrap my head around how the codegen build process is supposed to work smoothly...
I did get it to work (with gradle), but steps were convoluted.
The StaticCodeGenerator expects to find .java file from the current directory and yet have the .class file of the same class available in its classpath. When both conditions are satisfied, it generates sources (encoder+decoder packages) and puts them in the source directory (src/main/java) which then needs to be compiled again.
In gradle language, the series of tasks are:
clean compileJava jsoniterCodegen clean build
Note: I have to run clean after the 'jsoniterCodegen' otherwise gradle doesn't run compileJava task again.
Although it can work. Compiling the entire project twice, or running the custom jsoniterCodegen task manually every time it may be needed isn't nice (and is slow).
There are a couple of ways of fixing this:
In addition, it would be nice if I could specify where to put the new files; I like to put my generated sources in a specific directory. I could do that if this if check was dropped:
java/src/main/java/com/jsoniter/StaticCodeGenerator.java
Line 14 in 88e45d0
Let me know if anything is unclear.
The text was updated successfully, but these errors were encountered: