-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from gradle/no/mergesourcesetfolders
Disable caching of MergeSourceSetFolders
- Loading branch information
Showing
5 changed files
with
48 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/groovy/org/gradle/android/workarounds/MergeSourceSetFoldersWorkaround.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.gradle.android.workarounds | ||
|
||
import com.android.build.gradle.tasks.MergeSourceSetFolders | ||
import org.gradle.android.AndroidIssue | ||
import org.gradle.api.Project | ||
|
||
/** | ||
* Disables caching of the MergeSourceSetFolders task which is mostly disk bound and unlikely to provide positive | ||
* performance benefits. | ||
*/ | ||
@AndroidIssue(introducedIn = "3.5.0", fixedIn = [], link = "https://issuetracker.google.com/issues/194804421") | ||
class MergeSourceSetFoldersWorkaround implements Workaround { | ||
private static final String CACHING_ENABLED_PROPERTY = "org.gradle.android.cache-fix.MergeSourceSetFolders.caching.enabled" | ||
|
||
@Override | ||
void apply(WorkaroundContext context) { | ||
context.project.tasks.withType(MergeSourceSetFolders).configureEach { | ||
outputs.doNotCacheIf("Caching MergeSourceSetFolders is unlikely to provide positive performance results.", {true }) | ||
} | ||
} | ||
|
||
@Override | ||
boolean canBeApplied(Project project) { | ||
return !SystemPropertiesCompat.getBoolean(CACHING_ENABLED_PROPERTY, project) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters