/
smoke-test.gradle.kts
133 lines (113 loc) · 4.73 KB
/
smoke-test.gradle.kts
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import accessors.groovy
import org.gradle.gradlebuild.BuildEnvironment
import org.gradle.gradlebuild.test.integrationtests.addDependenciesAndConfigurations
import org.gradle.gradlebuild.test.integrationtests.SmokeTest
import org.gradle.gradlebuild.versioning.DetermineCommitId
import org.gradle.testing.performance.generator.tasks.RemoteProject
plugins {
gradlebuild.internal.java
}
val smokeTest: SourceSet by sourceSets.creating {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
addDependenciesAndConfigurations("smoke")
val smokeTestImplementation: Configuration by configurations.getting
val smokeTestDistributionRuntimeOnly: Configuration by configurations.getting
dependencies {
smokeTestImplementation(project(":baseServices"))
smokeTestImplementation(project(":coreApi"))
smokeTestImplementation(project(":testKit"))
smokeTestImplementation(project(":launcher"))
smokeTestImplementation(project(":persistentCache"))
smokeTestImplementation(project(":jvmServices"))
smokeTestImplementation(project(":buildOption"))
smokeTestImplementation(library("commons_io"))
smokeTestImplementation(library("jgit"))
smokeTestImplementation(library("gradleProfiler")) {
because("Using build mutators to change a Java file")
}
smokeTestImplementation(testLibrary("spock"))
smokeTestImplementation(testFixtures(project(":core")))
smokeTestImplementation(testFixtures(project(":versionControl")))
smokeTestDistributionRuntimeOnly(project(":distributionsFull"))
}
fun SmokeTest.configureForSmokeTest() {
group = "Verification"
testClassesDirs = smokeTest.output.classesDirs
classpath = smokeTest.runtimeClasspath
maxParallelForks = 1 // those tests are pretty expensive, we shouldn"t execute them concurrently
}
tasks.register<SmokeTest>("smokeTest") {
description = "Runs Smoke tests"
configureForSmokeTest()
}
tasks.register<SmokeTest>("configCacheSmokeTest") {
description = "Runs Smoke tests with instant execution"
configureForSmokeTest()
systemProperty("org.gradle.integtest.executer", "instant")
}
plugins.withType<IdeaPlugin>().configureEach {
val smokeTestCompileClasspath: Configuration by configurations.getting
val smokeTestRuntimeClasspath: Configuration by configurations.getting
model.module {
testSourceDirs = testSourceDirs + smokeTest.groovy.srcDirs
testResourceDirs = testResourceDirs + smokeTest.resources.srcDirs
scopes["TEST"]!!["plus"]!!.add(smokeTestCompileClasspath)
scopes["TEST"]!!["plus"]!!.add(smokeTestRuntimeClasspath)
}
}
tasks {
/**
* Santa Tracker git URI.
*
* Note that you can change it to `file:///path/to/your/santa-tracker-clone/.git`
* if you need to iterate quickly on changes to Santa Tracker.
*/
val santaGitUri = "https://github.com/gradle/santa-tracker-android.git"
register<RemoteProject>("santaTrackerKotlin") {
remoteUri.set(santaGitUri)
// Pinned from branch agp-3.6.0
ref.set("3122343674246eaa56a5dd6365ea137edb021780")
}
register<RemoteProject>("santaTrackerJava") {
remoteUri.set(santaGitUri)
// Pinned from branch agp-3.6.0-java
ref.set("d8543e51ac5a4803a8ac57f0639229736f11e0a8")
}
register<RemoteProject>("gradleBuildCurrent") {
remoteUri.set(rootDir.absolutePath)
ref.set(rootProject.tasks.named<DetermineCommitId>("determineCommitId").flatMap { it.determinedCommitId })
}
val remoteProjects = withType<RemoteProject>()
if (BuildEnvironment.isCiServer) {
remoteProjects.configureEach {
outputs.upToDateWhen { false }
}
}
register<Delete>("cleanRemoteProjects") {
delete(remoteProjects.map { it.outputDirectory })
}
withType<SmokeTest>().configureEach {
dependsOn(remoteProjects)
inputs.property("androidHomeIsSet", System.getenv("ANDROID_HOME") != null)
inputs.files(Callable { remoteProjects.map { it.outputDirectory } })
.withPropertyName("remoteProjectsSource")
.withPathSensitivity(PathSensitivity.RELATIVE)
}
}