From 05f0c59773d8ff137737bcae77891b6c37dd91ed Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:55:59 +0000 Subject: [PATCH] deps: update ort to v46 --- gradle/libs.versions.toml | 2 +- .../kotlin/ui/dependencies/Dependencies.kt | 56 +++++++++---------- .../ui/packagedetails/PackageDetails.kt | 8 +-- src/main/kotlin/ui/packages/Packages.kt | 6 +- .../kotlin/ui/packages/PackagesViewModel.kt | 20 +++---- 5 files changed, 44 insertions(+), 48 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fa4c537..4a4ea25 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ log4jApi = "2.24.3" log4jApiKotlin = "1.5.0" logbackImpl = "1.5.16" moleculeRuntime = "2.0.0" -ort = "44.0.0" +ort = "46.0.0" richtext = "0.20.0" [plugins] diff --git a/src/main/kotlin/ui/dependencies/Dependencies.kt b/src/main/kotlin/ui/dependencies/Dependencies.kt index f2dae72..c43baeb 100644 --- a/src/main/kotlin/ui/dependencies/Dependencies.kt +++ b/src/main/kotlin/ui/dependencies/Dependencies.kt @@ -43,7 +43,6 @@ import org.ossreviewtoolkit.model.Hash import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.model.Issue import org.ossreviewtoolkit.model.Package -import org.ossreviewtoolkit.model.PackageCurationResult import org.ossreviewtoolkit.model.PackageLinkage import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.RemoteArtifact @@ -385,7 +384,7 @@ fun PackageDetails(item: DependencyTreePackage) { Divider(modifier = Modifier.padding(vertical = 10.dp)) - CurationSection(item.pkg.curations) + CurationSection(item.pkg) Divider(modifier = Modifier.padding(vertical = 10.dp)) } @@ -620,65 +619,66 @@ fun RepositoryColumn(vcs: VcsInfo, expanded: Boolean) { } @Composable -fun CurationSection(curations: List) { +fun CurationSection(curatedPackage: CuratedPackage) { Expandable(header = { + val noOrSize = if (curatedPackage.curations.isEmpty()) "No" else curatedPackage.curations.size CaptionedText( caption = "CURATIONS", - text = "${if (curations.isEmpty()) "No" else curations.size} curation(s) were applied to this package." + text = "$noOrSize curation(s) were applied to this package." ) }) { Column( modifier = Modifier.padding(top = 5.dp), verticalArrangement = Arrangement.spacedBy(2.dp) ) { - curations.forEach { curation -> + curatedPackage.curations.forEach { curation -> Divider(thickness = 0.5.dp) ProvideTextStyle(MaterialTheme.typography.overline) { - Text("Comment: ${curation.curation.comment.toStringOrDash()}") + Text("Comment: ${curation.comment.toStringOrDash()}") - curation.curation.purl?.let { purl -> - Text("PURL: ${curation.base.purl} -> $purl") + curation.purl?.let { purl -> + Text("PURL: ${curatedPackage.metadata.purl} -> $purl") } - curation.curation.cpe?.let { cpe -> - Text("CPE: ${curation.base.cpe} -> $cpe") + curation.cpe?.let { cpe -> + Text("CPE: ${curatedPackage.metadata.cpe} -> $cpe") } - curation.curation.authors?.let { authors -> - Text("Authors: ${curation.base.authors} -> $authors") + curation.authors?.let { authors -> + Text("Authors: ${curatedPackage.metadata.authors} -> $authors") } - curation.curation.concludedLicense?.let { concludedLicense -> - Text("Concluded license: ${curation.base.concludedLicense} -> $concludedLicense") + curation.concludedLicense?.let { concludedLicense -> + Text("Concluded license: ${curatedPackage.metadata.concludedLicense} -> $concludedLicense") } - curation.curation.description?.let { description -> - Text("Description: ${curation.base.description} -> $description") + curation.description?.let { description -> + Text("Description: ${curatedPackage.metadata.description} -> $description") } - curation.curation.homepageUrl?.let { homepageUrl -> - Text("Homepage: ${curation.base.homepageUrl} -> $homepageUrl") + curation.homepageUrl?.let { homepageUrl -> + Text("Homepage: ${curatedPackage.metadata.homepageUrl} -> $homepageUrl") } - curation.curation.binaryArtifact?.let { binaryArtifact -> - Text("Binary artifact: ${curation.base.binaryArtifact} -> $binaryArtifact") + curation.binaryArtifact?.let { binaryArtifact -> + Text("Binary artifact: ${curatedPackage.metadata.binaryArtifact} -> $binaryArtifact") } - curation.curation.vcs?.let { vcs -> - Text("VCS: ${curation.base.vcs} -> $vcs") + curation.vcs?.let { vcs -> + Text("VCS: ${curatedPackage.metadata.vcs} -> $vcs") } - curation.curation.isMetadataOnly?.let { isMetadataOnly -> - Text("Is metadata only: ${curation.base.isMetadataOnly} -> $isMetadataOnly") + curation.isMetadataOnly?.let { isMetadataOnly -> + Text("Is metadata only: ${curatedPackage.metadata.isMetadataOnly} -> $isMetadataOnly") } - curation.curation.isModified?.let { isModified -> - Text("Is modified: ${curation.base.isModified} -> $isModified") + curation.isModified?.let { isModified -> + Text("Is modified: ${curatedPackage.metadata.isModified} -> $isModified") } - if (curation.curation.declaredLicenseMapping.isNotEmpty()) { - Text("Declared license mapping: ${curation.curation.declaredLicenseMapping}") + if (curation.declaredLicenseMapping.isNotEmpty()) { + Text("Declared license mapping: ${curation.declaredLicenseMapping}") } } } diff --git a/src/main/kotlin/ui/packagedetails/PackageDetails.kt b/src/main/kotlin/ui/packagedetails/PackageDetails.kt index 94045dd..363c42a 100644 --- a/src/main/kotlin/ui/packagedetails/PackageDetails.kt +++ b/src/main/kotlin/ui/packagedetails/PackageDetails.kt @@ -36,8 +36,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp +import org.ossreviewtoolkit.model.CuratedPackage import org.ossreviewtoolkit.model.Package -import org.ossreviewtoolkit.model.PackageCurationResult import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.RemoteArtifact import org.ossreviewtoolkit.model.licenses.LicenseView @@ -123,7 +123,7 @@ private fun PackageMetadata(packageInfo: PackageInfo) { PackageDescription(packageInfo.pkg.metadata) PackageArtifacts(packageInfo.pkg.metadata) PackageRepository(packageInfo.pkg.metadata) - PackageCurations(packageInfo.pkg.curations) + PackageCurations(packageInfo.pkg) } } } @@ -255,9 +255,9 @@ private fun PackageRepository(pkg: Package) { } @Composable -private fun PackageCurations(curations: List) { +private fun PackageCurations(curationedPackage: CuratedPackage) { PackageDetailsCard("Package Curations") { - if (curations.isEmpty()) { + if (curationedPackage.curations.isEmpty()) { Text("No package curations were applied.") } else { // TODO: Show package curations. diff --git a/src/main/kotlin/ui/packages/Packages.kt b/src/main/kotlin/ui/packages/Packages.kt index b098867..2c249e4 100644 --- a/src/main/kotlin/ui/packages/Packages.kt +++ b/src/main/kotlin/ui/packages/Packages.kt @@ -54,7 +54,7 @@ fun Packages(viewModel: PackagesViewModel, onSelectPackage: (Identifier) -> Unit items = state.packages, itemsEmptyText = "No packages found.", item = { pkg -> - PackageCard(pkg, onSelectPackage = { onSelectPackage(pkg.metadata.id) }) + PackageCard(pkg, onSelectPackage = { onSelectPackage(pkg.curatedPackage.metadata.id) }) } ) }, @@ -81,8 +81,8 @@ fun Packages(viewModel: PackagesViewModel, onSelectPackage: (Identifier) -> Unit @Composable fun PackageCard(pkg: PackageInfo, onSelectPackage: () -> Unit) { PackageCard( - id = pkg.metadata.id, - description = pkg.metadata.description, + id = pkg.curatedPackage.metadata.id, + description = pkg.curatedPackage.metadata.description, license = pkg.resolvedLicenseInfo.effectiveLicense(LicenseView.CONCLUDED_OR_DECLARED_AND_DETECTED).toString(), issues = pkg.issues.size, vulnerabilities = pkg.vulnerabilities.size, diff --git a/src/main/kotlin/ui/packages/PackagesViewModel.kt b/src/main/kotlin/ui/packages/PackagesViewModel.kt index d37037a..388e781 100644 --- a/src/main/kotlin/ui/packages/PackagesViewModel.kt +++ b/src/main/kotlin/ui/packages/PackagesViewModel.kt @@ -4,13 +4,11 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch +import org.ossreviewtoolkit.model.CuratedPackage import org.ossreviewtoolkit.model.Identifier -import org.ossreviewtoolkit.model.Package -import org.ossreviewtoolkit.model.PackageCurationResult import org.ossreviewtoolkit.model.Provenance import org.ossreviewtoolkit.model.ScanResult import org.ossreviewtoolkit.model.ScannerDetails @@ -60,8 +58,7 @@ class PackagesViewModel(private val ortModel: OrtModel) : ViewModel() { val scanResultInfos = api.getScanResults(pkg.metadata.id).map { it.toInfo() } PackageInfo( - metadata = pkg.metadata, - curations = pkg.curations, + curatedPackage = pkg, resolvedLicenseInfo = api.getResolvedLicense(pkg.metadata.id), references = references, issues = issues, @@ -91,8 +88,8 @@ class PackagesViewModel(private val ortModel: OrtModel) : ViewModel() { private fun initFilter(packages: List) { filter.value = filter.value.updateOptions( - types = packages.mapTo(sortedSetOf()) { it.metadata.id.type }.toList(), - namespaces = packages.mapTo(sortedSetOf()) { it.metadata.id.namespace }.toList(), + types = packages.mapTo(sortedSetOf()) { it.curatedPackage.metadata.id.type }.toList(), + namespaces = packages.mapTo(sortedSetOf()) { it.curatedPackage.metadata.id.namespace }.toList(), projects = packages.flatMapTo(sortedSetOf()) { it.references.map { it.project } }.toList(), scopes = packages.flatMapTo(sortedSetOf()) { it.references.flatMap { it.scopes.map { it.scope } } @@ -151,8 +148,7 @@ class PackagesViewModel(private val ortModel: OrtModel) : ViewModel() { } data class PackageInfo( - val metadata: Package, - val curations: List, + val curatedPackage: CuratedPackage, val resolvedLicenseInfo: ResolvedLicenseInfo, val references: List, val issues: List, @@ -181,9 +177,9 @@ data class PackagesFilter( val exclusionStatus: FilterData = FilterData() ) { fun check(pkg: PackageInfo) = - matchStringContains(text, pkg.metadata.id.toCoordinates()) - && matchString(type.selectedItem, pkg.metadata.id.type) - && matchString(namespace.selectedItem, pkg.metadata.id.namespace) + matchStringContains(text, pkg.curatedPackage.metadata.id.toCoordinates()) + && matchString(type.selectedItem, pkg.curatedPackage.metadata.id.type) + && matchString(namespace.selectedItem, pkg.curatedPackage.metadata.id.namespace) && matchAnyValue(project.selectedItem, pkg.references.map { it.project }) && matchString(scope.selectedItem, pkg.references.flatMap { it.scopes.map { it.scope } }) && matchAnyValue(license.selectedItem, pkg.resolvedLicenseInfo.licenses.map { it.license })