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

Change output directory path for Datatables #342

Merged

Conversation

yusasak1
Copy link
Contributor

@yusasak1 yusasak1 commented Oct 28, 2024

What's changed?

Change output directory for datatables from <repository top directory>/build/rewrite/datatables to <gradle project directory>/build/reports/rewrite/datatables

What's your motivation?

Currently, when setExportDatatables() is set to true, the CSV files are exported to <repository top directory>/build/datatables. However, I believe it would be better to change the output to the build directory of each Gradle projects for the following two reasons.

  1. If the Gradle project's directory is different from the repository's top directory, the CSV files will not be deleted when the clean task is executed.
  2. In a multi-project structure built with Gradle, it is easier to understand the relevance if the CSV files are output to the build directory of each project.

Files related to reports output during the execution of Gradle tasks are conventionally output to <gradle project directory>/build/reports. Also, considering that the patch file generated when executing the rewriteDryRun task is output to build/reports/rewrite/rewrite.patch, I propose changing the output directory to <gradle project directory>/build/reports/rewrite/datatables.

<Repository Top Directory>
+---build
|   \---rewrite
|       \---datatables // Currennt output directory
|
+---GradleTop
|   +---.gradle
|   +---app
|   |   +---build
|   |   |   +---classes
|   |   |   |   \---java
|   |   |   |       +---main
|   |   |   |       \---test
|   |   |   +---distributions
|   |   |   +---generated
|   |   |   +---libs
|   |   |   +---reports
|   |   |   |   +---rewrite
|   |   |   |   |   |   rewrite.patch
|   |   |   |   |   |
|   |   |   |   |   \---datatables // new output directory proposed
|   |   |   |   \---tests
|   |   |   +---scripts
|   |   |   +---test-results
|   |   |   \---tmp
|   |   \---src
|   |
|   +---buildSrc
|   |   +---.gradle
|   |   +---build
|   |   \---src
|   |
|   +---gradle
|   |   \---wrapper
|   \---utilities
|       +---build
|       |   +---classes
|       |   |   \---java
|       |   |       \---main
|       |   +---generated
|       |   +---libs
|       |   +---reports
|       |   |   +---rewrite
|       |   |   |   |   rewrite.patch
|       |   |   |   |
|       |   |   |   \---datatables // new output directory proposed
|       |   \---tmp
|       \---src
|           +---main
|           |   +---java
|           |   \---resources
|           \---test
|               \---resources
+---otherDirA
\---otherDirB

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

From "<repository top directory>/build/rewrite/datatables" to "<gradle project top directory>/build/reports/rewrite/datatables"
@timtebeek
Copy link
Contributor

Thanks again for noticing and fixing this issue, and educating on the changes you've made as well. Great to see!

@timtebeek timtebeek added the enhancement New feature or request label Oct 28, 2024
@timtebeek timtebeek merged commit e1ecb67 into openrewrite:main Oct 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Output Directory for exportDatatables Function in Gradle Plugin
2 participants