Skip to content

Commit

Permalink
Relax some private for scripted
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Jan 5, 2025
1 parent e399c45 commit 3e0aefe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
18 changes: 8 additions & 10 deletions src/main/scala-2.12/com/typesafe/sbt/packager/PluginCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ object PluginCompat {
type Out = java.io.File
type IncludeArtifact = Artifact => Boolean

private[packager] val artifactStr = sbt.Keys.artifact.key
private[packager] val moduleIDStr = sbt.Keys.moduleID.key
val artifactStr = sbt.Keys.artifact.key
val moduleIDStr = sbt.Keys.moduleID.key
private[packager] def parseModuleIDStrAttribute(m: ModuleID): ModuleID = m
private[packager] def moduleIDToStr(m: ModuleID): ModuleID = m
def moduleIDToStr(m: ModuleID): ModuleID = m
private[packager] def parseArtifactStrAttribute(a: Artifact): Artifact = a
private[packager] def artifactToStr(art: Artifact): Artifact = art
def artifactToStr(art: Artifact): Artifact = art

private[packager] def toNioPath(a: Attributed[File])(implicit conv: FileConverter): NioPath =
a.data.toPath()
private[packager] def toNioPath(ref: File)(implicit conv: FileConverter): NioPath =
ref.toPath()
private[packager] def toFile(a: Attributed[File])(implicit conv: FileConverter): File =
def toFile(a: Attributed[File])(implicit conv: FileConverter): File =
a.data
private[packager] def toFile(ref: File)(implicit conv: FileConverter): File =
def toFile(ref: File)(implicit conv: FileConverter): File =
ref
private[packager] def artifactPathToFile(ref: File)(implicit conv: FileConverter): File =
ref
Expand All @@ -33,11 +33,9 @@ object PluginCompat {
cp.map(_.data.toPath()).toVector
private[packager] def toFiles(cp: Seq[Attributed[File]])(implicit conv: FileConverter): Vector[File] =
cp.map(_.data).toVector
private[packager] def toFileRefsMapping(mappings: Seq[(File, String)])(implicit
conv: FileConverter
): Seq[(FileRef, String)] =
def toFileRefsMapping(mappings: Seq[(File, String)])(implicit conv: FileConverter): Seq[(FileRef, String)] =
mappings
private[packager] def toFileRef(x: File)(implicit conv: FileConverter): FileRef =
def toFileRef(x: File)(implicit conv: FileConverter): FileRef =
x
private[packager] def getName(ref: File): String =
ref.getName()
Expand Down
20 changes: 9 additions & 11 deletions src/main/scala-3/com/typesafe/sbt/packager/PluginCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ object PluginCompat {
type Out = VirtualFile
type IncludeArtifact = Any => Boolean

private[packager] val artifactStr = Keys.artifactStr
private[packager] val moduleIDStr = Keys.moduleIDStr
private[packager] def parseModuleIDStrAttribute(str: String): ModuleID =
val artifactStr = Keys.artifactStr
val moduleIDStr = Keys.moduleIDStr
def parseModuleIDStrAttribute(str: String): ModuleID =
Classpaths.moduleIdJsonKeyFormat.read(str)
private[packager] def moduleIDToStr(m: ModuleID): String =
def moduleIDToStr(m: ModuleID): String =
Classpaths.moduleIdJsonKeyFormat.write(m)

private[packager] def parseArtifactStrAttribute(str: String): Artifact =
import sbt.librarymanagement.LibraryManagementCodec.ArtifactFormat
import sjsonnew.support.scalajson.unsafe.*
Converter.fromJsonUnsafe[Artifact](Parser.parseUnsafe(str))
private[packager] def artifactToStr(art: Artifact): String =
def artifactToStr(art: Artifact): String =
import sbt.librarymanagement.LibraryManagementCodec.ArtifactFormat
import sjsonnew.support.scalajson.unsafe.*
CompactPrinter(Converter.toJsonUnsafe(art))
Expand All @@ -33,9 +33,9 @@ object PluginCompat {
conv.toPath(a.data)
private[packager] def toNioPath(ref: HashedVirtualFileRef)(using conv: FileConverter): NioPath =
conv.toPath(ref)
private[packager] def toFile(a: Attributed[HashedVirtualFileRef])(using conv: FileConverter): File =
def toFile(a: Attributed[HashedVirtualFileRef])(using conv: FileConverter): File =
toNioPath(a).toFile()
private[packager] def toFile(ref: HashedVirtualFileRef)(using conv: FileConverter): File =
def toFile(ref: HashedVirtualFileRef)(using conv: FileConverter): File =
toNioPath(ref).toFile()
private[packager] def artifactPathToFile(ref: VirtualFileRef)(using conv: FileConverter): File =
conv.toPath(ref).toFile()
Expand All @@ -47,11 +47,9 @@ object PluginCompat {
cp.map(toNioPath).toVector
private[packager] def toFiles(cp: Seq[Attributed[HashedVirtualFileRef]])(using conv: FileConverter): Vector[File] =
toNioPaths(cp).map(_.toFile())
private[packager] def toFileRefsMapping(mappings: Seq[(File, String)])(using
conv: FileConverter
): Seq[(FileRef, String)] =
def toFileRefsMapping(mappings: Seq[(File, String)])(using conv: FileConverter): Seq[(FileRef, String)] =
mappings.map { case (f, name) => toFileRef(f) -> name }
private[packager] def toFileRef(x: File)(using conv: FileConverter): FileRef =
def toFileRef(x: File)(using conv: FileConverter): FileRef =
conv.toVirtualFile(x.toPath())
private[packager] def getName(ref: FileRef): String =
ref.name()
Expand Down

0 comments on commit 3e0aefe

Please sign in to comment.