-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add ability to set project directory. #1115
Conversation
@graemerocher Hi! Could you review and merge last 3 PR's (#1115, #1112, #1113) ? After it we can release 4.10.0 - last of 4.x series. Then I move these changes to relese 5.0 and all next changes will be in release 5.0 (except for bug fixes, of course) |
@graemerocher Could you also review this PR and #1113 ? |
/** | ||
* Loaded project directory from system properties. | ||
*/ | ||
public static final String MICRONAUT_INTERNAL_OPENAPI_PROJECT_DIR = "micronaut.internal.openapi.project.dir"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you override getSupportedOptions()
and provide all of these constants as annotation processor options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return projectPath; | ||
} | ||
|
||
String projectDir = System.getProperty(MICRONAUT_OPENAPI_PROJECT_DIR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't use system properties but the annotation processor options otherwise the compiler can't detect when input values change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand what's wrong here. As I understand it, it is necessary to describe the properties of the processor, which must be allowed to be loaded as system variables. They are described in the @SupportedOptions
annotation. Now everything has been implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general parameters to an annotation processor should never be ready from system properties and should always be read from annotation processor arguments, this particular processor abuses that badly in several places which is less than ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, then how is it correct to write the reading of the arguments? Although I'm not sure if there's much to worry about using system variables. I think it's redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@graemerocher Do I need to write something like this?
context.getOptions().get(MICRONAUT_INTERNAL_OPENAPI_PROJECT_DIR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just that I don't understand. I give kapt the annotation processor argument, but I read it with a system property. That is, it turns out that all arguments are already available as system properties. Or does kapt set not an argument, but a system property?
I tested this solution on a test project - it works correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it needs to be context.getOptions().get(MICRONAUT_INTERNAL_OPENAPI_PROJECT_DIR)
@graemerocher Can I merge it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@altro3 can you add documentation about this? when should people use it and how to use it
7c3cc58
to
c10d8f9
Compare
@sdelamo done |
@graemerocher Can I publish releases |
Fixed #1101