forked from gradle/gradle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
53 lines (45 loc) · 1.36 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// tag::use-plugin[]
plugins {
// A Java Library
id 'java-library'
// which produces test fixtures
id 'java-test-fixtures'
// and is published
id 'maven-publish'
}
// end::use-plugin[]
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// tag::test_fixtures_deps[]
dependencies {
testImplementation 'junit:junit:4.13'
// API dependencies are visible to consumers when building
testFixturesApi 'org.apache.commons:commons-lang3:3.9'
// Implementation dependencies are not leaked to consumers when building
testFixturesImplementation 'org.apache.commons:commons-text:1.6'
}
// end::test_fixtures_deps[]
// tag::publishing_test_fixtures[]
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
// end::publishing_test_fixtures[]
// tag::disable-test-fixtures-publishing[]
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
// end::disable-test-fixtures-publishing[]
tasks.create("usages") {
def javaComponentUsages = components.java.usages.collect { it.name }
doLast {
javaComponentUsages.each { println(it) }
}
}