Skip to content

Commit

Permalink
Apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jvican committed Apr 26, 2017
1 parent 712c83f commit d42ea86
Show file tree
Hide file tree
Showing 71 changed files with 4,875 additions and 2,819 deletions.
62 changes: 39 additions & 23 deletions build.sbt
Expand Up @@ -28,17 +28,19 @@ def commonSettings: Seq[Setting[_]] = Seq(
}
)

lazy val lmRoot = (project in file(".")).
aggregate(lm).
disablePlugins(com.typesafe.sbt.SbtScalariform).
settings(
inThisBuild(Seq(
homepage := Some(url("https://github.com/sbt/librarymanagement")),
description := "Library management module for sbt",
scmInfo := Some(ScmInfo(url("https://github.com/sbt/librarymanagement"), "git@github.com:sbt/librarymanagement.git")),
bintrayPackage := "librarymanagement",
git.baseVersion := baseVersion
)),
lazy val lmRoot = (project in file("."))
.aggregate(lm)
.disablePlugins(com.typesafe.sbt.SbtScalariform)
.settings(
inThisBuild(
Seq(
homepage := Some(url("https://github.com/sbt/librarymanagement")),
description := "Library management module for sbt",
scmInfo := Some(ScmInfo(url("https://github.com/sbt/librarymanagement"),
"git@github.com:sbt/librarymanagement.git")),
bintrayPackage := "librarymanagement",
git.baseVersion := baseVersion
)),
commonSettings,
name := "LM Root",
publish := {},
Expand All @@ -48,15 +50,24 @@ lazy val lmRoot = (project in file(".")).
customCommands
)

lazy val lm = (project in file("librarymanagement")).
disablePlugins(com.typesafe.sbt.SbtScalariform).
settings(
lazy val lm = (project in file("librarymanagement"))
.disablePlugins(com.typesafe.sbt.SbtScalariform)
.settings(
commonSettings,
name := "librarymanagement",
libraryDependencies ++= Seq(
ivy, jsch, scalaReflect.value, launcherInterface, sjsonnewScalaJson % Optional),
libraryDependencies ++= Seq(ivy,
jsch,
scalaReflect.value,
launcherInterface,
sjsonnewScalaJson % Optional),
libraryDependencies ++= scalaXml.value,
resourceGenerators in Compile += Def.task(Util.generateVersionFile(version.value, resourceManaged.value, streams.value, (compile in Compile).value)).taskValue,
resourceGenerators in Compile += Def
.task(
Util.generateVersionFile(version.value,
resourceManaged.value,
streams.value,
(compile in Compile).value))
.taskValue,
mimaBinaryIssueFilters ++= Seq(),
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
// WORKAROUND sbt/sbt#2205 include managed sources in packageSrc
Expand All @@ -66,16 +77,21 @@ lazy val lm = (project in file("librarymanagement")).
val base = baseDirectory.value
(((srcs --- sdirs --- base) pair (relativeTo(sdirs) | relativeTo(base) | flat)) toSeq)
}
).
configure(addSbtIO, addSbtUtilLogging, addSbtUtilTesting, addSbtUtilCollection, addSbtUtilCompletion, addSbtUtilCache).
enablePlugins(ContrabandPlugin, JsonCodecPlugin)
)
.configure(addSbtIO,
addSbtUtilLogging,
addSbtUtilTesting,
addSbtUtilCollection,
addSbtUtilCompletion,
addSbtUtilCache)
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)

def customCommands: Seq[Setting[_]] = Seq(
commands += Command.command("release") { state =>
// "clean" ::
"so compile" ::
"so publishSigned" ::
"reload" ::
state
"so publishSigned" ::
"reload" ::
state
}
)
Expand Up @@ -37,82 +37,101 @@ 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): 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.
dd.addDependencyConfiguration("optional", "master(compile)")
} else {
dd.addDependencyConfiguration("compile", "compile(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("compile", "master(compile)")
dd.addDependencyConfiguration("runtime", "runtime(*)")
REPLACEMENT_MAPPINGS.put(
"compile",
new PomModuleDescriptorBuilder.ConfMapper {
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.
dd.addDependencyConfiguration("optional", "master(compile)")
} else {
dd.addDependencyConfiguration("compile", "compile(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("compile", "master(compile)")
dd.addDependencyConfiguration("runtime", "runtime(*)")
}
}
}
})
REPLACEMENT_MAPPINGS.put("provided", new PomModuleDescriptorBuilder.ConfMapper {
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
if (isOptional) {
dd.addDependencyConfiguration("optional", "compile(*)")
dd.addDependencyConfiguration("optional", "provided(*)")
dd.addDependencyConfiguration("optional", "runtime(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("optional", "master(compile)")
} else {
dd.addDependencyConfiguration("provided", "compile(*)")
dd.addDependencyConfiguration("provided", "provided(*)")
dd.addDependencyConfiguration("provided", "runtime(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("provided", "master(compile)")
)
REPLACEMENT_MAPPINGS.put(
"provided",
new PomModuleDescriptorBuilder.ConfMapper {
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
if (isOptional) {
dd.addDependencyConfiguration("optional", "compile(*)")
dd.addDependencyConfiguration("optional", "provided(*)")
dd.addDependencyConfiguration("optional", "runtime(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("optional", "master(compile)")
} else {
dd.addDependencyConfiguration("provided", "compile(*)")
dd.addDependencyConfiguration("provided", "provided(*)")
dd.addDependencyConfiguration("provided", "runtime(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("provided", "master(compile)")
}
}
}
})
)

REPLACEMENT_MAPPINGS.put("runtime", new PomModuleDescriptorBuilder.ConfMapper {
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
if (isOptional) {
dd.addDependencyConfiguration("optional", "compile(*)")
dd.addDependencyConfiguration("optional", "provided(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("optional", "master(compile)")
} else {
dd.addDependencyConfiguration("runtime", "compile(*)")
dd.addDependencyConfiguration("runtime", "runtime(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("runtime", "master(compile)")
REPLACEMENT_MAPPINGS.put(
"runtime",
new PomModuleDescriptorBuilder.ConfMapper {
def addMappingConfs(dd: DefaultDependencyDescriptor, isOptional: Boolean): Unit = {
if (isOptional) {
dd.addDependencyConfiguration("optional", "compile(*)")
dd.addDependencyConfiguration("optional", "provided(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("optional", "master(compile)")
} else {
dd.addDependencyConfiguration("runtime", "compile(*)")
dd.addDependencyConfiguration("runtime", "runtime(*)")
// FIX - Here we take a mroe conservative approach of depending on the compile configuration if master isn't there.
dd.addDependencyConfiguration("runtime", "master(compile)")
}
}
}
})
)

REPLACEMENT_MAPPINGS.put("test", new PomModuleDescriptorBuilder.ConfMapper {
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)")
REPLACEMENT_MAPPINGS.put(
"test",
new PomModuleDescriptorBuilder.ConfMapper {
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)")
}
}
})
)

REPLACEMENT_MAPPINGS.put("system", new PomModuleDescriptorBuilder.ConfMapper {
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)")
REPLACEMENT_MAPPINGS.put(
"system",
new PomModuleDescriptorBuilder.ConfMapper {
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)")
}
}
})
)

REPLACEMENT_MAPPINGS
}

def init(): Unit = {
// Here we mutate a static final field, because we have to AND because it's evil.
try {
val map = PomModuleDescriptorBuilder.MAVEN2_CONF_MAPPING.asInstanceOf[java.util.Map[String, PomModuleDescriptorBuilder.ConfMapper]]
val map = PomModuleDescriptorBuilder.MAVEN2_CONF_MAPPING
.asInstanceOf[java.util.Map[String, PomModuleDescriptorBuilder.ConfMapper]]
map.clear()
map.putAll(REPLACEMENT_MAVEN_MAPPINGS)
} catch {
case e: Exception =>
// TODO - Log that Ivy may not be configured correctly and you could have maven/ivy issues.
throw new RuntimeException("FAILURE to install Ivy maven hooks. Your ivy-maven interaction may suffer resolution errors", e)
throw new RuntimeException(
"FAILURE to install Ivy maven hooks. Your ivy-maven interaction may suffer resolution errors",
e
)
}
}
}
Expand Up @@ -6,16 +6,16 @@ import sbt.util.{ Level, Logger }
import Configurations._

final class CompatibilityWarningOptions private[sbt] (
val configurations: Seq[Configuration],
val level: Level.Value
val configurations: Seq[Configuration],
val level: Level.Value
)

object CompatibilityWarningOptions {
def default: CompatibilityWarningOptions =
apply(configurations = List(Compile, Runtime), level = Level.Warn)
def apply(
configurations: List[Configuration],
level: Level.Value
configurations: List[Configuration],
level: Level.Value
): CompatibilityWarningOptions =
new CompatibilityWarningOptions(
configurations = configurations,
Expand All @@ -24,12 +24,21 @@ object CompatibilityWarningOptions {
}

private[sbt] object CompatibilityWarning {
def run(config: CompatibilityWarningOptions, module: IvySbt#Module, mavenStyle: Boolean, log: Logger): Unit = {
def run(
config: CompatibilityWarningOptions,
module: IvySbt#Module,
mavenStyle: Boolean,
log: Logger
): Unit = {
if (mavenStyle) {
processIntransitive(config, module, log)
}
}
def processIntransitive(config: CompatibilityWarningOptions, module: IvySbt#Module, log: Logger): Unit = {
def processIntransitive(
config: CompatibilityWarningOptions,
module: IvySbt#Module,
log: Logger
): Unit = {
val monitoredConfigsStr: Set[String] = (config.configurations map { _.name }).toSet
val directDependencies: Seq[ModuleID] = module.moduleSettings match {
case x: InlineConfiguration => x.dependencies
Expand Down

0 comments on commit d42ea86

Please sign in to comment.