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

Fix duplicate class generation in test folders #2106

Merged
merged 5 commits into from
Mar 28, 2020

Conversation

tasomaniac
Copy link
Contributor

Modify and auto-add sourceSets only for non-test variants

@@ -55,7 +55,7 @@ subprojects {
}

plugins.withType(com.android.build.gradle.BasePlugin::class.java) {
extension.compileOptions {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this is deprecated in AGP 3.6.1 and removed in 4.0


private fun SourceDirectorySet.findSources(schemaFile: RegularFileProperty) {
when {
apolloVariant.isTest -> srcDirFromVariant(apolloVariant)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting from suggestions in the IDE, I ended up refactoring this to make it easier to follow. This is the only behavior change.

I recommend reviewing this in "split" view.

@tasomaniac tasomaniac changed the title Modify and auto-add sourceSets only for non-test variants Fix duplicate class generation in test folders Mar 27, 2020
@tasomaniac tasomaniac merged commit 10c04ee into master Mar 28, 2020
@tasomaniac tasomaniac deleted the fix-test-folder-issue branch March 28, 2020 16:30
tasomaniac added a commit that referenced this pull request Mar 30, 2020
* Replace deprecated AGP function

* Modify and auto-add sourceSets only for non-test variants

* Add tests to verify the fix

* Revert change in Plugin and adjust finding soources based on test sources

* Do not take sourceFolder into account

(cherry picked from commit 10c04ee)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants