Skip to content

Commit 6540e09

Browse files
sellmairqurbonzoda
authored andcommitted
Documentation: advertise 'associateWith' in favor of custom dependency propagation for jvm
1 parent aa51b0f commit 6540e09

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

docs/separate-benchmark-source-set.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,23 @@ Set up a separate benchmark source set by following these simple steps:
7575
}
7676
```
7777
78-
2. **Propagate Dependencies**
78+
2. **Associate compilations**
7979
80-
Next, propagate dependencies and output from the `main` source set to your `benchmark` source set.
81-
This ensures the `benchmark` source set has access to classes and resources from the `main` source set.
80+
We then associate the benchmark compilation with the main compilation. This will allow the
81+
benchmark compilation to access internal APIs from 'main' as well as propagate dependencies
8282
8383
```kotlin
8484
// build.gradle.kts
85-
dependencies {
86-
add("benchmarkImplementation", sourceSets.main.get().output + sourceSets.main.get().runtimeClasspath)
85+
kotlin {
86+
target {
87+
compilations.getByName("benchmark")
88+
.associateWith(compilations.getByName("main"))
89+
}
8790
}
8891
```
8992
90-
You can also add output and `compileClasspath` from `sourceSets.test` in the same way
91-
if you wish to reuse some of the test infrastructure.
93+
You can associate the benchmark compilation with the "test" compilation as well if you would like
94+
to re-use test-code in benchmarks.
9295
9396
3. **Register Benchmark Source Set**
9497

0 commit comments

Comments
 (0)