Skip to content

Commit 45bc688

Browse files
authored
Merge pull request #230 from anatoliykmetyuk/sbt2-compat-plugin
Replace partially compat layer with sbt2-compat plugin
2 parents 78e60e4 + 4630cbb commit 45bc688

6 files changed

Lines changed: 14 additions & 18 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ boot/
66
.scala_dependencies
77
/.idea
88
/.bsp
9+
10+
.metals/
11+
.vscode/
12+
.cursor/
13+
.bloop/
14+
metals.sbt
15+
.java-version

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ lazy val plugin = (project in file("sbt-pgp"))
4242
.settings(
4343
name := "sbt-pgp",
4444
libraryDependencies += gigahorseOkhttp.value,
45+
addSbtPlugin("com.github.sbt" % "sbt2-compat" % "0.1.0"),
4546
publishLocal := publishLocal.dependsOn((library / publishLocal)).value,
4647
scriptedBufferLog := false,
4748
scriptedLaunchOpts += s"-Dproject.version=${version.value}",

sbt-pgp/src/main/scala-2.12/Compat.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ object Compat {
6565
}
6666
)
6767

68-
def toFile(x: File, c: xsbti.FileConverter): File = x
69-
70-
def credentialForHost(cs: Seq[Credentials], host: String) =
71-
Credentials.forHost(cs, host)
72-
73-
implicit class DefOp(singleton: Def.type) {
74-
def uncached[A1](a: A1): A1 = a
75-
}
7668
@meta.getter
7769
class cacheLevel(
7870
include: Array[String]

sbt-pgp/src/main/scala-3/Compat.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,5 @@ object Compat {
6767
}
6868
)
6969

70-
def toFile(vf: xsbti.HashedVirtualFileRef, c: xsbti.FileConverter): File =
71-
c.toPath(vf).toFile()
72-
73-
def credentialForHost(cs: Seq[Credentials], host: String) =
74-
sbt.internal.librarymanagement.ivy.IvyCredentials.forHost(cs, host)
75-
7670
type cacheLevel = sbt.util.cacheLevel
7771
}

sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSettings.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Keys._
55
import SbtHelpers._
66
import PgpKeys._
77
import sbt.sbtpgp.Compat, Compat._
8+
import sbtcompat.PluginCompat._
89

910
/**
1011
* SBT Settings for doing PGP security tasks. Signing, verifying, etc.
@@ -144,15 +145,15 @@ object PgpSettings {
144145
}).value,
145146
publishSignedConfiguration := {
146147
val _ = pgpMakeIvy.value
147-
val c = fileConverter.value
148+
implicit val conv: xsbti.FileConverter = fileConverter.value
148149
Classpaths.publishConfig(
149150
publishMavenStyle.value,
150151
deliverPattern(crossTarget.value),
151152
if (isSnapshot.value) "integration" else "release",
152153
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
153154
PgpKeys.signedArtifacts.value.toVector.map {
154155
case (a, x) =>
155-
a -> toFile(x, c)
156+
a -> toFile(x)
156157
},
157158
checksums = (publish / checksums).value.toVector,
158159
resolverName = Classpaths.getPublishTo(publishTo.value).name,
@@ -163,15 +164,15 @@ object PgpSettings {
163164
publishSigned := publishSignedTask(publishSignedConfiguration, deliver).value,
164165
publishLocalSignedConfiguration := {
165166
val _ = deliverLocal.value
166-
val c = fileConverter.value
167+
implicit val conv: xsbti.FileConverter = fileConverter.value
167168
Classpaths.publishConfig(
168169
publishMavenStyle.value,
169170
deliverPattern(crossTarget.value),
170171
if (isSnapshot.value) "integration" else "release",
171172
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
172173
PgpKeys.signedArtifacts.value.toVector.map {
173174
case (a, x) =>
174-
a -> toFile(x, c)
175+
a -> toFile(x)
175176
},
176177
(publishLocal / checksums).value.toVector,
177178
resolverName = "local",

sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgp.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.jsuereth.sbtpgp
22

33
import sbt.{ given, * }
44
import sbt.sbtpgp.Compat._
5+
import sbtcompat.PluginCompat._
56

67
/**
78
* This class is used to control what we expose to

0 commit comments

Comments
 (0)