mirror of https://github.com/sbt/sbt.git
Merge pull request #2139 from pdalpra/drop-procedure-syntax
Replace procedure syntax by explicit Unit annotation
This commit is contained in:
commit
5a47e5d6ae
|
|
@ -38,7 +38,7 @@ object ReplaceMavenConfigurationMappings {
|
|||
// NOTE - This code is copied from org.apache.ivy.plugins.parser.m2.PomModuleDescriptorBuilder
|
||||
// except with altered default configurations...
|
||||
REPLACEMENT_MAPPINGS.put("compile", new PomModuleDescriptorBuilder.ConfMapper {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean) {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
|
||||
if (isOptional) {
|
||||
dd.addDependencyConfiguration("optional", "compile(*)")
|
||||
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
|
||||
|
|
@ -52,7 +52,7 @@ object ReplaceMavenConfigurationMappings {
|
|||
}
|
||||
})
|
||||
REPLACEMENT_MAPPINGS.put("provided", new PomModuleDescriptorBuilder.ConfMapper {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean) {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
|
||||
if (isOptional) {
|
||||
dd.addDependencyConfiguration("optional", "compile(*)")
|
||||
dd.addDependencyConfiguration("optional", "provided(*)")
|
||||
|
|
@ -70,7 +70,7 @@ object ReplaceMavenConfigurationMappings {
|
|||
})
|
||||
|
||||
REPLACEMENT_MAPPINGS.put("runtime", new PomModuleDescriptorBuilder.ConfMapper {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean) {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
|
||||
if (isOptional) {
|
||||
dd.addDependencyConfiguration("optional", "compile(*)")
|
||||
dd.addDependencyConfiguration("optional", "provided(*)")
|
||||
|
|
@ -86,7 +86,7 @@ object ReplaceMavenConfigurationMappings {
|
|||
})
|
||||
|
||||
REPLACEMENT_MAPPINGS.put("test", new PomModuleDescriptorBuilder.ConfMapper {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean) {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
|
||||
dd.addDependencyConfiguration("test", "runtime(*)")
|
||||
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
|
||||
dd.addDependencyConfiguration("test", "master(compile)")
|
||||
|
|
@ -94,7 +94,7 @@ object ReplaceMavenConfigurationMappings {
|
|||
})
|
||||
|
||||
REPLACEMENT_MAPPINGS.put("system", new PomModuleDescriptorBuilder.ConfMapper {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean) {
|
||||
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
|
||||
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
|
||||
dd.addDependencyConfiguration("system", "master(compile)")
|
||||
}
|
||||
|
|
@ -115,4 +115,4 @@ object ReplaceMavenConfigurationMappings {
|
|||
throw new RuntimeException("FAILURE to install Ivy maven hooks. Your ivy-maven interaction may suffer resolution errors", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ object ConflictWarning {
|
|||
@deprecated("Warning on evicted modules is no longer done, so this is the same as `default`. Use a standard Ivy conflict manager.", "0.13.0")
|
||||
def strict(label: String): ConflictWarning = ConflictWarning(label, Level.Error, true)
|
||||
|
||||
def apply(config: ConflictWarning, report: UpdateReport, log: Logger) {
|
||||
def apply(config: ConflictWarning, report: UpdateReport, log: Logger): Unit = {
|
||||
processCrossVersioned(config, report, log)
|
||||
}
|
||||
private[this] def processCrossVersioned(config: ConflictWarning, report: UpdateReport, log: Logger) {
|
||||
private[this] def processCrossVersioned(config: ConflictWarning, report: UpdateReport, log: Logger): Unit = {
|
||||
val crossMismatches = crossVersionMismatches(report)
|
||||
if (crossMismatches.nonEmpty) {
|
||||
val pre = s"Modules were resolved with conflicting cross-version suffixes in ${config.label}:\n "
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ private[sbt] object ConvertResolver {
|
|||
{
|
||||
val pattern = Collections.singletonList(Resolver.resolvePattern(repo.root, Resolver.mavenStyleBasePattern))
|
||||
final class PluginCapableResolver extends IBiblioResolver with ChecksumFriendlyURLResolver with DescriptorRequired {
|
||||
def setPatterns() {
|
||||
def setPatterns(): Unit = {
|
||||
// done this way for access to protected methods.
|
||||
setArtifactPatterns(pattern)
|
||||
setIvyPatterns(pattern)
|
||||
|
|
@ -189,18 +189,18 @@ private[sbt] object ConvertResolver {
|
|||
def hasExplicitURL(dd: DependencyDescriptor): Boolean =
|
||||
dd.getAllDependencyArtifacts.exists(_.getUrl != null)
|
||||
}
|
||||
private def initializeMavenStyle(resolver: IBiblioResolver, name: String, root: String) {
|
||||
private def initializeMavenStyle(resolver: IBiblioResolver, name: String, root: String): Unit = {
|
||||
resolver.setName(name)
|
||||
resolver.setM2compatible(true)
|
||||
resolver.setRoot(root)
|
||||
}
|
||||
private def initializeSSHResolver(resolver: AbstractSshBasedResolver, repo: SshBasedRepository, settings: IvySettings) {
|
||||
private def initializeSSHResolver(resolver: AbstractSshBasedResolver, repo: SshBasedRepository, settings: IvySettings): Unit = {
|
||||
resolver.setName(repo.name)
|
||||
resolver.setPassfile(null)
|
||||
initializePatterns(resolver, repo.patterns, settings)
|
||||
initializeConnection(resolver, repo.connection)
|
||||
}
|
||||
private def initializeConnection(resolver: AbstractSshBasedResolver, connection: RepositoryHelpers.SshConnection) {
|
||||
private def initializeConnection(resolver: AbstractSshBasedResolver, connection: RepositoryHelpers.SshConnection): Unit = {
|
||||
import resolver._
|
||||
import connection._
|
||||
hostname.foreach(setHost)
|
||||
|
|
@ -216,7 +216,7 @@ private[sbt] object ConvertResolver {
|
|||
setUser(user)
|
||||
}
|
||||
}
|
||||
private def initializePatterns(resolver: AbstractPatternsBasedResolver, patterns: Patterns, settings: IvySettings) {
|
||||
private def initializePatterns(resolver: AbstractPatternsBasedResolver, patterns: Patterns, settings: IvySettings): Unit = {
|
||||
resolver.setM2compatible(patterns.isMavenCompatible)
|
||||
resolver.setDescriptor(if (patterns.descriptorOptional) BasicResolver.DESCRIPTOR_OPTIONAL else BasicResolver.DESCRIPTOR_REQUIRED)
|
||||
resolver.setCheckconsistency(!patterns.skipConsistencyCheck)
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ private[sbt] object CustomXmlParser extends XmlModuleDescriptorParser {
|
|||
super.setResource(new URLResource(url))
|
||||
super.setInput(url)
|
||||
}
|
||||
def setInput(bytes: Array[Byte]) { setInput(new ByteArrayInputStream(bytes)) }
|
||||
def setInput(bytes: Array[Byte]): Unit = setInput(new ByteArrayInputStream(bytes))
|
||||
/** Overridden because the super implementation overwrites the module descriptor.*/
|
||||
override def setResource(res: Resource) {}
|
||||
override def setResource(res: Resource): Unit = ()
|
||||
override def setMd(md: DefaultModuleDescriptor) =
|
||||
{
|
||||
super.setMd(md)
|
||||
|
|
@ -32,4 +32,4 @@ private[sbt] object CustomXmlParser extends XmlModuleDescriptorParser {
|
|||
override def parseDepsConfs(confs: String, dd: DefaultDependencyDescriptor) = super.parseDepsConfs(confs, dd)
|
||||
override def getDefaultConf = defaultConfig.getOrElse(super.getDefaultConf)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ final class IvySbt(val configuration: IvyConfiguration) {
|
|||
addScalaToolDependencies(dmd, parser, is)
|
||||
(dmd, parser.getDefaultConf)
|
||||
}
|
||||
private def addScalaToolDependencies(dmd: DefaultModuleDescriptor, parser: CustomXmlParser.CustomParser, is: IvyScala) {
|
||||
private def addScalaToolDependencies(dmd: DefaultModuleDescriptor, parser: CustomXmlParser.CustomParser, is: IvyScala): Unit = {
|
||||
IvySbt.addConfigurations(dmd, Configurations.ScalaTool :: Nil)
|
||||
IvySbt.addDependencies(dmd, ScalaArtifacts.toolDependencies(is.scalaOrganization, is.scalaFullVersion), parser)
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ private[sbt] object IvySbt {
|
|||
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
||||
def defaultPOM(project: File) = new File(project, DefaultMavenFilename)
|
||||
|
||||
def loadURI(is: IvySettings, uri: URI) {
|
||||
def loadURI(is: IvySettings, uri: URI): Unit = {
|
||||
if (uri.getScheme == "file")
|
||||
is.load(new File(uri)) // IVY-1114
|
||||
else
|
||||
|
|
@ -268,7 +268,7 @@ private[sbt] object IvySbt {
|
|||
* Sets the resolvers for 'settings' to 'resolvers'. This is done by creating a new chain and making it the default.
|
||||
* 'other' is for resolvers that should be in a different chain. These are typically used for publishing or other actions.
|
||||
*/
|
||||
private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], other: Seq[Resolver], localOnly: Boolean, updateOptions: UpdateOptions, log: Logger) {
|
||||
private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], other: Seq[Resolver], localOnly: Boolean, updateOptions: UpdateOptions, log: Logger): Unit = {
|
||||
def makeChain(label: String, name: String, rs: Seq[Resolver]) = {
|
||||
log.debug(label + " repositories:")
|
||||
val chain = resolverChain(name, rs, localOnly, settings, updateOptions, log)
|
||||
|
|
@ -304,7 +304,7 @@ private[sbt] object IvySbt {
|
|||
|
||||
}
|
||||
}
|
||||
def addResolvers(resolvers: Seq[Resolver], settings: IvySettings, log: Logger) {
|
||||
def addResolvers(resolvers: Seq[Resolver], settings: IvySettings, log: Logger): Unit = {
|
||||
for (r <- resolvers) {
|
||||
log.debug("\t" + r)
|
||||
settings.addResolver(ConvertResolver(r, settings, log))
|
||||
|
|
@ -320,7 +320,7 @@ private[sbt] object IvySbt {
|
|||
import collection.JavaConversions._
|
||||
artifact.getQualifiedExtraAttributes.keys.exists(_.asInstanceOf[String] startsWith "m:")
|
||||
}
|
||||
private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration], log: Logger) {
|
||||
private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration], log: Logger): Unit = {
|
||||
val existing = settings.getResolverNames
|
||||
for (moduleConf <- moduleConfigurations) {
|
||||
import moduleConf._
|
||||
|
|
@ -332,11 +332,11 @@ private[sbt] object IvySbt {
|
|||
settings.addModuleConfiguration(attributes, settings.getMatcher(EXACT_OR_REGEXP), resolver.name, null, null, null)
|
||||
}
|
||||
}
|
||||
private def configureCache(settings: IvySettings, localOnly: Boolean, resCacheDir: Option[File]) {
|
||||
private def configureCache(settings: IvySettings, localOnly: Boolean, resCacheDir: Option[File]): Unit = {
|
||||
configureResolutionCache(settings, localOnly, resCacheDir)
|
||||
configureRepositoryCache(settings, localOnly)
|
||||
}
|
||||
private[this] def configureResolutionCache(settings: IvySettings, localOnly: Boolean, resCacheDir: Option[File]) {
|
||||
private[this] def configureResolutionCache(settings: IvySettings, localOnly: Boolean, resCacheDir: Option[File]): Unit = {
|
||||
val base = resCacheDir getOrElse settings.getDefaultResolutionCacheBasedir
|
||||
settings.setResolutionCacheManager(new ResolutionCache(base, settings))
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ private[sbt] object IvySbt {
|
|||
case _ => false
|
||||
}
|
||||
// ignore the original resolver wherever possible to avoid issues like #704
|
||||
override def saveResolvers(descriptor: ModuleDescriptor, metadataResolverName: String, artifactResolverName: String) {}
|
||||
override def saveResolvers(descriptor: ModuleDescriptor, metadataResolverName: String, artifactResolverName: String): Unit = ()
|
||||
}
|
||||
manager.setArtifactPattern(PluginPattern + manager.getArtifactPattern)
|
||||
manager.setDataFilePattern(PluginPattern + manager.getDataFilePattern)
|
||||
|
|
@ -411,12 +411,12 @@ private[sbt] object IvySbt {
|
|||
dmd.addExtraAttributeNamespace("e", "http://ant.apache.org/ivy/extra")
|
||||
|
||||
/** Adds the ivy.xml main artifact. */
|
||||
private def addMainArtifact(moduleID: DefaultModuleDescriptor) {
|
||||
private def addMainArtifact(moduleID: DefaultModuleDescriptor): Unit = {
|
||||
val artifact = DefaultArtifact.newIvyArtifact(moduleID.getResolvedModuleRevisionId, moduleID.getPublicationDate)
|
||||
moduleID.setModuleArtifact(artifact)
|
||||
moduleID.check()
|
||||
}
|
||||
private def setConflictManager(moduleID: DefaultModuleDescriptor, conflict: ConflictManager, is: IvySettings) {
|
||||
private def setConflictManager(moduleID: DefaultModuleDescriptor, conflict: ConflictManager, is: IvySettings): Unit = {
|
||||
val mid = ModuleId.newInstance(conflict.organization, conflict.module)
|
||||
val matcher = is.getMatcher(PatternMatcher.EXACT_OR_REGEXP)
|
||||
val manager = is.getConflictManager(conflict.name)
|
||||
|
|
@ -555,7 +555,7 @@ private[sbt] object IvySbt {
|
|||
}
|
||||
|
||||
/** This method is used to add inline dependencies to the provided module. */
|
||||
def addDependencies(moduleID: DefaultModuleDescriptor, dependencies: Seq[ModuleID], parser: CustomXmlParser.CustomParser) {
|
||||
def addDependencies(moduleID: DefaultModuleDescriptor, dependencies: Seq[ModuleID], parser: CustomXmlParser.CustomParser): Unit = {
|
||||
val converted = dependencies map { dependency => convertDependency(moduleID, dependency, parser) }
|
||||
val unique = if (hasDuplicateDependencies(converted)) mergeDuplicateDefinitions(converted) else converted
|
||||
unique foreach moduleID.addDependency
|
||||
|
|
@ -579,7 +579,7 @@ private[sbt] object IvySbt {
|
|||
*/
|
||||
def mergeDuplicateDefinitions(dependencies: Seq[DependencyDescriptor]): Seq[DependencyDescriptor] =
|
||||
{
|
||||
// need to preserve basic order of dependencies: can't use dependencies.groupBy
|
||||
// need to preserve basic order of dependencies: can't use dependencies.groupBy
|
||||
val deps = new java.util.LinkedHashMap[ModuleRevisionId, List[DependencyDescriptor]]
|
||||
for (dd <- dependencies) {
|
||||
val id = dd.getDependencyRevisionId
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ object UpdateLogging extends Enumeration {
|
|||
|
||||
object IvyActions {
|
||||
/** Installs the dependencies of the given 'module' from the resolver named 'from' to the resolver named 'to'.*/
|
||||
def install(module: IvySbt#Module, from: String, to: String, log: Logger) {
|
||||
def install(module: IvySbt#Module, from: String, to: String, log: Logger): Unit = {
|
||||
module.withModule(log) { (ivy, md, default) =>
|
||||
for (dependency <- md.getDependencies) {
|
||||
log.info("Installing " + dependency)
|
||||
|
|
@ -89,7 +89,7 @@ object IvyActions {
|
|||
}
|
||||
|
||||
/** Creates a Maven pom from the given Ivy configuration*/
|
||||
def makePom(module: IvySbt#Module, configuration: MakePomConfiguration, log: Logger) {
|
||||
def makePom(module: IvySbt#Module, configuration: MakePomConfiguration, log: Logger): Unit = {
|
||||
import configuration.{ allRepositories, moduleInfo, configurations, extra, file, filterRepositories, process, includeTypes }
|
||||
module.withModule(log) { (ivy, md, default) =>
|
||||
(new MakePom(log)).write(ivy, md, moduleInfo, configurations, includeTypes, extra, process, filterRepositories, allRepositories, file)
|
||||
|
|
@ -112,7 +112,7 @@ object IvyActions {
|
|||
def deliveredFile(ivy: Ivy, pattern: String, md: ModuleDescriptor): File =
|
||||
ivy.getSettings.resolveFile(IvyPatternHelper.substitute(pattern, md.getResolvedModuleRevisionId))
|
||||
|
||||
def publish(module: IvySbt#Module, configuration: PublishConfiguration, log: Logger) {
|
||||
def publish(module: IvySbt#Module, configuration: PublishConfiguration, log: Logger): Unit = {
|
||||
import configuration._
|
||||
module.withModule(log) {
|
||||
case (ivy, md, default) =>
|
||||
|
|
@ -368,7 +368,7 @@ object IvyActions {
|
|||
}
|
||||
}
|
||||
}
|
||||
private[this] def checkFilesPresent(artifacts: Seq[(IArtifact, File)]) {
|
||||
private[this] def checkFilesPresent(artifacts: Seq[(IArtifact, File)]): Unit = {
|
||||
val missing = artifacts filter { case (a, file) => !file.exists }
|
||||
if (missing.nonEmpty)
|
||||
sys.error("Missing files for publishing:\n\t" + missing.map(_._2.getAbsolutePath).mkString("\n\t"))
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ private object NotInCache {
|
|||
class IvyCache(val ivyHome: Option[File]) {
|
||||
def lockFile = new File(ivyHome getOrElse Path.userHome, ".sbt.cache.lock")
|
||||
/** Caches the given 'file' with the given ID. It may be retrieved or cleared using this ID.*/
|
||||
def cacheJar(moduleID: ModuleID, file: File, lock: Option[xsbti.GlobalLock], log: Logger) {
|
||||
def cacheJar(moduleID: ModuleID, file: File, lock: Option[xsbti.GlobalLock], log: Logger): Unit = {
|
||||
val artifact = defaultArtifact(moduleID)
|
||||
val resolved = new ResolvedResource(new FileResource(new IvyFileRepository, file), moduleID.revision)
|
||||
withDefaultCache(lock, log) { cache =>
|
||||
|
|
@ -37,7 +37,7 @@ class IvyCache(val ivyHome: Option[File]) {
|
|||
}
|
||||
}
|
||||
/** Clears the cache of the jar for the given ID.*/
|
||||
def clearCachedJar(id: ModuleID, lock: Option[xsbti.GlobalLock], log: Logger) {
|
||||
def clearCachedJar(id: ModuleID, lock: Option[xsbti.GlobalLock], log: Logger): Unit = {
|
||||
try { withCachedJar(id, lock, log)(_.delete) }
|
||||
catch { case e: Exception => log.debug("Error cleaning cached jar: " + e.toString) }
|
||||
}
|
||||
|
|
@ -87,11 +87,11 @@ class IvyCache(val ivyHome: Option[File]) {
|
|||
}
|
||||
/** Required by Ivy for copying to the cache.*/
|
||||
private class FileDownloader extends ResourceDownloader with NotNull {
|
||||
def download(artifact: IvyArtifact, resource: Resource, dest: File) {
|
||||
def download(artifact: IvyArtifact, resource: Resource, dest: File): Unit = {
|
||||
if (dest.exists()) dest.delete()
|
||||
val part = new File(dest.getAbsolutePath + ".part")
|
||||
FileUtil.copy(resource.openStream, part, null)
|
||||
if (!part.renameTo(dest))
|
||||
sys.error("Could not move temporary file " + part + " to final location " + dest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import org.apache.ivy.util.{ Message, MessageLogger, MessageLoggerEngine }
|
|||
|
||||
/** Interface to Ivy logging. */
|
||||
private final class IvyLoggerInterface(logger: Logger) extends MessageLogger {
|
||||
def rawlog(msg: String, level: Int) = log(msg, level)
|
||||
def log(msg: String, level: Int) {
|
||||
def rawlog(msg: String, level: Int): Unit = log(msg, level)
|
||||
def log(msg: String, level: Int): Unit = {
|
||||
import Message.{ MSG_DEBUG, MSG_VERBOSE, MSG_INFO, MSG_WARN, MSG_ERR }
|
||||
level match {
|
||||
case MSG_DEBUG => debug(msg)
|
||||
|
|
@ -20,32 +20,32 @@ private final class IvyLoggerInterface(logger: Logger) extends MessageLogger {
|
|||
}
|
||||
//DEBUG level messages are very verbose and rarely useful to users.
|
||||
// TODO: provide access to this information some other way
|
||||
def debug(msg: String) {}
|
||||
def verbose(msg: String) = logger.verbose(msg)
|
||||
def deprecated(msg: String) = warn(msg)
|
||||
def info(msg: String) = logger.info(msg)
|
||||
def rawinfo(msg: String) = info(msg)
|
||||
def warn(msg: String) = logger.warn(msg)
|
||||
def error(msg: String) = if (SbtIvyLogger.acceptError(msg)) logger.error(msg)
|
||||
def debug(msg: String): Unit = ()
|
||||
def verbose(msg: String): Unit = logger.verbose(msg)
|
||||
def deprecated(msg: String): Unit = warn(msg)
|
||||
def info(msg: String): Unit = logger.info(msg)
|
||||
def rawinfo(msg: String): Unit = info(msg)
|
||||
def warn(msg: String): Unit = logger.warn(msg)
|
||||
def error(msg: String): Unit = if (SbtIvyLogger.acceptError(msg)) logger.error(msg)
|
||||
|
||||
private def emptyList = java.util.Collections.emptyList[String]
|
||||
def getProblems = emptyList
|
||||
def getWarns = emptyList
|
||||
def getErrors = emptyList
|
||||
|
||||
def clearProblems = ()
|
||||
def sumupProblems = clearProblems()
|
||||
def progress = ()
|
||||
def endProgress = ()
|
||||
def clearProblems(): Unit = ()
|
||||
def sumupProblems(): Unit = clearProblems()
|
||||
def progress(): Unit = ()
|
||||
def endProgress(): Unit = ()
|
||||
|
||||
def endProgress(msg: String) = info(msg)
|
||||
def endProgress(msg: String): Unit = info(msg)
|
||||
def isShowProgress = false
|
||||
def setShowProgress(progress: Boolean) {}
|
||||
def setShowProgress(progress: Boolean): Unit = ()
|
||||
}
|
||||
private final class SbtMessageLoggerEngine extends MessageLoggerEngine {
|
||||
/** This is a hack to filter error messages about 'unknown resolver ...'. */
|
||||
override def error(msg: String) = if (SbtIvyLogger.acceptError(msg)) super.error(msg)
|
||||
override def sumupProblems = clearProblems()
|
||||
override def error(msg: String): Unit = if (SbtIvyLogger.acceptError(msg)) super.error(msg)
|
||||
override def sumupProblems(): Unit = clearProblems()
|
||||
}
|
||||
private object SbtIvyLogger {
|
||||
val UnknownResolver = "unknown resolver"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ final case class IvyScala(scalaFullVersion: String, scalaBinaryVersion: String,
|
|||
|
||||
private object IvyScala {
|
||||
/** Performs checks/adds filters on Scala dependencies (if enabled in IvyScala). */
|
||||
def checkModule(module: DefaultModuleDescriptor, conf: String, log: Logger)(check: IvyScala) {
|
||||
def checkModule(module: DefaultModuleDescriptor, conf: String, log: Logger)(check: IvyScala): Unit = {
|
||||
if (check.checkExplicit)
|
||||
checkDependencies(module, check.scalaBinaryVersion, check.configurations, log)
|
||||
if (check.filterImplicit)
|
||||
|
|
@ -45,12 +45,12 @@ private object IvyScala {
|
|||
if (check.overrideScalaVersion)
|
||||
overrideScalaVersion(module, check.scalaFullVersion)
|
||||
}
|
||||
def overrideScalaVersion(module: DefaultModuleDescriptor, version: String) {
|
||||
def overrideScalaVersion(module: DefaultModuleDescriptor, version: String): Unit = {
|
||||
overrideVersion(module, Organization, LibraryID, version)
|
||||
overrideVersion(module, Organization, CompilerID, version)
|
||||
overrideVersion(module, Organization, ReflectID, version)
|
||||
}
|
||||
def overrideVersion(module: DefaultModuleDescriptor, org: String, name: String, version: String) {
|
||||
def overrideVersion(module: DefaultModuleDescriptor, org: String, name: String, version: String): Unit = {
|
||||
val id = new ModuleId(org, name)
|
||||
val over = new OverrideDependencyDescriptorMediator(null, version)
|
||||
module.addDependencyDescriptorMediator(id, ExactPatternMatcher.INSTANCE, over)
|
||||
|
|
@ -60,7 +60,7 @@ private object IvyScala {
|
|||
* Checks the immediate dependencies of module for dependencies on scala jars and verifies that the version on the
|
||||
* dependencies matches scalaVersion.
|
||||
*/
|
||||
private def checkDependencies(module: ModuleDescriptor, scalaBinaryVersion: String, configurations: Iterable[Configuration], log: Logger) {
|
||||
private def checkDependencies(module: ModuleDescriptor, scalaBinaryVersion: String, configurations: Iterable[Configuration], log: Logger): Unit = {
|
||||
val configSet = if (configurations.isEmpty) (c: String) => true else configurationSet(configurations)
|
||||
def binaryScalaWarning(dep: DependencyDescriptor): Option[String] =
|
||||
{
|
||||
|
|
@ -88,7 +88,7 @@ private object IvyScala {
|
|||
* done because these jars are provided by the ScalaInstance of the project. The version of Scala to use
|
||||
* is done by setting scalaVersion in the project definition.
|
||||
*/
|
||||
private def excludeScalaJars(module: DefaultModuleDescriptor, configurations: Iterable[Configuration]) {
|
||||
private def excludeScalaJars(module: DefaultModuleDescriptor, configurations: Iterable[Configuration]): Unit = {
|
||||
val configurationNames =
|
||||
{
|
||||
val names = module.getConfigurationsNames
|
||||
|
|
|
|||
|
|
@ -83,9 +83,8 @@ class MakePom(val log: Logger) {
|
|||
write(process(toPom(ivy, module, moduleInfo, configurations, includeTypes, extra, filterRepositories, allRepositories)), output)
|
||||
// use \n as newline because toString uses PrettyPrinter, which hard codes line endings to be \n
|
||||
def write(node: XNode, output: File): Unit = write(toString(node), output, "\n")
|
||||
def write(xmlString: String, output: File, newline: String) {
|
||||
def write(xmlString: String, output: File, newline: String): Unit =
|
||||
IO.write(output, "<?xml version='1.0' encoding='" + IO.utf8.name + "'?>" + newline + xmlString)
|
||||
}
|
||||
|
||||
def toString(node: XNode): String = new PrettyPrinter(1000, 4).format(node)
|
||||
@deprecated("Use `toPom(Ivy, ModuleDescriptor, ModuleInfo, Option[Iterable[Configuration]], Set[String], NodeSeq, MavenRepository => Boolean, Boolean)` instead", "0.11.2")
|
||||
|
|
|
|||
|
|
@ -70,12 +70,12 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
|
|||
|
||||
// doesn't support publishing
|
||||
def publish(artifact: IArtifact, src: File, overwrite: Boolean) = sys.error("Publish not supported by ProjectResolver")
|
||||
def beginPublishTransaction(module: ModuleRevisionId, overwrite: Boolean) {}
|
||||
def abortPublishTransaction() {}
|
||||
def commitPublishTransaction() {}
|
||||
def beginPublishTransaction(module: ModuleRevisionId, overwrite: Boolean): Unit = ()
|
||||
def abortPublishTransaction(): Unit = ()
|
||||
def commitPublishTransaction(): Unit = ()
|
||||
|
||||
def reportFailure() {}
|
||||
def reportFailure(art: IArtifact) {}
|
||||
def reportFailure(): Unit = ()
|
||||
def reportFailure(art: IArtifact): Unit = ()
|
||||
|
||||
def listOrganisations() = new Array[OrganisationEntry](0)
|
||||
def listModules(org: OrganisationEntry) = new Array[ModuleEntry](0)
|
||||
|
|
@ -85,8 +85,8 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
|
|||
|
||||
private[this] var settings: Option[ResolverSettings] = None
|
||||
|
||||
def dumpSettings() {}
|
||||
def setSettings(settings: ResolverSettings) { this.settings = Some(settings) }
|
||||
def dumpSettings(): Unit = ()
|
||||
def setSettings(settings: ResolverSettings): Unit = { this.settings = Some(settings) }
|
||||
def getRepositoryCacheManager = settings match { case Some(s) => s.getDefaultRepositoryCacheManager; case None => sys.error("No settings defined for ProjectResolver") }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ private[sbt] final class ResolutionCache(base: File, settings: IvySettings) exte
|
|||
private[this] val reportBase: File = new File(base, ReportDirectory)
|
||||
|
||||
def getResolutionCacheRoot: File = base
|
||||
def clean() { IO.delete(base) }
|
||||
def clean(): Unit = IO.delete(base)
|
||||
override def toString = Name
|
||||
|
||||
def getResolvedIvyFileInCache(mrid: ModuleRevisionId): File =
|
||||
|
|
@ -66,7 +66,7 @@ private[sbt] object ResolutionCache {
|
|||
* Removes cached files from the resolution cache for the module with ID `mrid`
|
||||
* and the resolveId (as set on `ResolveOptions`).
|
||||
*/
|
||||
private[sbt] def cleanModule(mrid: ModuleRevisionId, resolveId: String, manager: ResolutionCacheManager) {
|
||||
private[sbt] def cleanModule(mrid: ModuleRevisionId, resolveId: String, manager: ResolutionCacheManager): Unit = {
|
||||
val files =
|
||||
Option(manager.getResolvedIvyFileInCache(mrid)).toList :::
|
||||
Option(manager.getResolvedIvyPropertiesInCache(mrid)).toList :::
|
||||
|
|
@ -87,4 +87,4 @@ private[sbt] object ResolutionCache {
|
|||
|
||||
// use sbt-specific extra attributes so that resolved xml files do not get overwritten when using different Scala/sbt versions
|
||||
private val ResolvedPattern = "[organisation]/[module]/" + Resolver.PluginPattern + "[revision]/[artifact].[ext]"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import java.util.Locale
|
|||
object StringUtilities {
|
||||
@deprecated("Different use cases require different normalization. Use Project.normalizeModuleID or normalizeProjectID instead.", "0.13.0")
|
||||
def normalize(s: String) = s.toLowerCase(Locale.ENGLISH).replaceAll("""\W+""", "-")
|
||||
def nonEmpty(s: String, label: String) {
|
||||
require(s.trim.length > 0, label + " cannot be empty.")
|
||||
}
|
||||
def nonEmpty(s: String, label: String): Unit = require(s.trim.length > 0, label + " cannot be empty.")
|
||||
def appendable(s: String) = if (s.isEmpty) "" else "_" + s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ object ErrorMessageAuthenticator {
|
|||
}
|
||||
|
||||
/** Installs the error message authenticator so we have nicer error messages when using java's URL for downloading. */
|
||||
def install() {
|
||||
def install(): Unit = {
|
||||
// Actually installs the error message authenticator.
|
||||
def doInstall(original: Option[Authenticator]): Unit =
|
||||
try Authenticator.setDefault(new ErrorMessageAuthenticator(original))
|
||||
|
|
@ -126,4 +126,4 @@ private[sbt] final class ErrorMessageAuthenticator(original: Option[Authenticato
|
|||
private def isProxyAuthentication: Boolean =
|
||||
getRequestorType == Authenticator.RequestorType.PROXY
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue