@@ -64,22 +64,6 @@ processTestResources {
64
64
}
65
65
}
66
66
67
- // https://docs.gradle.org/current/userguide/test_kit.html#sub:test-kit-classpath-injection
68
- // Write the plugin's classpath to a file to share with the tests
69
- task createTestClasspathManifest {
70
- def outputDir = file(" $buildDir /resources/test" )
71
-
72
- inputs. files sourceSets. main. runtimeClasspath
73
- outputs. dir outputDir
74
-
75
- doLast {
76
- outputDir. mkdirs()
77
- file(" $outputDir /plugin-classpath.txt" ). text = sourceSets. main. runtimeClasspath. join(" \n " )
78
- }
79
- }
80
-
81
- processTestResources. finalizedBy createTestClasspathManifest
82
-
83
67
// ------------------------------------------------------------------------------------------------
84
68
// Test Setup
85
69
//
@@ -96,11 +80,27 @@ final def jacocoData3x = "$buildDir/jacoco/testAgp3x.exec"
96
80
97
81
configurations {
98
82
testAgp2xCompile {
83
+ description = " Dependencies used for compiling tests using Android Gradle Plugin 2.x"
99
84
extendsFrom configurations. testCompile
100
85
}
101
86
testAgp3xCompile {
87
+ description = " Dependencies used for compiling tests using Android Gradle Plugin 3.x"
102
88
extendsFrom configurations. testCompile
103
89
}
90
+ functionalTest {
91
+ description = " Local dependencies used for compiling & running tests source code " +
92
+ " inside of Gradle functional tests"
93
+ }
94
+ functionalTestAgp2x {
95
+ description = " Local dependencies used for compiling & running tests source code " +
96
+ " inside of Gradle functional tests with Android Gradle Plugin 2.x"
97
+ extendsFrom configurations. functionalTest
98
+ }
99
+ functionalTestAgp3x {
100
+ description = " Local dependencies used for compiling & running tests source code " +
101
+ " inside of Gradle functional tests with Android Gradle Plugin 3.x"
102
+ extendsFrom configurations. functionalTest
103
+ }
104
104
}
105
105
106
106
sourceSets {
@@ -148,6 +148,37 @@ task testAgp3x(type: Test) {
148
148
// Combine all tests when executing the main JUnit task
149
149
tasks. getByName(" test" ). dependsOn(testAgp2x, testAgp3x)
150
150
151
+ // https://docs.gradle.org/current/userguide/test_kit.html#sub:test-kit-classpath-injection
152
+ // Write the plugin's classpath to a file to share with the tests
153
+ task createTestClasspathManifests {
154
+ description =
155
+ " Generate classpath manifests for functional tests so that they can reference locally" +
156
+ " built libraries for use with Gradle Test Kit"
157
+ def outputDir = file(" $buildDir /resources/test" )
158
+
159
+ inputs. files sourceSets. main. runtimeClasspath
160
+ inputs. files sourceSets. testAgp2x. runtimeClasspath
161
+ inputs. files sourceSets. testAgp3x. runtimeClasspath
162
+ inputs. files configurations. testAgp2xCompile
163
+ inputs. files configurations. testAgp3xCompile
164
+ outputs. dir outputDir
165
+
166
+ doLast {
167
+ outputDir. mkdirs()
168
+ file(" $outputDir /plugin-classpath.txt" ). text = sourceSets. main. runtimeClasspath. join(" \n " )
169
+ file(" $outputDir /plugin-2x-classpath.txt" ). text =
170
+ sourceSets. testAgp2x. runtimeClasspath. join(" \n " )
171
+ file(" $outputDir /plugin-3x-classpath.txt" ). text =
172
+ sourceSets. testAgp3x. runtimeClasspath. join(" \n " )
173
+ file(" $outputDir /functional-test-compile-2x-classpath.txt" ). text =
174
+ configurations. functionalTestAgp2x. files. join(" \n " )
175
+ file(" $outputDir /functional-test-compile-3x-classpath.txt" ). text =
176
+ configurations. functionalTestAgp3x. files. join(" \n " )
177
+ }
178
+ }
179
+
180
+ processTestResources. finalizedBy createTestClasspathManifests
181
+
151
182
// ------------------------------------------------------------------------------------------------
152
183
// Dependency Definitions
153
184
// ------------------------------------------------------------------------------------------------
@@ -159,11 +190,19 @@ dependencies {
159
190
compileOnly " com.android.tools.build:gradle:$ANDROID_PLUGIN_2X_VERSION "
160
191
161
192
testCompile " junit:junit:$JUNIT4_VERSION "
193
+ testCompile " commons-lang:commons-lang:2.6"
162
194
testCompile " org.spockframework:spock-core:$SPOCK_VERSION "
163
195
testCompile " org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION "
164
196
testCompileOnly " com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION "
165
197
testAgp2xCompile " com.android.tools.build:gradle:$ANDROID_PLUGIN_2X_VERSION "
166
198
testAgp3xCompile " com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION "
199
+
200
+ functionalTest " junit:junit:$JUNIT4_VERSION "
201
+ functionalTest " org.junit.jupiter:junit-jupiter-api:$JUNIT_JUPITER_VERSION "
202
+ functionalTest " org.junit.jupiter:junit-jupiter-engine:$JUNIT_JUPITER_VERSION "
203
+ functionalTest " org.junit.platform:junit-platform-console:$JUNIT_PLATFORM_VERSION "
204
+ functionalTestAgp2x " com.android.tools.build:gradle:$ANDROID_PLUGIN_2X_VERSION "
205
+ functionalTestAgp3x " com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION "
167
206
}
168
207
169
208
// ------------------------------------------------------------------------------------------------
0 commit comments