Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.DependencyFilter
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
Expand All @@ -19,34 +18,3 @@ tasks.named<ShadowJar>("shadowJar") {
val archiveFile = this.archiveFile
doLast("revertKotlinPackageChanges") { revertKotlinPackageChanges(archiveFile) }
}

// Defer the resolution of 'runtimeClasspath'. This is an issue in the shadow
// plugin that it automatically accesses the files in 'runtimeClasspath' while
// Gradle is building the task graph. The lines below work around that.
// https://github.com/GradleUp/shadow/issues/882
tasks.withType<ShadowJar> {
// Do not resolve too early through 'dependencyFilter'
dependencyFilter = NoResolveDependencyFilter(project)
}

class NoResolveDependencyFilter(
project: Project
) : DependencyFilter.AbstractDependencyFilter(project) {

// Copy of https://github.com/GradleUp/shadow/blob/main/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/DefaultDependencyFilter.kt#L10
override fun resolve(
dependencies: Set<ResolvedDependency>,
includedDependencies: MutableSet<ResolvedDependency>,
excludedDependencies: MutableSet<ResolvedDependency>,
) {
dependencies.forEach {
if (if (it.isIncluded()) includedDependencies.add(it) else excludedDependencies.add(it)) {
resolve(it.children, includedDependencies, excludedDependencies)
}
}
}

override fun resolve(configuration: Configuration): FileCollection {
return configuration
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0"
pluginPublish = { id = "com.gradle.plugin-publish", version = "2.1.0" }
gitProperties = { id = "com.gorylenko.gradle-git-properties", version = "2.5.7" }
mavenPluginDevelopment = { id = "org.gradlex.maven-plugin-development", version = "1.0.3" }
shadow = { id = "com.gradleup.shadow", version = "9.3.2" }
shadow = { id = "com.gradleup.shadow", version = "9.4.0" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version = "2.3.10" }
jlink = { id = "org.beryx.jlink", version = "3.2.1" }
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.teamscale.report.compact
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.databind.json.JsonMapper
import com.teamscale.report.util.CompactLines
import com.teamscale.report.util.LineRangeDeserializer
import com.teamscale.report.util.LineRangeSerializer
Expand All @@ -26,8 +26,8 @@ data class TeamscaleCompactCoverageReport @JsonCreator constructor(
) {
/** Serializes the compact coverage into a JSON report and writes it into the given output stream. */
fun writeTo(output: OutputStream) {
return ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
return JsonMapper.builder()
.defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL).build()
.writeValue(output, this)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object JsonUtils {
.visibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE)
.visibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.serializationInclusion(JsonInclude.Include.NON_NULL)
.defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL)
.build()

/**
Expand Down