-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix AGP's new Kotlin sourceset not being recognised by default #57
Conversation
val srcDirs = sourceSet.java.srcDirs + runCatching { | ||
// As sourceSet.kotlin doesn't exist before AGP 7 | ||
(sourceSet.kotlin as? DefaultAndroidSourceDirectorySet)?.srcDirs | ||
}.getOrNull().orEmpty() |
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.
Catch the exception for compatibilities of older AGP.
|
assertThat(project.tasks.getByName("ktfmtCheckTestFixtures")) | ||
.isInstanceOf(KtfmtCheckTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtCheckTestFixturesRelease")) | ||
.isInstanceOf(KtfmtCheckTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtCheckTestFixturesDebug")) | ||
.isInstanceOf(KtfmtCheckTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtFormatTestFixtures")) | ||
.isInstanceOf(KtfmtFormatTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtFormatTestFixturesRelease")) | ||
.isInstanceOf(KtfmtFormatTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtFormatTestFixturesDebug")) | ||
.isInstanceOf(KtfmtFormatTask::class.java) | ||
|
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'm not sure AGP 7.1 intro these tasks?
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 believe that's the case, but I wasn't able to find any reference.
Out of curiousity, would be able to println
the source of those tasks? I'd like to know which directories they're actually pointing to.
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.
How can I print?
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 meant if you run the test locally, and add a println
inside KtfmtAndroidUtils.kt
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.
https://emartynov.medium.com/android-gradle-plugin-with-test-fixtures-support-411383320980
Seems it's really from AGP.
assertThat(project.tasks.getByName("ktfmtCheckTestFixtures")) | ||
.isInstanceOf(KtfmtCheckTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtCheckTestFixturesRelease")) | ||
.isInstanceOf(KtfmtCheckTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtCheckTestFixturesDebug")) | ||
.isInstanceOf(KtfmtCheckTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtFormatTestFixtures")) | ||
.isInstanceOf(KtfmtFormatTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtFormatTestFixturesRelease")) | ||
.isInstanceOf(KtfmtFormatTask::class.java) | ||
assertThat(project.tasks.getByName("ktfmtFormatTestFixturesDebug")) | ||
.isInstanceOf(KtfmtFormatTask::class.java) | ||
|
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 believe that's the case, but I wasn't able to find any reference.
Out of curiousity, would be able to println
the source of those tasks? I'd like to know which directories they're actually pointing to.
Link detekt/detekt/pull/4554.