Skip to content

Commit

Permalink
refactor(pub): Reorder classes into packages
Browse files Browse the repository at this point in the history
Remove the `utils` package and move its only class to the root. In
exchange, group the `Lockfile` and `Pubspec` classes in a new `model`
package.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Oct 21, 2024
1 parent 7b1c5b9 commit 0efd79b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
10 changes: 7 additions & 3 deletions plugins/package-managers/pub/src/main/kotlin/Pub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
import org.ossreviewtoolkit.model.config.PackageManagerConfiguration
import org.ossreviewtoolkit.model.config.RepositoryConfiguration
import org.ossreviewtoolkit.model.createAndLogIssue
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.Dependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.SdkDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.utils.PubCacheReader
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Lockfile
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.PackageInfo
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.Dependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.SdkDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.parseLockfile
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.parsePubspec
import org.ossreviewtoolkit.utils.common.CommandLineTool
import org.ossreviewtoolkit.utils.common.Os
import org.ossreviewtoolkit.utils.common.ProcessCapture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.plugins.packagemanagers.pub.utils
package org.ossreviewtoolkit.plugins.packagemanagers.pub

import java.io.File

import org.apache.logging.log4j.kotlin.logger

import org.ossreviewtoolkit.downloader.VcsHost
import org.ossreviewtoolkit.plugins.packagemanagers.pub.PackageInfo
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.PackageInfo
import org.ossreviewtoolkit.utils.common.Os
import org.ossreviewtoolkit.utils.common.isSymbolicLink

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.plugins.packagemanagers.pub
package org.ossreviewtoolkit.plugins.packagemanagers.pub.model

import com.charleskorn.kaml.Yaml
import com.charleskorn.kaml.YamlConfiguration
Expand All @@ -39,7 +39,7 @@ import kotlinx.serialization.descriptors.SerialKind
import kotlinx.serialization.descriptors.buildSerialDescriptor
import kotlinx.serialization.encoding.Decoder

import org.ossreviewtoolkit.plugins.packagemanagers.pub.PackageInfo.Description
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.PackageInfo.Description

private val YAML = Yaml(configuration = YamlConfiguration(strictMode = false))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.plugins.packagemanagers.pub
package org.ossreviewtoolkit.plugins.packagemanagers.pub.model

import com.charleskorn.kaml.Yaml
import com.charleskorn.kaml.YamlConfiguration
Expand All @@ -38,11 +38,11 @@ import kotlinx.serialization.decodeFromString
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.serializer

import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.Dependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.GitDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.HostedDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.PathDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.SdkDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.Dependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.GitDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.HostedDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.PathDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.SdkDependency

private val YAML = Yaml(configuration = YamlConfiguration(strictMode = false))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.plugins.packagemanagers.pub.utils
package org.ossreviewtoolkit.plugins.packagemanagers.pub

import io.kotest.core.spec.style.WordSpec
import io.kotest.engine.spec.tempdir
import io.kotest.matchers.shouldBe

import java.io.File

import org.ossreviewtoolkit.plugins.packagemanagers.pub.PackageInfo
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.PackageInfo
import org.ossreviewtoolkit.utils.common.Os
import org.ossreviewtoolkit.utils.common.safeMkdirs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.plugins.packagemanagers.pub
package org.ossreviewtoolkit.plugins.packagemanagers.pub.model

import io.kotest.core.spec.style.WordSpec
import io.kotest.matchers.nulls.beNull
import io.kotest.matchers.should
import io.kotest.matchers.shouldBe

import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.GitDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.HostedDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.PathDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.Pubspec.SdkDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.GitDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.HostedDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.PathDependency
import org.ossreviewtoolkit.plugins.packagemanagers.pub.model.Pubspec.SdkDependency

class PubspecTest : WordSpec({
"parsePubspec()" should {
Expand Down

0 comments on commit 0efd79b

Please sign in to comment.