Skip to content

Commit a0e9081

Browse files
authored
Update Gradle build script agent information (#74)
Resolves #73
1 parent fc71d87 commit a0e9081

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ The hooks that enable **JUnit Foundation** test lifecycle notifications are inst
130130
<properties>
131131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
132132
<maven.compiler.target>1.7</maven.compiler.target>
133-
<maven.compiler.source>1.7</maven.compiler.source>
133+
<maven.compiler.source>1.7</maven.compiler.source>
134134
</properties>
135135

136136
<dependencies>
@@ -218,19 +218,39 @@ dependencies {
218218
// ...
219219
compile 'com.nordstrom.tools:junit-foundation:12.2.0'
220220
}
221-
ext {
222-
junitFoundation = configurations.compile.resolvedConfiguration.resolvedArtifacts.find { it.name == 'junit-foundation' }
223-
}
224-
test.doFirst {
225-
jvmArgs "-javaagent:${junitFoundation.file}"
226-
}
227221
test {
228222
// debug true
223+
jvmArgs "-javaagent:${classpath.find { it.name.contains('junit-foundation') }.absolutePath}"
229224
// not required, but definitely useful
230225
testLogging.showStandardStreams = true
231226
}
232227
```
233228

229+
#### Gradle configuration (Android Studio):
230+
```gradle
231+
apply plugin: 'com.android.application'
232+
apply plugin: 'kotlin-android'
233+
apply plugin: 'kotlin-android-extensions'
234+
235+
android {
236+
compileSdkVersion 30
237+
buildToolsVersion "30.0.1"
238+
239+
// ...
240+
241+
testOptions {
242+
unitTests.all {
243+
jvmArgs "-javaagent:${classpath.find { it.name.contains('junit-foundation') }.absolutePath}"
244+
}
245+
}
246+
}
247+
248+
dependencies {
249+
// ...
250+
testImplementation 'com.nordstrom.tools:junit-foundation:12.2.0'
251+
}
252+
```
253+
234254
#### IDE Configuration for JUnit Foundation
235255

236256
To enable notifications in the native test runner of IDEs like Eclipse or IDEA, add the `-javaagent` option to the JVM options of your run/debug configuration.

0 commit comments

Comments
 (0)