-
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 #198 from gradle/no/disable-bundle-caching
Disable caching of BundleLibraryClassesJar task.
- Loading branch information
Showing
6 changed files
with
83 additions
and
16 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/BundleLibraryClassesWorkaround.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.internal.tasks.BundleLibraryClasses | ||
import org.gradle.android.AndroidIssue | ||
import org.gradle.api.Project | ||
|
||
/** | ||
* Disables caching of the BundleLibraryClasses task which is mostly disk bound and unlikely to provide positive | ||
* performance benefits. | ||
*/ | ||
@AndroidIssue(introducedIn = "3.5.0", fixedIn = ["4.1.0-alpha01"], link = "https://issuetracker.google.com/issues/199763362") | ||
class BundleLibraryClassesWorkaround implements Workaround { | ||
private static final String CACHING_ENABLED_PROPERTY = "org.gradle.android.cache-fix.BundleLibraryClasses.caching.enabled" | ||
|
||
@Override | ||
void apply(WorkaroundContext context) { | ||
context.project.tasks.withType(BundleLibraryClasses).configureEach { | ||
outputs.doNotCacheIf("Caching BundleLibraryClasses is unlikely to provide positive performance results.", {true }) | ||
} | ||
} | ||
|
||
@Override | ||
boolean canBeApplied(Project project) { | ||
return !SystemPropertiesCompat.getBoolean(CACHING_ENABLED_PROPERTY, project) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/groovy/org/gradle/android/workarounds/BundleLibraryClassesWorkaround_4_2.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,37 @@ | ||
package org.gradle.android.workarounds | ||
|
||
import org.gradle.android.AndroidIssue | ||
import org.gradle.api.Project | ||
|
||
/** | ||
* Disables caching of the BundleLibraryClassesJar and BundleLibraryClassesDir tasks which are mostly disk bound and | ||
* unlikely to provide positive performance benefits. | ||
*/ | ||
@AndroidIssue(introducedIn = "4.1.0", fixedIn = [], link = "https://issuetracker.google.com/issues/199763362") | ||
class BundleLibraryClassesWorkaround_4_2 implements Workaround { | ||
private static final String CACHING_ENABLED_PROPERTY = "org.gradle.android.cache-fix.BundleLibraryClasses.caching.enabled" | ||
|
||
static Class<?> getJarTaskClass() { | ||
return Class.forName('com.android.build.gradle.internal.tasks.BundleLibraryClassesJar') | ||
} | ||
|
||
static Class<?> getDirTaskClass() { | ||
return Class.forName('com.android.build.gradle.internal.tasks.BundleLibraryClassesDir') | ||
} | ||
|
||
|
||
@Override | ||
void apply(WorkaroundContext context) { | ||
context.project.tasks.withType(jarTaskClass).configureEach { | ||
outputs.doNotCacheIf("Caching BundleLibraryClassesJar is unlikely to provide positive performance results.", {true }) | ||
} | ||
context.project.tasks.withType(dirTaskClass).configureEach { | ||
outputs.doNotCacheIf("Caching BundleLibraryClassesDir 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