-
Notifications
You must be signed in to change notification settings - Fork 20
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
ktfmt does not use custom source directories #292
Comments
Yup this is a bug. I'm looking for someone to help me here, happy to review a PR. |
so the fix would be to listen to both? and the work around would be to set kotlin.sourceSet? why are there always so many different ways to do things in gradle.... |
I changed it to
and it still does not format. |
Yeah man don't tell me about it :| |
@cortinico I would be happy to help fix this, but it would be cool if we could come up with a workaround first. like i wrote above, it did not work for me when i set |
Yeah I started to look into it but hit a road blocker. @simonhauck do you have a spare cycle to look at this one? |
Yes I will finish my current PR an then have a look :) |
@christophsturm For a fast workaround you could add the tasks manually. This is not so great, but at least you can format/check the code ;) tasks.register<KtfmtFormatTask>("customFormat") {
source = fileTree(layout.projectDirectory) { include("**/*.kt") }
} |
…e project is using a flattened project structure
I have an idea what could be the problem. From the docs on the method
My assumption is that the sourceSets are changed after the plugin is evaluated. That's why we do not detect the changes when we resolve it eagerly. The solution is straightforward... expect one or two things... ;) Additionally, when selecting in IntelliJ settings > Build, Execution, Deployment > Build Tools > Gradle > Run tests using = IntelliJ IDEA, some tests are failing with really weird issues. This setting is super useful for debugging, and I am not sure if that behavior is new and happened due to my changes or was always there. I have to check this in the coming days. And also, the build is still red :D |
…ix it by evaluating it lazy with providers - Add dependency between sqldelight tasks and formatTasks. This is necessary, else gradle will complain that task use outputs from task not specified - update changelog
… ignored. Set this value by default to the build directory
* #292 add test to reproduce issues with changed sources location and fix it by evaluating it lazy with providers * #292 add a new regex extension property to specify what files should be ignored. Set this value by default to the build directory * #292 update the api specification with the new property * #292 update documentation --------- Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Done in 0.20.0 |
🐛 Describe the bug
in my project I configure a flat directory layout by stetting srcDirs for the source sets:
ktfmt does not format my sources,
gradle says
NO SOURCE
✅ Expected behavior
Before I converted my project to the flat source directory structure I'm sure it worked.
💣 Steps to reproduce
clone https://github.com/failgood/failgood
run
./gradlew ktfmtFormat
notice that sources are not reformatted, for example failgood/src/failgood/junit/ContextFinder.kt contains 2 unused imports.
The text was updated successfully, but these errors were encountered: