@@ -53,16 +53,8 @@ class JdkImageWorkaround implements Workaround {
53
53
applyRuntimeClasspathNormalization(project)
54
54
55
55
applyToAllAndroidVariants(project) { variant ->
56
- if (Versions . CURRENT_ANDROID_VERSION <= VersionNumber . parse(" 7.4.0-alpha01" )) {
57
- variant. javaCompileProvider. configure { JavaCompile task ->
58
- jdkTransform(project, task)
59
- }
60
- } else {
61
- project. afterEvaluate {
62
- project. tasks. withType(JavaCompile ). configureEach { task ->
63
- jdkTransform(project, task)
64
- }
65
- }
56
+ variant. javaCompileProvider. configure { JavaCompile task ->
57
+ jdkTransform(project, task)
66
58
}
67
59
}
68
60
}
@@ -75,15 +67,9 @@ class JdkImageWorkaround implements Workaround {
75
67
}
76
68
}
77
69
70
+ // Configuration for Old Variant API will drop in AGP 9. We will need to use a different
71
+ // approach to retrieve the variants using the new Variant API.
78
72
private static void applyToAllAndroidVariants (Project project , Closure<?> configureVariant ) {
79
- if (Versions . CURRENT_ANDROID_VERSION <= VersionNumber . parse(" 7.4.0-alpha01" )) {
80
- applyToAllAndroidVariantsWithOldVariantApi(project, configureVariant)
81
- } else {
82
- applyToAllAndroidVariantsWithNewVariantApi(project, configureVariant)
83
- }
84
- }
85
-
86
- private static void applyToAllAndroidVariantsWithOldVariantApi (Project project , Closure<?> configureVariant ) {
87
73
project. plugins. withId(" com.android.application" ) {
88
74
def android = project. extensions. findByName(" android" )
89
75
android. unitTestVariants. all(configureVariant)
@@ -97,14 +83,6 @@ class JdkImageWorkaround implements Workaround {
97
83
}
98
84
}
99
85
100
- private static void applyToAllAndroidVariantsWithNewVariantApi (Project project , Closure<?> configureVariant ) {
101
- project. plugins. withId(" com.android.base" ) {
102
- def androidComponents = project. extensions. findByName(" androidComponents" )
103
- def selector = androidComponents. selector()
104
- androidComponents. onVariants(selector. all(), configureVariant)
105
- }
106
- }
107
-
108
86
static def applyRuntimeClasspathNormalization (Project project ) {
109
87
project. normalization { handler ->
110
88
handler. runtimeClasspath {
@@ -188,6 +166,7 @@ class JdkImageWorkaround implements Workaround {
188
166
interface Parameters extends TransformParameters {
189
167
@Internal
190
168
Provider<Directory > getJavaHome ()
169
+
191
170
void setJavaHome (Provider<Directory > javaHome )
192
171
}
193
172
@@ -254,7 +233,7 @@ class JdkImageWorkaround implements Workaround {
254
233
255
234
private static String serializeRequires (ModuleDescriptor.Requires requires ) {
256
235
String requireString
257
- if (! requires. compiledVersion(). empty) {
236
+ if (! requires. compiledVersion(). empty) {
258
237
requireString = requires. name() + " (@" + requires. compiledVersion() + " )"
259
238
} else {
260
239
requireString = requires. name()
0 commit comments