Skip to content

Commit

Permalink
Forenklinger i build-filen (#598)
Browse files Browse the repository at this point in the history
* Forenklinger i build-filen

* Bruk konsekvent filterNot

* Formater
  • Loading branch information
bjerga authored Jul 10, 2024
1 parent bf576be commit b2f5574
Showing 1 changed file with 38 additions and 46 deletions.
84 changes: 38 additions & 46 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,22 @@ plugins {
id("jvm-test-suite")
}

buildscript {
repositories {
mavenCentral()
}
}

dependencies {
subprojects
.filter { it.name != "integrasjonstest" }
.forEach {
jacocoAggregation(project(":${it.name}"))
}
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
}
}

allprojects {
tasks {
withType<Test> {
useJUnitPlatform()
testLogging {
events("skipped", "failed")
}
}
}
subprojects {
group = "no.nav.helsearbeidsgiver.inntektsmelding"

applyPlugins(
"org.jetbrains.kotlin.jvm",
"org.jetbrains.kotlin.plugin.serialization",
"org.jmailen.kotlinter",
"java",
"jacoco",
)

repositories {
val githubPassword: String by project
Expand All @@ -52,21 +39,15 @@ allprojects {
}
}
}
}

subprojects {
group = "no.nav.helsearbeidsgiver.inntektsmelding"
version = properties["version"] ?: "local-build"

applyPlugins(
"org.jetbrains.kotlin.jvm",
"org.jetbrains.kotlin.plugin.serialization",
"org.jmailen.kotlinter",
"java",
"jacoco",
)

tasks {
withType<Test> {
useJUnitPlatform()
testLogging {
events("skipped", "failed")
}
}

if (!project.erFellesModul() && !project.erFellesDatabaseModul()) {
named<Jar>("jar") {
archiveBaseName.set("app")
Expand Down Expand Up @@ -142,6 +123,14 @@ subprojects {
}
}

dependencies {
subprojects
.filterNot { it.erIntegrasjonstestModul() }
.forEach {
jacocoAggregation(project(":${it.name}"))
}
}

tasks {
create("buildMatrix") {
doLast {
Expand Down Expand Up @@ -186,18 +175,21 @@ fun getBuildableProjects(buildAll: Boolean = false): List<String> {
?: throw IllegalStateException("Ingen endrede filer funnet.")

val hasCommonChanges =
changedFiles.any { it.startsWith("felles/") } ||
changedFiles.containsAny(
"Dockerfile",
".github/workflows/build.yml",
"config/nais.yml",
"build.gradle.kts",
"gradle.properties",
)
changedFiles.any {
it.startsWith("felles/") ||
it in
listOf(
"Dockerfile",
".github/workflows/build.yml",
"config/nais.yml",
"build.gradle.kts",
"gradle.properties",
)
}

return subprojects
.filterNot { it.erIntegrasjonstestModul() }
.map { it.name }
.filter { it != "integrasjonstest" }
.let { projects ->
if (hasCommonChanges) {
projects
Expand Down Expand Up @@ -278,7 +270,7 @@ fun Project.erFellesModul(): Boolean = name == "felles"

fun Project.erFellesDatabaseModul(): Boolean = name == "felles-db-exposed"

fun List<String>.containsAny(vararg others: String): Boolean = this.intersect(others.toSet()).isNotEmpty()
fun Project.erIntegrasjonstestModul(): Boolean = name == "integrasjonstest"

fun Task.deployMatrix(
includeCluster: String? = null,
Expand Down

0 comments on commit b2f5574

Please sign in to comment.