-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
49 lines (43 loc) · 1.46 KB
/
build.gradle
File metadata and controls
49 lines (43 loc) · 1.46 KB
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
import java.time.Duration
def testTaskTimeoutMinutes = providers
.gradleProperty('testTaskTimeoutMinutes')
.map { it as int }
.orElse(5)
subprojects {
tasks.withType(Test).configureEach {
failOnNoDiscoveredTests = false
timeout = Duration.ofMinutes(testTaskTimeoutMinutes.get())
}
tasks
.matching { task -> task.name.toLowerCase().startsWith('test') }
.configureEach { task ->
task.timeout = Duration.ofMinutes(testTaskTimeoutMinutes.get())
}
}
gradle.taskGraph.whenReady { graph ->
graph.allTasks
.findAll { task -> task.name.toLowerCase().startsWith('test') && task.hasProperty('timeout') }
.each { task ->
task.timeout = Duration.ofMinutes(testTaskTimeoutMinutes.get())
}
}
tasks.register('sonatypeUpload', Exec) {
onlyIf {
if (!System.getenv('SONATYPE_BEARER')) {
logger.lifecycle('SONATYPE_BEARER is not set. Set SONATYPE_BEARER to activate sonatype upload.')
return false
}
return true
}
def uploadScript = './.github/scripts/sonatype-upload.sh'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'bash', uploadScript, 'dist/bundles'
} else {
commandLine uploadScript, 'dist/bundles'
}
environment 'SONATYPE_BEARER', System.getenv('SONATYPE_BEARER') ?: ''
}
tasks.register('release') {
dependsOn subprojects.collect { it.tasks.matching { task -> task.name == 'release' } }
finalizedBy tasks.named('sonatypeUpload')
}