Skip to content

Commit

Permalink
deps: update ort to v46
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored and sschuberth committed Jan 16, 2025
1 parent 4f464cd commit 05f0c59
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 48 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
56 changes: 28 additions & 28 deletions src/main/kotlin/ui/dependencies/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -620,65 +619,66 @@ fun RepositoryColumn(vcs: VcsInfo, expanded: Boolean) {
}

@Composable
fun CurationSection(curations: List<PackageCurationResult>) {
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}")
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/ui/packagedetails/PackageDetails.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -255,9 +255,9 @@ private fun PackageRepository(pkg: Package) {
}

@Composable
private fun PackageCurations(curations: List<PackageCurationResult>) {
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.
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/ui/packages/Packages.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
}
)
},
Expand All @@ -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,
Expand Down
20 changes: 8 additions & 12 deletions src/main/kotlin/ui/packages/PackagesViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -91,8 +88,8 @@ class PackagesViewModel(private val ortModel: OrtModel) : ViewModel() {

private fun initFilter(packages: List<PackageInfo>) {
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 } }
Expand Down Expand Up @@ -151,8 +148,7 @@ class PackagesViewModel(private val ortModel: OrtModel) : ViewModel() {
}

data class PackageInfo(
val metadata: Package,
val curations: List<PackageCurationResult>,
val curatedPackage: CuratedPackage,
val resolvedLicenseInfo: ResolvedLicenseInfo,
val references: List<DependencyReference>,
val issues: List<ResolvedIssue>,
Expand Down Expand Up @@ -181,9 +177,9 @@ data class PackagesFilter(
val exclusionStatus: FilterData<ExclusionStatus> = 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 })
Expand Down

0 comments on commit 05f0c59

Please sign in to comment.