-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support both sbt 0.13 and sbt 1.0.0-M5
- Loading branch information
Showing
24 changed files
with
265 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,3 @@ script: | |
- sbt scripted | ||
jdk: | ||
- openjdk7 | ||
notifications: | ||
email: | ||
- joshua.suereth@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package sbt | ||
package sbtpgp | ||
|
||
import sbt.plugins.CommandLineUIServices | ||
|
||
object Compat { | ||
type PublishConfiguration = sbt.PublishConfiguration | ||
val defaultProgress = EvaluateTask.defaultProgress | ||
type InteractionService = sbt.InteractionService | ||
def defaultInteraction: InteractionService = CommandLineUIServices | ||
val interactionService = InteractionServiceKeys.interactionService | ||
|
||
def pgpRequires: Plugins = sbt.plugins.IvyPlugin && sbt.plugins.InteractionServicePlugin | ||
|
||
def compatSettings: Vector[Def.Setting[_]] = Vector() | ||
|
||
def subConfiguration(m: ModuleID, confs: Boolean): ModuleID = | ||
m.copy(configurations = if (confs) m.configurations else None) | ||
|
||
def subExplicitArtifacts(m: ModuleID, artifacts: Vector[Artifact]): ModuleID = | ||
m.copy(explicitArtifacts = artifacts) | ||
|
||
def subExtension(art: Artifact, ext: String): Artifact = | ||
art.copy(extension = ext) | ||
|
||
def subMissingOk(c: UpdateConfiguration, ok: Boolean): UpdateConfiguration = | ||
c.copy(missingOk = ok) | ||
|
||
def mkInlineConfiguration(base: ModuleID, deps: Vector[ModuleID], | ||
ivyScala: Option[IvyScala], confs: Vector[Configuration]): InlineConfiguration = | ||
InlineConfiguration(base, ModuleInfo(base.name), deps).copy(ivyScala = ivyScala, configurations = confs) | ||
|
||
implicit def log2ProcessLogger(log: Logger): sys.process.ProcessLogger = | ||
new BufferedLogger(new FullLogger(log)) with sys.process.ProcessLogger { | ||
def err(s: => String): Unit = error(s) | ||
def out(s: => String): Unit = info(s) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package sbt | ||
package sbtpgp | ||
|
||
import sbt.{ librarymanagement => lm } | ||
import sbt.internal.{ librarymanagement => ilm } | ||
|
||
object Compat { | ||
val IvyActions = ilm.IvyActions | ||
type PublishConfiguration = ilm.PublishConfiguration | ||
type IvySbt = ilm.IvySbt | ||
type IvyScala = lm.IvyScala | ||
type UpdateConfiguration = lm.UpdateConfiguration | ||
type InlineConfiguration = ilm.InlineConfiguration | ||
val InlineConfiguration = ilm.InlineConfiguration | ||
val defaultProgress = EvaluateTask.defaultProgress | ||
type InteractionService = sbt.sbtpgp.InteractionService | ||
|
||
def pgpRequires: Plugins = sbt.plugins.IvyPlugin | ||
|
||
val interactionService = taskKey[InteractionService]("Service used to ask for user input through the current user interface(s).") | ||
|
||
def compatSettings: Vector[Def.Setting[_]] = | ||
Vector( | ||
interactionService := defaultInteraction | ||
) | ||
|
||
def subConfiguration(m: ModuleID, confs: Boolean): ModuleID = | ||
m.withConfigurations( | ||
if (confs) m.configurations | ||
else None | ||
) | ||
|
||
def subExplicitArtifacts(m: ModuleID, artifacts: Vector[Artifact]): ModuleID = | ||
m.withExplicitArtifacts(artifacts) | ||
|
||
def subExtension(art: Artifact, ext: String): Artifact = | ||
art.withExtension(ext) | ||
|
||
def subMissingOk(c: UpdateConfiguration, ok: Boolean): UpdateConfiguration = | ||
c.withMissingOk(ok) | ||
|
||
def mkInlineConfiguration(base: ModuleID, deps: Vector[ModuleID], | ||
ivyScala: Option[IvyScala], confs: Vector[Configuration]): InlineConfiguration = | ||
InlineConfiguration(false, None, base, ModuleInfo(base.name), deps) | ||
.withIvyScala(ivyScala) | ||
.withConfigurations(confs) | ||
|
||
private lazy val commandLineUIServices: InteractionService = new CommandLineUIServices | ||
def defaultInteraction: InteractionService = commandLineUIServices | ||
} |
31 changes: 31 additions & 0 deletions
31
pgp-plugin/src/main/scala-sbt-1.0.0-M5/InteractionService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package sbt | ||
package sbtpgp | ||
|
||
trait InteractionService { | ||
/** Prompts the user for input, optionally with a mask for characters. */ | ||
def readLine(prompt: String, mask: Boolean): Option[String] | ||
/** Ask the user to confirm something (yes or no) before continuing. */ | ||
def confirm(msg: String): Boolean | ||
} | ||
|
||
class CommandLineUIServices extends InteractionService { | ||
def readLine(prompt: String, mask: Boolean): Option[String] = | ||
{ | ||
val maskChar = if (mask) Some('*') | ||
else None | ||
SimpleReader.readLine(prompt, maskChar) | ||
} | ||
|
||
def confirm(msg: String): Boolean = | ||
{ | ||
object Assent { | ||
def unapply(in: String): Boolean = { | ||
(in == "y" || in == "yes") | ||
} | ||
} | ||
SimpleReader.readLine(msg + " (yes/no): ", None) match { | ||
case Some(Assent()) => true | ||
case _ => false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/commands.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.