-
Notifications
You must be signed in to change notification settings - Fork 14k
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
MINOR: Move generated sources to build directory #16993
Conversation
.gitignore
Outdated
**/src/generated | ||
**/src/generated-test |
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.
Removing these ignores makes it more likely for people to accidentally commit the generated code, right?
WDYT about moving the directories but leaving the ignores in place for some time? If we merged my clean
PR, that could give a window in which developers can clean up the old directories without ever thinking about them, and later we can finally remove the ignores and the extra clean
.
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.
The reason I wanted to remove it was so we could do a simple git clean
to remove the files from the old location. However, not ignoring them does make it more likely for someone to commit them.
I think your plan makes sense. Basically if we move the files to "build", but keep the additional clean logic you've added, ./gradlew clean
should clear out both locations.
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.
1 to @gharris1727 to leave the ignores in place. Otherwise, people could commit the generated code unexpectedly when testing 3.x branches and trunk branch.
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.
@mumrah thanks for this patch. Could you please remove unused path (src/generated/java
)` from core module (https://github.com/apache/kafka/blob/trunk/build.gradle#L1261). That should be included by #16019 but I overlook it ...
.gitignore
Outdated
**/src/generated | ||
**/src/generated-test |
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.
1 to @gharris1727 to leave the ignores in place. Otherwise, people could commit the generated code unexpectedly when testing 3.x branches and trunk branch.
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.
LGTM. the following addendum can be addressed in next PR (I will file a jira for them).
- remove
src/generated/java
from core module - add
<suppress files="[\\/]generated[\\/]" checks="[a-zA-Z0-9]*"/>
to the suppressions.xml to suppress all generated code
|
Reviewers: Chia-Ping Tsai <[email protected]>
Reviewers: Chia-Ping Tsai <[email protected]>
Gradle does not recommend putting generated and non-generated sources in the same directory. This can disturb the caching mechanism. This patch puts the generated sources into the "build" dir.
After merging, the old generated sources will still be around but should not affect the build or local development. A
./gradlew clean
should remove any old or new generated sources.https://discuss.gradle.org/t/right-way-to-generate-sources-in-gradle-7/41141/2