Skip to content

Commit

Permalink
refactor(swiftpm): Re-order the classes
Browse files Browse the repository at this point in the history
Move the public ones to the top.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Feb 2, 2024
1 parent bcdac56 commit 22a7baa
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions plugins/package-managers/swiftpm/src/main/kotlin/SwiftPmModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ data class SwiftPackage(
)
}

/**
* See https://github.com/apple/swift-package-manager/blob/3ef830dddff459e569d6e49c186c3ded33c39bcc/Sources/PackageGraph/PinsStore.swift#L387-L462.
*/
@Serializable
data class PinV2(
val identity: String,
val state: PinState?,
val location: String,
val kind: Kind
) {
enum class Kind {
@SerialName("localSourceControl")
LOCAL_SOURCE_CONTROL,
@SerialName("registry")
REGISTRY,
@SerialName("remoteSourceControl")
REMOTE_SOURCE_CONTROL
}
}

/**
* See https://github.com/apple/swift-package-manager/blob/3ef830dddff459e569d6e49c186c3ded33c39bcc/Sources/PackageGraph/PinsStore.swift#L351-L373
* and https://github.com/apple/swift-package-manager/blob/3ef830dddff459e569d6e49c186c3ded33c39bcc/Sources/PackageGraph/PinsStore.swift#L440-L461.
Expand All @@ -73,26 +93,6 @@ private data class PinV1(
@SerialName("repositoryURL") val repositoryUrl: String
)

/**
* See https://github.com/apple/swift-package-manager/blob/3ef830dddff459e569d6e49c186c3ded33c39bcc/Sources/PackageGraph/PinsStore.swift#L387-L462.
*/
@Serializable
data class PinV2(
val identity: String,
val state: PinState?,
val location: String,
val kind: Kind
) {
enum class Kind {
@SerialName("localSourceControl")
LOCAL_SOURCE_CONTROL,
@SerialName("registry")
REGISTRY,
@SerialName("remoteSourceControl")
REMOTE_SOURCE_CONTROL
}
}

internal fun parseLockfile(packageResolvedFile: File): Result<Set<PinV2>> =
runCatching {
val root = json.parseToJsonElement(packageResolvedFile.readText()).jsonObject
Expand Down

0 comments on commit 22a7baa

Please sign in to comment.