-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
56 lines (51 loc) · 1.64 KB
/
build.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
import com.github.jk1.license.render.InventoryReportRenderer
import com.github.jk1.license.render.JsonReportRenderer
import org.gradle.api.tasks.testing.logging.TestLogEvent
setupRepositories()
setupTestLogging()
fun hentAntallKjerner(): Int {
val isGithubWorkflow = System.getenv("CI")
if (isGithubWorkflow != null) {
return Runtime.getRuntime().availableProcessors()
}
return Runtime.getRuntime().availableProcessors() / 2
}
plugins {
alias(libs.plugins.license) apply true
alias(libs.plugins.versions) apply true
}
licenseReport {
renderers = arrayOf(JsonReportRenderer(), InventoryReportRenderer())
allowedLicensesFile = File("$projectDir/buildSrc/akseptable-lisenser.json")
}
fun Project.setupRepositories() {
for (sub in subprojects) {
sub.repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/navikt/pensjon-etterlatte-libs")
credentials {
username = "token"
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
fun Project.setupTestLogging() {
for (sub in subprojects) {
sub.plugins.apply(
libs.plugins.versions
.get()
.pluginId,
)
sub.tasks.withType<Test> {
useJUnitPlatform()
maxParallelForks = hentAntallKjerner()
testLogging {
events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
}
}