mirror of https://github.com/sbt/sbt.git
Replace procedure syntax by explicit Unit annotation
This commit is contained in:
parent
303b0681da
commit
54d54b9f4f
|
|
@ -40,7 +40,7 @@ object Cache extends CacheImplicits {
|
|||
println(label + ".read: " + v)
|
||||
v
|
||||
}
|
||||
def write(to: Out, v: Internal) {
|
||||
def write(to: Out, v: Internal): Unit = {
|
||||
println(label + ".write: " + v)
|
||||
c.write(to, v)
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ trait BasicCacheImplicits {
|
|||
if (left <= 0) acc.reverse else next(left - 1, t.read(from) :: acc)
|
||||
next(size, Nil)
|
||||
}
|
||||
def write(to: Out, vs: Internal) {
|
||||
def write(to: Out, vs: Internal): Unit = {
|
||||
val size = vs.length
|
||||
IntFormat.writes(to, size)
|
||||
for (v <- vs) t.write(to, v)
|
||||
|
|
@ -165,7 +165,7 @@ trait HListCacheImplicits {
|
|||
val t = tail.read(from)
|
||||
(h, t)
|
||||
}
|
||||
def write(to: Out, j: Internal) {
|
||||
def write(to: Out, j: Internal): Unit = {
|
||||
head.write(to, j._1)
|
||||
tail.write(to, j._2)
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ trait HListCacheImplicits {
|
|||
val t = tail.reads(from)
|
||||
HCons(h, t)
|
||||
}
|
||||
def writes(to: Out, hc: H :+: T) {
|
||||
def writes(to: Out, hc: H :+: T): Unit = {
|
||||
head.writes(to, hc.head)
|
||||
tail.writes(to, hc.tail)
|
||||
}
|
||||
|
|
@ -205,8 +205,8 @@ trait UnionImplicits {
|
|||
val value = cache.read(in)
|
||||
new Found[cache.Internal](cache, clazz, value, index)
|
||||
}
|
||||
def write(to: Out, i: Internal) {
|
||||
def write0[I](f: Found[I]) {
|
||||
def write(to: Out, i: Internal): Unit = {
|
||||
def write0[I](f: Found[I]): Unit = {
|
||||
ByteFormat.writes(to, f.index.toByte)
|
||||
f.cache.write(to, f.value)
|
||||
}
|
||||
|
|
@ -245,4 +245,4 @@ trait UnionImplicits {
|
|||
def at(i: Int): (InputCache[_ <: UB], Class[_])
|
||||
def find(forValue: UB): Found[_]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,11 @@ object ClassToAPI {
|
|||
c.getEnclosingClass eq null
|
||||
|
||||
final class ClassMap private[sbt] (private[sbt] val memo: mutable.Map[String, Seq[api.ClassLike]], private[sbt] val inherited: mutable.Set[Class[_]], private[sbt] val lz: mutable.Buffer[xsbti.api.Lazy[_]]) {
|
||||
def clear() { memo.clear(); inherited.clear(); lz.clear() }
|
||||
def clear(): Unit = {
|
||||
memo.clear()
|
||||
inherited.clear()
|
||||
lz.clear()
|
||||
}
|
||||
}
|
||||
def emptyClassMap: ClassMap = new ClassMap(new mutable.HashMap, new mutable.HashSet, new mutable.ListBuffer)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ object APIUtil {
|
|||
|
||||
// Don't visit inherited definitions since we consider that a class
|
||||
// that inherits a macro does not have a macro.
|
||||
override def visitStructure0(structure: Structure) {
|
||||
override def visitStructure0(structure: Structure): Unit = {
|
||||
visitTypes(structure.parents)
|
||||
visitDefinitions(structure.declared)
|
||||
}
|
||||
|
||||
override def visitModifiers(m: Modifiers) {
|
||||
override def visitModifiers(m: Modifiers): Unit = {
|
||||
hasMacro ||= m.isMacro
|
||||
super.visitModifiers(m)
|
||||
}
|
||||
|
|
@ -63,4 +63,4 @@ object APIUtil {
|
|||
private[this] def lzy[T <: AnyRef](t: T): Lazy[T] = SafeLazy.strict(t)
|
||||
|
||||
private[this] val emptyType = new EmptyType
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
private[this] val visitedStructures = visitedMap[Structure]
|
||||
private[this] val visitedClassLike = visitedMap[ClassLike]
|
||||
private[this] def visitedMap[T] = new mutable.HashMap[T, List[Hash]]
|
||||
private[this] def visit[T](map: mutable.Map[T, List[Hash]], t: T)(hashF: T => Unit) {
|
||||
private[this] def visit[T](map: mutable.Map[T, List[Hash]], t: T)(hashF: T => Unit): Unit = {
|
||||
map.put(t, hash :: map.getOrElse(t, Nil)) match {
|
||||
case Some(x :: _) => extend(x)
|
||||
case _ =>
|
||||
|
|
@ -102,11 +102,11 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
|
||||
@inline final def hashString(s: String): Unit = extend(stringHash(s))
|
||||
@inline final def hashBoolean(b: Boolean): Unit = extend(if (b) TrueHash else FalseHash)
|
||||
@inline final def hashSeq[T](s: Seq[T], hashF: T => Unit) {
|
||||
@inline final def hashSeq[T](s: Seq[T], hashF: T => Unit): Unit = {
|
||||
extend(s.length)
|
||||
s foreach hashF
|
||||
}
|
||||
final def hashSymmetric[T](ts: TraversableOnce[T], hashF: T => Unit) {
|
||||
final def hashSymmetric[T](ts: TraversableOnce[T], hashF: T => Unit): Unit = {
|
||||
val current = hash
|
||||
val mA = magicA
|
||||
val mB = magicB
|
||||
|
|
@ -123,7 +123,7 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
extend(symmetricHash(hashes, 0xb592f7ae)) // constant from MurmurHash3
|
||||
}
|
||||
|
||||
@inline final def extend(a: Hash) {
|
||||
@inline final def extend(a: Hash): Unit = {
|
||||
hash = extendHash(hash, a, magicA, magicB)
|
||||
magicA = nextMagicA(magicA)
|
||||
magicB = nextMagicB(magicB)
|
||||
|
|
@ -166,7 +166,7 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
}
|
||||
hashSymmetric(ds, (hashDefinitionCombined _).tupled)
|
||||
}
|
||||
def hashDefinition(d: Definition) {
|
||||
def hashDefinition(d: Definition): Unit = {
|
||||
hashString(d.name)
|
||||
hashAnnotations(d.annotations)
|
||||
hashModifiers(d.modifiers)
|
||||
|
|
@ -180,20 +180,20 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
}
|
||||
}
|
||||
final def hashClass(c: ClassLike): Unit = visit(visitedClassLike, c)(hashClass0)
|
||||
def hashClass0(c: ClassLike) {
|
||||
def hashClass0(c: ClassLike): Unit = {
|
||||
extend(ClassHash)
|
||||
hashParameterizedDefinition(c)
|
||||
hashType(c.selfType)
|
||||
hashStructure(c.structure, includeDefinitions)
|
||||
}
|
||||
def hashField(f: FieldLike) {
|
||||
def hashField(f: FieldLike): Unit = {
|
||||
f match {
|
||||
case v: Var => extend(VarHash)
|
||||
case v: Val => extend(ValHash)
|
||||
}
|
||||
hashType(f.tpe)
|
||||
}
|
||||
def hashDef(d: Def) {
|
||||
def hashDef(d: Def): Unit = {
|
||||
extend(DefHash)
|
||||
hashParameterizedDefinition(d)
|
||||
hashValueParameters(d.valueParameters)
|
||||
|
|
@ -236,23 +236,23 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
hashBoolean(parameter.hasDefault)
|
||||
}
|
||||
|
||||
def hashParameterizedDefinition[T <: ParameterizedDefinition](d: T) {
|
||||
def hashParameterizedDefinition[T <: ParameterizedDefinition](d: T): Unit = {
|
||||
hashTypeParameters(d.typeParameters)
|
||||
}
|
||||
def hashTypeDeclaration(d: TypeDeclaration) {
|
||||
def hashTypeDeclaration(d: TypeDeclaration): Unit = {
|
||||
extend(TypeDeclHash)
|
||||
hashParameterizedDefinition(d)
|
||||
hashType(d.lowerBound)
|
||||
hashType(d.upperBound)
|
||||
}
|
||||
def hashTypeAlias(d: TypeAlias) {
|
||||
def hashTypeAlias(d: TypeAlias): Unit = {
|
||||
extend(TypeAliasHash)
|
||||
hashParameterizedDefinition(d)
|
||||
hashType(d.tpe)
|
||||
}
|
||||
|
||||
def hashTypeParameters(parameters: Seq[TypeParameter]) = hashSeq(parameters, hashTypeParameter)
|
||||
def hashTypeParameter(parameter: TypeParameter) {
|
||||
def hashTypeParameter(parameter: TypeParameter): Unit = {
|
||||
hashString(parameter.id)
|
||||
extend(parameter.variance.ordinal)
|
||||
hashTypeParameters(parameter.typeParameters)
|
||||
|
|
@ -267,7 +267,7 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
hashAnnotationArguments(annotation.arguments)
|
||||
}
|
||||
def hashAnnotationArguments(args: Seq[AnnotationArgument]) = hashSeq(args, hashAnnotationArgument)
|
||||
def hashAnnotationArgument(arg: AnnotationArgument) {
|
||||
def hashAnnotationArgument(arg: AnnotationArgument): Unit = {
|
||||
hashString(arg.name)
|
||||
hashString(arg.value)
|
||||
}
|
||||
|
|
@ -288,11 +288,11 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
case pr: ParameterRef => hashParameterRef(pr)
|
||||
}
|
||||
|
||||
def hashParameterRef(p: ParameterRef) {
|
||||
def hashParameterRef(p: ParameterRef): Unit = {
|
||||
extend(ParameterRefHash)
|
||||
hashString(p.id)
|
||||
}
|
||||
def hashSingleton(s: Singleton) {
|
||||
def hashSingleton(s: Singleton): Unit = {
|
||||
extend(SingletonHash)
|
||||
hashPath(s.path)
|
||||
}
|
||||
|
|
@ -302,11 +302,11 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
case s: Super => hashSuperPath(s)
|
||||
case id: Id => hashIdPath(id)
|
||||
}
|
||||
def hashSuperPath(s: Super) {
|
||||
def hashSuperPath(s: Super): Unit = {
|
||||
extend(SuperHash)
|
||||
hashPath(s.qualifier)
|
||||
}
|
||||
def hashIdPath(id: Id) {
|
||||
def hashIdPath(id: Id): Unit = {
|
||||
extend(IdPathHash)
|
||||
hashString(id.id)
|
||||
}
|
||||
|
|
@ -333,19 +333,19 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
hashString(p.id)
|
||||
hashType(p.prefix)
|
||||
}
|
||||
def hashParameterized(p: Parameterized) {
|
||||
def hashParameterized(p: Parameterized): Unit = {
|
||||
extend(ParameterizedHash)
|
||||
hashType(p.baseType)
|
||||
hashTypes(p.typeArguments)
|
||||
}
|
||||
def hashAnnotated(a: Annotated) {
|
||||
def hashAnnotated(a: Annotated): Unit = {
|
||||
extend(AnnotatedHash)
|
||||
hashType(a.baseType)
|
||||
hashAnnotations(a.annotations)
|
||||
}
|
||||
final def hashStructure(structure: Structure, includeDefinitions: Boolean) =
|
||||
visit(visitedStructures, structure)(structure => hashStructure0(structure, includeDefinitions))
|
||||
def hashStructure0(structure: Structure, includeDefinitions: Boolean) {
|
||||
def hashStructure0(structure: Structure, includeDefinitions: Boolean): Unit = {
|
||||
extend(StructureHash)
|
||||
hashTypes(structure.parents, includeDefinitions)
|
||||
if (includeDefinitions) {
|
||||
|
|
@ -359,4 +359,3 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
|
|||
hashType(base)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ class Visit {
|
|||
s.definitions foreach visitDefinition
|
||||
}
|
||||
|
||||
def visitPackage(p: Package) {
|
||||
def visitPackage(p: Package): Unit = {
|
||||
visitString(p.name)
|
||||
}
|
||||
|
||||
def visitDefinitions(ds: Seq[Definition]) = ds foreach visitDefinition
|
||||
def visitDefinition(d: Definition) {
|
||||
def visitDefinition(d: Definition): Unit = {
|
||||
visitString(d.name)
|
||||
visitAnnotations(d.annotations)
|
||||
visitModifiers(d.modifiers)
|
||||
|
|
@ -36,21 +36,21 @@ class Visit {
|
|||
}
|
||||
}
|
||||
final def visitClass(c: ClassLike): Unit = if (visitedClassLike add c) visitClass0(c)
|
||||
def visitClass0(c: ClassLike) {
|
||||
def visitClass0(c: ClassLike): Unit = {
|
||||
visitParameterizedDefinition(c)
|
||||
visitType(c.selfType)
|
||||
visitStructure(c.structure)
|
||||
}
|
||||
def visitField(f: FieldLike) {
|
||||
def visitField(f: FieldLike): Unit = {
|
||||
visitType(f.tpe)
|
||||
f match {
|
||||
case v: Var => visitVar(v)
|
||||
case v: Val => visitVal(v)
|
||||
}
|
||||
}
|
||||
def visitVar(v: Var) {}
|
||||
def visitVal(v: Val) {}
|
||||
def visitDef(d: Def) {
|
||||
def visitVar(v: Var): Unit = ()
|
||||
def visitVal(v: Val): Unit = ()
|
||||
def visitDef(d: Def): Unit = {
|
||||
visitParameterizedDefinition(d)
|
||||
visitValueParameters(d.valueParameters)
|
||||
visitType(d.returnType)
|
||||
|
|
@ -71,15 +71,15 @@ class Visit {
|
|||
case thisq: ThisQualifier => visitThisQualifier(thisq)
|
||||
case id: IdQualifier => visitIdQualifier(id)
|
||||
}
|
||||
def visitIdQualifier(id: IdQualifier) {
|
||||
def visitIdQualifier(id: IdQualifier): Unit = {
|
||||
visitString(id.value)
|
||||
}
|
||||
def visitUnqualified(unq: Unqualified) {}
|
||||
def visitThisQualifier(thisq: ThisQualifier) {}
|
||||
def visitPublic(pub: Public) {}
|
||||
def visitPrivate(p: Private) { visitQualifier(p.qualifier) }
|
||||
def visitProtected(p: Protected) { visitQualifier(p.qualifier) }
|
||||
def visitModifiers(m: Modifiers) {}
|
||||
def visitUnqualified(unq: Unqualified): Unit = ()
|
||||
def visitThisQualifier(thisq: ThisQualifier): Unit = ()
|
||||
def visitPublic(pub: Public): Unit = ()
|
||||
def visitPrivate(p: Private): Unit = visitQualifier(p.qualifier)
|
||||
def visitProtected(p: Protected): Unit = visitQualifier(p.qualifier)
|
||||
def visitModifiers(m: Modifiers): Unit = ()
|
||||
|
||||
def visitValueParameters(valueParameters: Seq[ParameterList]) = valueParameters foreach visitValueParameterList
|
||||
def visitValueParameterList(list: ParameterList) = list.parameters foreach visitValueParameter
|
||||
|
|
@ -89,21 +89,20 @@ class Visit {
|
|||
visitType(parameter.tpe)
|
||||
}
|
||||
|
||||
def visitParameterizedDefinition[T <: ParameterizedDefinition](d: T) {
|
||||
visitTypeParameters(d.typeParameters)
|
||||
}
|
||||
def visitTypeDeclaration(d: TypeDeclaration) {
|
||||
def visitParameterizedDefinition[T <: ParameterizedDefinition](d: T): Unit = visitTypeParameters(d.typeParameters)
|
||||
|
||||
def visitTypeDeclaration(d: TypeDeclaration): Unit = {
|
||||
visitParameterizedDefinition(d)
|
||||
visitType(d.lowerBound)
|
||||
visitType(d.upperBound)
|
||||
}
|
||||
def visitTypeAlias(d: TypeAlias) {
|
||||
def visitTypeAlias(d: TypeAlias): Unit = {
|
||||
visitParameterizedDefinition(d)
|
||||
visitType(d.tpe)
|
||||
}
|
||||
|
||||
def visitTypeParameters(parameters: Seq[TypeParameter]) = parameters foreach visitTypeParameter
|
||||
def visitTypeParameter(parameter: TypeParameter) {
|
||||
def visitTypeParameter(parameter: TypeParameter): Unit = {
|
||||
visitTypeParameters(parameter.typeParameters)
|
||||
visitType(parameter.lowerBound)
|
||||
visitType(parameter.upperBound)
|
||||
|
|
@ -116,13 +115,13 @@ class Visit {
|
|||
visitAnnotationArguments(annotation.arguments)
|
||||
}
|
||||
def visitAnnotationArguments(args: Seq[AnnotationArgument]) = args foreach visitAnnotationArgument
|
||||
def visitAnnotationArgument(arg: AnnotationArgument) {
|
||||
def visitAnnotationArgument(arg: AnnotationArgument): Unit = {
|
||||
visitString(arg.name)
|
||||
visitString(arg.value)
|
||||
}
|
||||
|
||||
def visitTypes(ts: Seq[Type]) = ts.foreach(visitType)
|
||||
def visitType(t: Type) {
|
||||
def visitType(t: Type): Unit = {
|
||||
t match {
|
||||
case s: Structure => visitStructure(s)
|
||||
case e: Existential => visitExistential(e)
|
||||
|
|
@ -137,18 +136,18 @@ class Visit {
|
|||
}
|
||||
}
|
||||
|
||||
def visitEmptyType() {}
|
||||
def visitParameterRef(p: ParameterRef) {}
|
||||
def visitSingleton(s: Singleton) { visitPath(s.path) }
|
||||
def visitEmptyType(): Unit = ()
|
||||
def visitParameterRef(p: ParameterRef): Unit = ()
|
||||
def visitSingleton(s: Singleton): Unit = visitPath(s.path)
|
||||
def visitPath(path: Path) = path.components foreach visitPathComponent
|
||||
def visitPathComponent(pc: PathComponent) = pc match {
|
||||
case t: This => visitThisPath(t)
|
||||
case s: Super => visitSuperPath(s)
|
||||
case id: Id => visitIdPath(id)
|
||||
}
|
||||
def visitThisPath(t: This) {}
|
||||
def visitSuperPath(s: Super) { visitPath(s.qualifier) }
|
||||
def visitIdPath(id: Id) { visitString(id.id) }
|
||||
def visitThisPath(t: This): Unit = ()
|
||||
def visitSuperPath(s: Super): Unit = visitPath(s.qualifier)
|
||||
def visitIdPath(id: Id): Unit = visitString(id.id)
|
||||
|
||||
def visitConstant(c: Constant) =
|
||||
{
|
||||
|
|
@ -162,16 +161,16 @@ class Visit {
|
|||
visitString(p.id)
|
||||
visitType(p.prefix)
|
||||
}
|
||||
def visitParameterized(p: Parameterized) {
|
||||
def visitParameterized(p: Parameterized): Unit = {
|
||||
visitType(p.baseType)
|
||||
visitTypes(p.typeArguments)
|
||||
}
|
||||
def visitAnnotated(a: Annotated) {
|
||||
def visitAnnotated(a: Annotated): Unit = {
|
||||
visitType(a.baseType)
|
||||
visitAnnotations(a.annotations)
|
||||
}
|
||||
final def visitStructure(structure: Structure) = if (visitedStructures add structure) visitStructure0(structure)
|
||||
def visitStructure0(structure: Structure) {
|
||||
def visitStructure0(structure: Structure): Unit = {
|
||||
visitTypes(structure.parents)
|
||||
visitDefinitions(structure.declared)
|
||||
visitDefinitions(structure.inherited)
|
||||
|
|
@ -181,5 +180,5 @@ class Visit {
|
|||
visitTypeParameters(parameters)
|
||||
visitType(base)
|
||||
}
|
||||
def visitString(s: String) {}
|
||||
}
|
||||
def visitString(s: String): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ trait AnalysisStore {
|
|||
object AnalysisStore {
|
||||
def cached(backing: AnalysisStore): AnalysisStore = new AnalysisStore {
|
||||
private var last: Option[(Analysis, CompileSetup)] = None
|
||||
def set(analysis: Analysis, setup: CompileSetup) {
|
||||
def set(analysis: Analysis, setup: CompileSetup): Unit = {
|
||||
backing.set(analysis, setup)
|
||||
last = Some((analysis, setup))
|
||||
}
|
||||
|
|
@ -27,4 +27,4 @@ object AnalysisStore {
|
|||
def set(analysis: Analysis, setup: CompileSetup): Unit = synchronized { backing.set(analysis, setup) }
|
||||
def get(): Option[(Analysis, CompileSetup)] = synchronized { backing.get() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ object ClassfileManager {
|
|||
/** Constructs a minimal ClassfileManager implementation that immediately deletes class files when requested. */
|
||||
val deleteImmediately: () => ClassfileManager = () => new ClassfileManager {
|
||||
def delete(classes: Iterable[File]): Unit = IO.deleteFilesEmptyDirs(classes)
|
||||
def generated(classes: Iterable[File]) {}
|
||||
def complete(success: Boolean) {}
|
||||
def generated(classes: Iterable[File]): Unit = ()
|
||||
def complete(success: Boolean): Unit = ()
|
||||
}
|
||||
@deprecated("Use overloaded variant that takes additional logger argument, instead.", "0.13.5")
|
||||
def transactional(tempDir0: File): () => ClassfileManager =
|
||||
|
|
@ -44,7 +44,7 @@ object ClassfileManager {
|
|||
private[this] val movedClasses = new mutable.HashMap[File, File]
|
||||
|
||||
private def showFiles(files: Iterable[File]): String = files.map(f => s"\t$f").mkString("\n")
|
||||
def delete(classes: Iterable[File]) {
|
||||
def delete(classes: Iterable[File]): Unit = {
|
||||
logger.debug(s"About to delete class files:\n${showFiles(classes)}")
|
||||
val toBeBackedUp = classes.filter(c => c.exists && !movedClasses.contains(c) && !generatedClasses(c))
|
||||
logger.debug(s"We backup classs files:\n${showFiles(toBeBackedUp)}")
|
||||
|
|
@ -57,7 +57,7 @@ object ClassfileManager {
|
|||
logger.debug(s"Registering generated classes:\n${showFiles(classes)}")
|
||||
generatedClasses ++= classes
|
||||
}
|
||||
def complete(success: Boolean) {
|
||||
def complete(success: Boolean): Unit = {
|
||||
if (!success) {
|
||||
logger.debug("Rolling back changes to class files.")
|
||||
logger.debug(s"Removing generated classes:\n${showFiles(generatedClasses)}")
|
||||
|
|
@ -76,4 +76,4 @@ object ClassfileManager {
|
|||
target
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ private final class AnalysisCallback(internalMap: File => Option[File], external
|
|||
// empty value used when name hashing algorithm is disabled
|
||||
private val emptyNameHashes = new xsbti.api._internalOnly_NameHashes(Array.empty, Array.empty)
|
||||
|
||||
def api(sourceFile: File, source: SourceAPI) {
|
||||
def api(sourceFile: File, source: SourceAPI): Unit = {
|
||||
import xsbt.api.{ APIUtil, HashAPI }
|
||||
if (APIUtil.isScalaSourceName(sourceFile.getName) && APIUtil.hasMacro(source)) macroSources += sourceFile
|
||||
publicNameHashes(sourceFile) = {
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class AggressiveCompile(cacheFile: File) {
|
|||
log.debug(label + " took " + (elapsed / 1e9) + " s")
|
||||
result
|
||||
}
|
||||
private[this] def logInputs(log: Logger, javaCount: Int, scalaCount: Int, outputDirs: Seq[File]) {
|
||||
private[this] def logInputs(log: Logger, javaCount: Int, scalaCount: Int, outputDirs: Seq[File]): Unit = {
|
||||
val scalaMsg = Analysis.counted("Scala source", "", "s", scalaCount)
|
||||
val javaMsg = Analysis.counted("Java source", "", "s", javaCount)
|
||||
val combined = scalaMsg ++ javaMsg
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ final class MixedAnalyzingCompiler(
|
|||
result
|
||||
}
|
||||
|
||||
private[this] def logInputs(log: Logger, javaCount: Int, scalaCount: Int, outputDirs: Seq[File]) {
|
||||
private[this] def logInputs(log: Logger, javaCount: Int, scalaCount: Int, outputDirs: Seq[File]): Unit = {
|
||||
val scalaMsg = Analysis.counted("Scala source", "", "s", scalaCount)
|
||||
val javaMsg = Analysis.counted("Java source", "", "s", javaCount)
|
||||
val combined = scalaMsg ++ javaMsg
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ final class API(val global: CallbackGlobal) extends Compat {
|
|||
debug("API phase took : " + ((stop - start) / 1000.0) + " s")
|
||||
}
|
||||
def processUnit(unit: CompilationUnit) = if (!unit.isJava) processScalaUnit(unit)
|
||||
def processScalaUnit(unit: CompilationUnit) {
|
||||
def processScalaUnit(unit: CompilationUnit): Unit = {
|
||||
val sourceFile = unit.source.file.file
|
||||
debug("Traversing " + sourceFile)
|
||||
val extractApi = new ExtractAPI[global.type](global, sourceFile)
|
||||
|
|
@ -59,7 +59,7 @@ final class API(val global: CallbackGlobal) extends Compat {
|
|||
definitions += extractApi.classLike(c.owner, c)
|
||||
}
|
||||
/** Record packages declared in the source file*/
|
||||
def `package`(p: Symbol) {
|
||||
def `package`(p: Symbol): Unit = {
|
||||
if ((p eq null) || p == NoSymbol || p.isRoot || p.isRootPackage || p.isEmptyPackageClass || p.isEmptyPackage)
|
||||
()
|
||||
else {
|
||||
|
|
@ -72,7 +72,7 @@ final class API(val global: CallbackGlobal) extends Compat {
|
|||
private abstract class TopLevelTraverser extends Traverser {
|
||||
def `class`(s: Symbol)
|
||||
def `package`(s: Symbol)
|
||||
override def traverse(tree: Tree) {
|
||||
override def traverse(tree: Tree): Unit = {
|
||||
tree match {
|
||||
case (_: ClassDef | _: ModuleDef) if isTopLevel(tree.symbol) => `class`(tree.symbol)
|
||||
case p: PackageDef =>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ final class Analyzer(val global: CallbackGlobal) extends LocateClassFile {
|
|||
// build list of generated classes
|
||||
for (iclass <- unit.icode) {
|
||||
val sym = iclass.symbol
|
||||
def addGenerated(separatorRequired: Boolean) {
|
||||
def addGenerated(separatorRequired: Boolean): Unit = {
|
||||
for (classFile <- outputDirs map (fileForClass(_, sym, separatorRequired)) find (_.exists))
|
||||
callback.generatedClass(sourceFile, classFile, className(sym, '.', separatorRequired))
|
||||
}
|
||||
|
|
@ -43,4 +43,3 @@ final class Analyzer(val global: CallbackGlobal) extends LocateClassFile {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class CompilerInterface {
|
|||
sealed trait GlobalCompat { self: Global =>
|
||||
def registerTopLevelSym(sym: Symbol): Unit
|
||||
sealed trait RunCompat {
|
||||
def informUnitStarting(phase: Phase, unit: CompilationUnit) {}
|
||||
def informUnitStarting(phase: Phase, unit: CompilationUnit): Unit = ()
|
||||
}
|
||||
}
|
||||
sealed abstract class CallbackGlobal(settings: Settings, reporter: reporters.Reporter, output: Output) extends Global(settings, reporter) with GlobalCompat {
|
||||
|
|
@ -43,7 +43,7 @@ sealed abstract class CallbackGlobal(settings: Settings, reporter: reporters.Rep
|
|||
}
|
||||
// Map source files to public inherited dependencies. These dependencies are tracked as the symbol for the dealiased base class.
|
||||
val inheritedDependencies = new mutable.HashMap[File, mutable.Set[Symbol]]
|
||||
def addInheritedDependencies(file: File, deps: Iterable[Symbol]) {
|
||||
def addInheritedDependencies(file: File, deps: Iterable[Symbol]): Unit = {
|
||||
inheritedDependencies.getOrElseUpdate(file, new mutable.HashSet) ++= deps
|
||||
}
|
||||
}
|
||||
|
|
@ -52,13 +52,13 @@ class InterfaceCompileFailed(val arguments: Array[String], val problems: Array[P
|
|||
class InterfaceCompileCancelled(val arguments: Array[String], override val toString: String) extends xsbti.CompileCancelled
|
||||
|
||||
private final class WeakLog(private[this] var log: Logger, private[this] var delegate: Reporter) {
|
||||
def apply(message: String) {
|
||||
def apply(message: String): Unit = {
|
||||
assert(log ne null, "Stale reference to logger")
|
||||
log.error(Message(message))
|
||||
}
|
||||
def logger: Logger = log
|
||||
def reporter: Reporter = delegate
|
||||
def clear() {
|
||||
def clear(): Unit = {
|
||||
log = null
|
||||
delegate = null
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ private final class CachedCompiler0(args: Array[String], output: Output, initial
|
|||
try { run(sources.toList, changes, callback, log, dreporter, progress) }
|
||||
finally { dreporter.dropDelegate() }
|
||||
}
|
||||
private[this] def run(sources: List[File], changes: DependencyChanges, callback: AnalysisCallback, log: Logger, dreporter: DelegatingReporter, compileProgress: CompileProgress) {
|
||||
private[this] def run(sources: List[File], changes: DependencyChanges, callback: AnalysisCallback, log: Logger, dreporter: DelegatingReporter, compileProgress: CompileProgress): Unit = {
|
||||
if (command.shouldStopWithInfo) {
|
||||
dreporter.info(null, command.getInfoMessage(compiler), true)
|
||||
throw new InterfaceCompileFailed(args, Array(), "Compiler option supplied that disabled actual compilation.")
|
||||
|
|
@ -104,10 +104,10 @@ private final class CachedCompiler0(args: Array[String], output: Output, initial
|
|||
debug(log, args.mkString("Calling Scala compiler with arguments (CompilerInterface):\n\t", "\n\t", ""))
|
||||
compiler.set(callback, dreporter)
|
||||
val run = new compiler.Run with compiler.RunCompat {
|
||||
override def informUnitStarting(phase: Phase, unit: compiler.CompilationUnit) {
|
||||
override def informUnitStarting(phase: Phase, unit: compiler.CompilationUnit): Unit = {
|
||||
compileProgress.startUnit(phase.name, unit.source.path)
|
||||
}
|
||||
override def progress(current: Int, total: Int) {
|
||||
override def progress(current: Int, total: Int): Unit = {
|
||||
if (!compileProgress.advance(current, total))
|
||||
cancel
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ private final class CachedCompiler0(args: Array[String], output: Output, initial
|
|||
debug(log, "Compilation cancelled (CompilerInterface)")
|
||||
throw new InterfaceCompileCancelled(args, "Compilation has been cancelled")
|
||||
}
|
||||
def processUnreportedWarnings(run: compiler.Run) {
|
||||
def processUnreportedWarnings(run: compiler.Run): Unit = {
|
||||
// allConditionalWarnings and the ConditionalWarning class are only in 2.10+
|
||||
final class CondWarnCompat(val what: String, val warnings: mutable.ListBuffer[(compiler.Position, String)])
|
||||
implicit def compat(run: AnyRef): Compat = new Compat
|
||||
|
|
@ -225,11 +225,11 @@ private final class CachedCompiler0(args: Array[String], output: Output, initial
|
|||
for ((what, warnings) <- seq; (pos, msg) <- warnings) yield callback.problem(what, drep.convert(pos), msg, Severity.Warn, false)
|
||||
}
|
||||
|
||||
def set(callback: AnalysisCallback, dreporter: DelegatingReporter) {
|
||||
def set(callback: AnalysisCallback, dreporter: DelegatingReporter): Unit = {
|
||||
this.callback0 = callback
|
||||
reporter = dreporter
|
||||
}
|
||||
def clear() {
|
||||
def clear(): Unit = {
|
||||
callback0 = null
|
||||
superDropRun()
|
||||
reporter = null
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class ConsoleInterface {
|
|||
def commandArguments(args: Array[String], bootClasspathString: String, classpathString: String, log: Logger): Array[String] =
|
||||
MakeSettings.sync(args, bootClasspathString, classpathString, log).recreateArgs.toArray[String]
|
||||
|
||||
def run(args: Array[String], bootClasspathString: String, classpathString: String, initialCommands: String, cleanupCommands: String, loader: ClassLoader, bindNames: Array[String], bindValues: Array[Any], log: Logger) {
|
||||
def run(args: Array[String], bootClasspathString: String, classpathString: String, initialCommands: String, cleanupCommands: String, loader: ClassLoader, bindNames: Array[String], bindValues: Array[Any], log: Logger): Unit = {
|
||||
lazy val interpreterSettings = MakeSettings.sync(args.toList, log)
|
||||
val compilerSettings = MakeSettings.sync(args, bootClasspathString, classpathString, log)
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ class ConsoleInterface {
|
|||
} else
|
||||
super.createInterpreter()
|
||||
|
||||
def bind(values: Seq[(String, Any)]) {
|
||||
def bind(values: Seq[(String, Any)]): Unit = {
|
||||
// for 2.8 compatibility
|
||||
final class Compat {
|
||||
def bindValue(id: String, value: Any) =
|
||||
|
|
@ -53,7 +53,7 @@ class ConsoleInterface {
|
|||
if (!initialCommands.isEmpty)
|
||||
interpreter.interpret(initialCommands)
|
||||
}
|
||||
override def closeInterpreter() {
|
||||
override def closeInterpreter(): Unit = {
|
||||
if (!cleanupCommands.isEmpty)
|
||||
interpreter.interpret(cleanupCommands)
|
||||
super.closeInterpreter()
|
||||
|
|
|
|||
|
|
@ -17,22 +17,21 @@ private object DelegatingReporter {
|
|||
private final class DelegatingReporter(warnFatal: Boolean, noWarn: Boolean, private[this] var delegate: xsbti.Reporter) extends scala.tools.nsc.reporters.Reporter {
|
||||
import scala.tools.nsc.util.{ FakePos, NoPosition, Position }
|
||||
|
||||
def dropDelegate() { delegate = null }
|
||||
def error(msg: String) { error(FakePos("scalac"), msg) }
|
||||
def dropDelegate(): Unit = { delegate = null }
|
||||
def error(msg: String): Unit = error(FakePos("scalac"), msg)
|
||||
|
||||
def printSummary() = delegate.printSummary()
|
||||
def printSummary(): Unit = delegate.printSummary()
|
||||
|
||||
override def hasErrors = delegate.hasErrors
|
||||
override def hasWarnings = delegate.hasWarnings
|
||||
def problems = delegate.problems
|
||||
override def comment(pos: Position, msg: String) = delegate.comment(convert(pos), msg)
|
||||
override def comment(pos: Position, msg: String): Unit = delegate.comment(convert(pos), msg)
|
||||
|
||||
override def reset =
|
||||
{
|
||||
super.reset
|
||||
delegate.reset
|
||||
}
|
||||
protected def info0(pos: Position, msg: String, rawSeverity: Severity, force: Boolean) {
|
||||
override def reset(): Unit = {
|
||||
super.reset
|
||||
delegate.reset()
|
||||
}
|
||||
protected def info0(pos: Position, msg: String, rawSeverity: Severity, force: Boolean): Unit = {
|
||||
val skip = rawSeverity == WARNING && noWarn
|
||||
if (!skip) {
|
||||
val severity = if (warnFatal && rawSeverity == WARNING) ERROR else rawSeverity
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile {
|
|||
* that is coming from either source code (not necessarily compiled in this compilation
|
||||
* run) or from class file and calls respective callback method.
|
||||
*/
|
||||
def processDependency(on: Symbol, context: DependencyContext) {
|
||||
def processDependency(on: Symbol, context: DependencyContext): Unit = {
|
||||
def binaryDependency(file: File, className: String) = callback.binaryDependency(file, className, sourceFile, context)
|
||||
val onSource = on.sourceFile
|
||||
if (onSource == null) {
|
||||
|
|
@ -166,7 +166,7 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile {
|
|||
}
|
||||
|
||||
/** Copied straight from Scala 2.10 as it does not exist in Scala 2.9 compiler */
|
||||
private final def debuglog(msg: => String) {
|
||||
private final def debuglog(msg: => String): Unit = {
|
||||
if (settings.debug.value)
|
||||
log(msg)
|
||||
}
|
||||
|
|
@ -199,4 +199,4 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile {
|
|||
// for Scala 2.8 and 2.9 this method is provided through SymbolCompat
|
||||
sym.enclosingTopLevelClass
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ private class Runner(args: Array[String], log: Logger, delegate: xsbti.Reporter)
|
|||
def noErrors = !reporter.hasErrors && command.ok
|
||||
|
||||
import forScope._
|
||||
def run() {
|
||||
def run(): Unit = {
|
||||
debug(log, "Calling Scaladoc with arguments:\n\t" + args.mkString("\n\t"))
|
||||
if (noErrors) {
|
||||
import doc._ // 2.8 trunk and Beta1-RC4 have doc.DocFactory. For other Scala versions, the next line creates forScope.DocFactory
|
||||
|
|
@ -48,7 +48,7 @@ private class Runner(args: Array[String], log: Logger, delegate: xsbti.Reporter)
|
|||
def process(units: Iterator[CompilationUnit]) = error("for 2.8 compatibility only")
|
||||
}
|
||||
}
|
||||
def document(ignore: Seq[String]) {
|
||||
def document(ignore: Seq[String]): Unit = {
|
||||
import compiler._
|
||||
val run = new Run
|
||||
run compile command.files
|
||||
|
|
@ -65,4 +65,4 @@ private class Runner(args: Array[String], log: Logger, delegate: xsbti.Reporter)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class ComponentCompiler(compiler: RawCompiler, manager: ComponentManager) {
|
|||
val base = id + binSeparator + compiler.scalaInstance.actualVersion
|
||||
if (withJavaVersion) base + "__" + javaVersion else base
|
||||
}
|
||||
protected def compileAndInstall(id: String, binID: String) {
|
||||
protected def compileAndInstall(id: String, binID: String): Unit = {
|
||||
val srcID = id + srcExtension
|
||||
IO.withTemporaryDirectory { binaryDirectory =>
|
||||
val targetJar = new File(binaryDirectory, id + ".jar")
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ object AnalysisFormats {
|
|||
time(label + ".read.end")
|
||||
r
|
||||
}
|
||||
def writes(out: Output, t: T) {
|
||||
def writes(out: Output, t: T): Unit = {
|
||||
time(label + ".write.start")
|
||||
f.writes(out, t)
|
||||
time(label + ".write.end")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.io.File
|
|||
|
||||
object FileBasedStore {
|
||||
def apply(file: File): AnalysisStore = new AnalysisStore {
|
||||
def set(analysis: Analysis, setup: CompileSetup) {
|
||||
def set(analysis: Analysis, setup: CompileSetup): Unit = {
|
||||
Using.fileWriter(IO.utf8)(file) { writer => TextAnalysisFormat.write(writer, analysis, setup) }
|
||||
}
|
||||
|
||||
|
|
@ -17,4 +17,4 @@ object FileBasedStore {
|
|||
def getUncaught(): (Analysis, CompileSetup) =
|
||||
Using.fileReader(IO.utf8)(file) { reader => TextAnalysisFormat.read(reader) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ private[inc] object FormatTimer {
|
|||
ret
|
||||
}
|
||||
|
||||
def close(key: String) {
|
||||
def close(key: String): Unit = {
|
||||
if (printTimings) {
|
||||
println("[%s] %dms".format(key, timers.getOrElse(key, 0L) / 1000000))
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ object TextAnalysisFormat {
|
|||
import AnalysisFormats._
|
||||
implicit val compilationF = xsbt.api.CompilationFormat
|
||||
|
||||
def write(out: Writer, analysis: Analysis, setup: CompileSetup) {
|
||||
def write(out: Writer, analysis: Analysis, setup: CompileSetup): Unit = {
|
||||
VersionF.write(out)
|
||||
// We start with writing compile setup which contains value of the `nameHashing`
|
||||
// flag that is needed to properly deserialize relations
|
||||
|
|
@ -82,12 +82,12 @@ object TextAnalysisFormat {
|
|||
private[this] object VersionF {
|
||||
val currentVersion = "5"
|
||||
|
||||
def write(out: Writer) {
|
||||
def write(out: Writer): Unit = {
|
||||
out.write("format version: %s\n".format(currentVersion))
|
||||
}
|
||||
|
||||
private val versionPattern = """format version: (\w+)""".r
|
||||
def read(in: BufferedReader) {
|
||||
def read(in: BufferedReader): Unit = {
|
||||
in.readLine() match {
|
||||
case versionPattern(version) => validateVersion(version)
|
||||
case s: String => throw new ReadException("\"format version: <version>\"", s)
|
||||
|
|
@ -95,7 +95,7 @@ object TextAnalysisFormat {
|
|||
}
|
||||
}
|
||||
|
||||
def validateVersion(version: String) {
|
||||
def validateVersion(version: String): Unit = {
|
||||
// TODO: Support backwards compatibility?
|
||||
if (version != currentVersion) {
|
||||
throw new ReadException("File uses format version %s, but we are compatible with version %s only.".format(version, currentVersion))
|
||||
|
|
@ -121,14 +121,14 @@ object TextAnalysisFormat {
|
|||
val usedNames = "used names"
|
||||
}
|
||||
|
||||
def write(out: Writer, relations: Relations) {
|
||||
def write(out: Writer, relations: Relations): Unit = {
|
||||
// This ordering is used to persist all values in order. Since all values will be
|
||||
// persisted using their string representation, it makes sense to sort them using
|
||||
// their string representation.
|
||||
val toStringOrd = new Ordering[Any] {
|
||||
def compare(a: Any, b: Any) = a.toString compare b.toString
|
||||
}
|
||||
def writeRelation[T](header: String, rel: Relation[File, T]) {
|
||||
def writeRelation[T](header: String, rel: Relation[File, T]): Unit = {
|
||||
writeHeader(out, header)
|
||||
writeSize(out, rel.size)
|
||||
// We sort for ease of debugging and for more efficient reconstruction when reading.
|
||||
|
|
@ -156,7 +156,7 @@ object TextAnalysisFormat {
|
|||
var currentItem: (File, T) = null
|
||||
var currentFile: File = null
|
||||
var currentVals: List[T] = Nil
|
||||
def closeEntry() {
|
||||
def closeEntry(): Unit = {
|
||||
if (currentFile != null) forward = (currentFile, currentVals.toSet) :: forward
|
||||
currentFile = currentItem._1
|
||||
currentVals = currentItem._2 :: Nil
|
||||
|
|
@ -183,7 +183,7 @@ object TextAnalysisFormat {
|
|||
val classNames = "class names"
|
||||
}
|
||||
|
||||
def write(out: Writer, stamps: Stamps) {
|
||||
def write(out: Writer, stamps: Stamps): Unit = {
|
||||
def doWriteMap[V](header: String, m: Map[File, V]) = writeMap(out)(header, m, { v: V => v.toString })
|
||||
|
||||
doWriteMap(Headers.products, stamps.products)
|
||||
|
|
@ -212,7 +212,7 @@ object TextAnalysisFormat {
|
|||
val stringToSource = ObjectStringifier.stringToObj[Source] _
|
||||
val sourceToString = ObjectStringifier.objToString[Source] _
|
||||
|
||||
def write(out: Writer, apis: APIs) {
|
||||
def write(out: Writer, apis: APIs): Unit = {
|
||||
writeMap(out)(Headers.internal, apis.internal, sourceToString, inlineVals = false)
|
||||
writeMap(out)(Headers.external, apis.external, sourceToString, inlineVals = false)
|
||||
FormatTimer.close("bytes -> base64")
|
||||
|
|
@ -237,7 +237,7 @@ object TextAnalysisFormat {
|
|||
val stringToSourceInfo = ObjectStringifier.stringToObj[SourceInfo] _
|
||||
val sourceInfoToString = ObjectStringifier.objToString[SourceInfo] _
|
||||
|
||||
def write(out: Writer, infos: SourceInfos) { writeMap(out)(Headers.infos, infos.allInfos, sourceInfoToString, inlineVals = false) }
|
||||
def write(out: Writer, infos: SourceInfos): Unit = writeMap(out)(Headers.infos, infos.allInfos, sourceInfoToString, inlineVals = false)
|
||||
def read(in: BufferedReader): SourceInfos = SourceInfos.make(readMap(in)(Headers.infos, new File(_), stringToSourceInfo))
|
||||
}
|
||||
|
||||
|
|
@ -249,9 +249,8 @@ object TextAnalysisFormat {
|
|||
val stringToCompilation = ObjectStringifier.stringToObj[Compilation] _
|
||||
val compilationToString = ObjectStringifier.objToString[Compilation] _
|
||||
|
||||
def write(out: Writer, compilations: Compilations) {
|
||||
def write(out: Writer, compilations: Compilations): Unit =
|
||||
writeSeq(out)(Headers.compilations, compilations.allCompilations, compilationToString)
|
||||
}
|
||||
|
||||
def read(in: BufferedReader): Compilations = Compilations.make(
|
||||
readSeq[Compilation](in)(Headers.compilations, stringToCompilation))
|
||||
|
|
@ -272,7 +271,7 @@ object TextAnalysisFormat {
|
|||
private[this] val multipleOutputMode = "multiple"
|
||||
private[this] val singleOutputKey = new File("output dir")
|
||||
|
||||
def write(out: Writer, setup: CompileSetup) {
|
||||
def write(out: Writer, setup: CompileSetup): Unit = {
|
||||
val (mode, outputAsMap) = setup.output match {
|
||||
case s: SingleOutput => (singleOutputMode, Map(singleOutputKey -> s.outputDirectory))
|
||||
case m: MultipleOutput => (multipleOutputMode, m.outputGroups.map(x => x.sourceDirectory -> x.outputDirectory).toMap)
|
||||
|
|
@ -341,18 +340,14 @@ object TextAnalysisFormat {
|
|||
|
||||
// Various helper functions.
|
||||
|
||||
private[this] def writeHeader(out: Writer, header: String) {
|
||||
out.write(header + ":\n")
|
||||
}
|
||||
private[this] def writeHeader(out: Writer, header: String): Unit = out.write(header + ":\n")
|
||||
|
||||
private[this] def expectHeader(in: BufferedReader, expectedHeader: String) {
|
||||
private[this] def expectHeader(in: BufferedReader, expectedHeader: String): Unit = {
|
||||
val header = in.readLine()
|
||||
if (header != expectedHeader + ":") throw new ReadException(expectedHeader, if (header == null) "EOF" else header)
|
||||
}
|
||||
|
||||
private[this] def writeSize(out: Writer, n: Int) {
|
||||
out.write("%d items\n".format(n))
|
||||
}
|
||||
private[this] def writeSize(out: Writer, n: Int): Unit = out.write("%d items\n".format(n))
|
||||
|
||||
private val itemsPattern = """(\d+) items""".r
|
||||
private[this] def readSize(in: BufferedReader): Int = {
|
||||
|
|
@ -363,7 +358,7 @@ object TextAnalysisFormat {
|
|||
}
|
||||
}
|
||||
|
||||
private[this] def writeSeq[T](out: Writer)(header: String, s: Seq[T], t2s: T => String) {
|
||||
private[this] def writeSeq[T](out: Writer)(header: String, s: Seq[T], t2s: T => String): Unit = {
|
||||
// We write sequences as idx -> element maps, for uniformity with maps/relations.
|
||||
def n = s.length
|
||||
val numDigits = if (n < 2) 1 else math.log10(n - 1).toInt + 1
|
||||
|
|
@ -376,7 +371,7 @@ object TextAnalysisFormat {
|
|||
private[this] def readSeq[T](in: BufferedReader)(expectedHeader: String, s2t: String => T): Seq[T] =
|
||||
(readPairs(in)(expectedHeader, identity[String], s2t).toSeq.sortBy(_._1) map (_._2))
|
||||
|
||||
private[this] def writeMap[K, V](out: Writer)(header: String, m: Map[K, V], v2s: V => String, inlineVals: Boolean = true)(implicit ord: Ordering[K]) {
|
||||
private[this] def writeMap[K, V](out: Writer)(header: String, m: Map[K, V], v2s: V => String, inlineVals: Boolean = true)(implicit ord: Ordering[K]): Unit = {
|
||||
writeHeader(out, header)
|
||||
writeSize(out, m.size)
|
||||
m.keys.toSeq.sorted foreach { k =>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ object CompilationFormat extends Format[Compilation] {
|
|||
val oin = new ObjectInputStream(new InputWrapperStream(in))
|
||||
try { oin.readObject.asInstanceOf[Compilation] } finally { oin.close() }
|
||||
}
|
||||
def writes(out: Output, src: Compilation) {
|
||||
def writes(out: Output, src: Compilation): Unit = {
|
||||
val oout = new ObjectOutputStream(new OutputWrapperStream(out))
|
||||
try { oout.writeObject(src) } finally { oout.close() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ object SourceFormat extends Format[Source] {
|
|||
val oin = new ObjectInputStream(new InputWrapperStream(in))
|
||||
try { oin.readObject.asInstanceOf[Source] } finally { oin.close() }
|
||||
}
|
||||
def writes(out: Output, src: Source) {
|
||||
def writes(out: Output, src: Source): Unit = {
|
||||
val oout = new ObjectOutputStream(new OutputWrapperStream(out))
|
||||
try { oout.writeObject(src) } finally { oout.close() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class LoggerReporter(maximumErrors: Int, log: Logger, sourcePositionMapper: Posi
|
|||
|
||||
reset()
|
||||
|
||||
def reset() {
|
||||
def reset(): Unit = {
|
||||
count.put(Warn, 0)
|
||||
count.put(SInfo, 0)
|
||||
count.put(Error, 0)
|
||||
|
|
@ -60,9 +60,9 @@ class LoggerReporter(maximumErrors: Int, log: Logger, sourcePositionMapper: Posi
|
|||
def hasWarnings = count.get(Warn) > 0
|
||||
def hasErrors = count.get(Error) > 0
|
||||
def problems: Array[Problem] = allProblems.toArray
|
||||
def comment(pos: Position, msg: String) {}
|
||||
def comment(pos: Position, msg: String): Unit = ()
|
||||
|
||||
def printSummary() {
|
||||
def printSummary(): Unit = {
|
||||
val warnings = count.get(Severity.Warn)
|
||||
if (warnings > 0)
|
||||
log.warn(countElementsAsString(warnings, "warning") + " found")
|
||||
|
|
@ -73,7 +73,7 @@ class LoggerReporter(maximumErrors: Int, log: Logger, sourcePositionMapper: Posi
|
|||
|
||||
def inc(sev: Severity) = count.put(sev, count.get(sev) + 1)
|
||||
|
||||
def display(pos: Position, msg: String, severity: Severity) {
|
||||
def display(pos: Position, msg: String, severity: Severity): Unit = {
|
||||
inc(severity)
|
||||
if (severity != Error || maximumErrors <= 0 || count.get(severity) <= maximumErrors)
|
||||
print(severityLogger(severity), pos, msg)
|
||||
|
|
@ -88,7 +88,7 @@ class LoggerReporter(maximumErrors: Int, log: Logger, sourcePositionMapper: Posi
|
|||
})
|
||||
}
|
||||
|
||||
def print(log: (=> String) => Unit, pos: Position, msg: String) {
|
||||
def print(log: (=> String) => Unit, pos: Position, msg: String): Unit = {
|
||||
if (pos.sourcePath.isEmpty && pos.line.isEmpty)
|
||||
log(msg)
|
||||
else {
|
||||
|
|
@ -132,4 +132,4 @@ class LoggerReporter(maximumErrors: Int, log: Logger, sourcePositionMapper: Posi
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs
|
|||
filterLibrary(classpath) ++ include(cp.compiler, scalaInstance.compilerJar) ++ include(cp.extra, scalaInstance.otherJars: _*)
|
||||
private[this] def include(flag: Boolean, jars: File*) = if (flag) jars else Nil
|
||||
private[this] def abs(files: Seq[File]) = files.map(_.getAbsolutePath).sortWith(_ < _)
|
||||
private[this] def checkScalaHomeUnset() {
|
||||
private[this] def checkScalaHomeUnset(): Unit = {
|
||||
val scalaHome = System.getProperty("scala.home")
|
||||
assert((scalaHome eq null) || scalaHome.isEmpty, "'scala.home' should not be set (was " + scalaHome + ")")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ object CompilerCache {
|
|||
def apply(maxInstances: Int): GlobalsCache = new CompilerCache(maxInstances)
|
||||
|
||||
val fresh: GlobalsCache = new GlobalsCache {
|
||||
def clear() {}
|
||||
def clear(): Unit = ()
|
||||
def apply(args: Array[String], output: Output, forceNew: Boolean, c: CachedCompilerProvider, log: xLogger, reporter: Reporter): CachedCompiler =
|
||||
c.newCachedCompiler(args, output, log, reporter, /*resident = */ false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ object JavaCompiler {
|
|||
val javaCp = ClasspathOptions.javac(cp.compiler)
|
||||
(new CompilerArguments(scalaInstance, javaCp))(sources, augmentedClasspath, Some(outputDirectory), options)
|
||||
}
|
||||
def compile(contract: JavacContract, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger) {
|
||||
def compile(contract: JavacContract, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger): Unit = {
|
||||
val arguments = commandArguments(sources, classpath, outputDirectory, options, log)
|
||||
onArgsF(arguments)
|
||||
val code: Int = f(contract, arguments, log)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.io.File
|
|||
* the scala-library.jar from `scalaInstance` is put on bootclasspath and the scala-compiler jar goes on the classpath.
|
||||
*/
|
||||
class RawCompiler(val scalaInstance: xsbti.compile.ScalaInstance, cp: ClasspathOptions, log: Logger) {
|
||||
def apply(sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String]) {
|
||||
def apply(sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String]): Unit = {
|
||||
// reflection is required for binary compatibility
|
||||
// The following import ensures there is a compile error if the identifiers change,
|
||||
// but should not be otherwise directly referenced
|
||||
|
|
@ -27,7 +27,7 @@ class RawCompiler(val scalaInstance: xsbti.compile.ScalaInstance, cp: ClasspathO
|
|||
checkForFailure(mainClass, arguments.toArray)
|
||||
}
|
||||
def compilerArguments = new CompilerArguments(scalaInstance, cp)
|
||||
protected def checkForFailure(mainClass: Class[_], args: Array[String]) {
|
||||
protected def checkForFailure(mainClass: Class[_], args: Array[String]): Unit = {
|
||||
val reporter = mainClass.getMethod("reporter").invoke(null)
|
||||
val failed = reporter.getClass.getMethod("hasErrors").invoke(reporter).asInstanceOf[Boolean]
|
||||
if (failed) throw new CompileFailed(args, "Plain compile failed", Array())
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ final class DiagnosticsReporter(reporter: Reporter) extends DiagnosticListener[J
|
|||
Option(source).map(_.toUri.toString)
|
||||
}
|
||||
}
|
||||
override def report(d: Diagnostic[_ <: JavaFileObject]) {
|
||||
override def report(d: Diagnostic[_ <: JavaFileObject]): Unit = {
|
||||
val severity =
|
||||
d.getKind match {
|
||||
case Diagnostic.Kind.ERROR => Severity.Error
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ private class ProcessLoggerWriter(delegate: ProcessLogger, level: Level.Value, n
|
|||
process()
|
||||
}
|
||||
|
||||
private[this] def process() {
|
||||
private[this] def process(): Unit = {
|
||||
val i = buffer.indexOf(nl)
|
||||
if (i >= 0) {
|
||||
log(buffer.substring(0, i))
|
||||
|
|
|
|||
|
|
@ -13,22 +13,22 @@ class TestCallback(override val nameHashing: Boolean = false) extends AnalysisCa
|
|||
val usedNames = scala.collection.mutable.Map.empty[File, Set[String]].withDefaultValue(Set.empty)
|
||||
val apis: scala.collection.mutable.Map[File, SourceAPI] = scala.collection.mutable.Map.empty
|
||||
|
||||
def sourceDependency(dependsOn: File, source: File, inherited: Boolean) {
|
||||
def sourceDependency(dependsOn: File, source: File, inherited: Boolean): Unit = {
|
||||
val context = if(inherited) DependencyByInheritance else DependencyByMemberRef
|
||||
sourceDependency(dependsOn, source, context)
|
||||
}
|
||||
def sourceDependency(dependsOn: File, source: File, context: DependencyContext) { sourceDependencies += ((dependsOn, source, context)) }
|
||||
def binaryDependency(binary: File, name: String, source: File, inherited: Boolean) {
|
||||
def sourceDependency(dependsOn: File, source: File, context: DependencyContext): Unit = { sourceDependencies += ((dependsOn, source, context)) }
|
||||
def binaryDependency(binary: File, name: String, source: File, inherited: Boolean): Unit = {
|
||||
val context = if(inherited) DependencyByInheritance else DependencyByMemberRef
|
||||
binaryDependency(binary, name, source, context)
|
||||
}
|
||||
def binaryDependency(binary: File, name: String, source: File, context: DependencyContext) { binaryDependencies += ((binary, name, source, context)) }
|
||||
def generatedClass(source: File, module: File, name: String) { products += ((source, module, name)) }
|
||||
def binaryDependency(binary: File, name: String, source: File, context: DependencyContext): Unit = { binaryDependencies += ((binary, name, source, context)) }
|
||||
def generatedClass(source: File, module: File, name: String): Unit = { products += ((source, module, name)) }
|
||||
|
||||
def usedName(source: File, name: String) { usedNames(source) += name }
|
||||
def usedName(source: File, name: String): Unit = { usedNames(source) += name }
|
||||
def api(source: File, sourceAPI: SourceAPI): Unit = {
|
||||
assert(!apis.contains(source), s"The `api` method should be called once per source file: $source")
|
||||
apis(source) = sourceAPI
|
||||
}
|
||||
def problem(category: String, pos: xsbti.Position, message: String, severity: xsbti.Severity, reported: Boolean) {}
|
||||
def problem(category: String, pos: xsbti.Position, message: String, severity: xsbti.Severity, reported: Boolean): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import inc.Relations
|
|||
object DotGraph {
|
||||
private def fToString(roots: Iterable[File]): (File => String) =
|
||||
(x: File) => sourceToString(roots, x)
|
||||
def sources(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]) {
|
||||
def sources(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]): Unit = {
|
||||
val toString = fToString(sourceRoots)
|
||||
apply(relations, outputDirectory, toString, toString)
|
||||
}
|
||||
def packages(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]) {
|
||||
def packages(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]): Unit = {
|
||||
val packageOnly = (path: String) =>
|
||||
{
|
||||
val last = path.lastIndexOf(File.separatorChar)
|
||||
|
|
@ -23,7 +23,7 @@ object DotGraph {
|
|||
val toString = packageOnly compose fToString(sourceRoots)
|
||||
apply(relations, outputDirectory, toString, toString)
|
||||
}
|
||||
def apply(relations: Relations, outputDir: File, sourceToString: File => String, externalToString: File => String) {
|
||||
def apply(relations: Relations, outputDir: File, sourceToString: File => String, externalToString: File => String): Unit = {
|
||||
def file(name: String) = new File(outputDir, name)
|
||||
IO.createDirectory(outputDir)
|
||||
generateGraph(file("int-source-deps"), "dependencies", relations.internalSrcDep, sourceToString, sourceToString)
|
||||
|
|
@ -60,4 +60,4 @@ object DotGraph {
|
|||
val shortest = (Int.MaxValue /: relativized)(_ min _.length)
|
||||
relativized.find(_.length == shortest).getOrElse(path.getName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ object Package {
|
|||
|
||||
def mergeAttributes(a1: Attributes, a2: Attributes) = a1 ++= a2
|
||||
// merges `mergeManifest` into `manifest` (mutating `manifest` in the process)
|
||||
def mergeManifests(manifest: Manifest, mergeManifest: Manifest) {
|
||||
def mergeManifests(manifest: Manifest, mergeManifest: Manifest): Unit = {
|
||||
mergeAttributes(manifest.getMainAttributes, mergeManifest.getMainAttributes)
|
||||
val entryMap = mapAsScalaMap(manifest.getEntries)
|
||||
for ((key, value) <- mergeManifest.getEntries) {
|
||||
|
|
@ -44,7 +44,7 @@ object Package {
|
|||
}
|
||||
|
||||
final class Configuration(val sources: Seq[(File, String)], val jar: File, val options: Seq[PackageOption])
|
||||
def apply(conf: Configuration, cacheFile: File, log: Logger) {
|
||||
def apply(conf: Configuration, cacheFile: File, log: Logger): Unit = {
|
||||
val manifest = new Manifest
|
||||
val main = manifest.getMainAttributes
|
||||
for (option <- conf.options) {
|
||||
|
|
@ -71,7 +71,7 @@ object Package {
|
|||
val inputs = map :+: lastModified(map.keySet) :+: manifest :+: HNil
|
||||
cachedMakeJar(inputs)(() => exists(conf.jar))
|
||||
}
|
||||
def setVersion(main: Attributes) {
|
||||
def setVersion(main: Attributes): Unit = {
|
||||
val version = Attributes.Name.MANIFEST_VERSION
|
||||
if (main.getValue(version) eq null)
|
||||
main.put(version, "1.0")
|
||||
|
|
@ -90,7 +90,7 @@ object Package {
|
|||
val attribVals = Seq(name, version, orgName, org)
|
||||
ManifestAttributes((attribKeys zip attribVals) ++ { homepage map (h => (IMPLEMENTATION_URL, h.toString)) }: _*)
|
||||
}
|
||||
def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger) {
|
||||
def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger): Unit = {
|
||||
log.info("Packaging " + jar.getAbsolutePath + " ...")
|
||||
IO.delete(jar)
|
||||
log.debug(sourcesDebugString(sources))
|
||||
|
|
@ -104,4 +104,4 @@ object Package {
|
|||
implicit def manifestFormat: Format[Manifest] = streamFormat(_ write _, in => new Manifest(in))
|
||||
|
||||
implicit def stringMapEquiv: Equiv[Map[File, String]] = defaultEquiv
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
|
|||
import global._
|
||||
import definitions._
|
||||
|
||||
private[sbt] def unlinkDeferred() {
|
||||
private[sbt] def unlinkDeferred(): Unit = {
|
||||
toUnlinkLater foreach unlink
|
||||
toUnlinkLater = Nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ object MainLoop {
|
|||
// the jline terminal in finally blocks, but hitting ctrl+c prevents finally blocks from being executed, in that
|
||||
// case the only way to restore the terminal is in a shutdown hook.
|
||||
val shutdownHook = new Thread(new Runnable {
|
||||
def run() {
|
||||
TerminalFactory.get().restore()
|
||||
}
|
||||
def run(): Unit = TerminalFactory.get().restore()
|
||||
})
|
||||
|
||||
try {
|
||||
|
|
@ -71,7 +69,7 @@ object MainLoop {
|
|||
}
|
||||
|
||||
/** Transfers logging and trace levels from the old global loggers to the new ones. */
|
||||
private[this] def transferLevels(state: State, logging: GlobalLogging) {
|
||||
private[this] def transferLevels(state: State, logging: GlobalLogging): Unit = {
|
||||
val old = state.globalLogging
|
||||
Logger.transferLevels(old.backed, logging.backed)
|
||||
(old.full, logging.full) match { // well, this is a hack
|
||||
|
|
@ -108,4 +106,4 @@ object MainLoop {
|
|||
def handleException(t: Throwable, s: State, log: Logger): State = State.handleException(t, s, log)
|
||||
|
||||
def logFullException(e: Throwable, log: Logger): Unit = State.logFullException(e, log)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ object State {
|
|||
}
|
||||
s.fail
|
||||
}
|
||||
private[sbt] def logFullException(e: Throwable, log: Logger) {
|
||||
private[sbt] def logFullException(e: Throwable, log: Logger): Unit = {
|
||||
log.trace(e)
|
||||
log.error(ErrorHandling reducedToString e)
|
||||
log.error("Use 'last' for the full log.")
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ final object Aggregation {
|
|||
showRun(complete, show)
|
||||
(complete.state, complete.results)
|
||||
}
|
||||
def showRun[T](complete: Complete[T], show: ShowConfig)(implicit display: Show[ScopedKey[_]]) {
|
||||
def showRun[T](complete: Complete[T], show: ShowConfig)(implicit display: Show[ScopedKey[_]]): Unit = {
|
||||
import complete._
|
||||
val log = state.log
|
||||
val extracted = Project extract state
|
||||
|
|
@ -76,7 +76,7 @@ final object Aggregation {
|
|||
}
|
||||
}
|
||||
|
||||
def printSuccess(start: Long, stop: Long, extracted: Extracted, success: Boolean, log: Logger) {
|
||||
def printSuccess(start: Long, stop: Long, extracted: Extracted, success: Boolean, log: Logger): Unit = {
|
||||
import extracted._
|
||||
def get(key: SettingKey[Boolean]): Boolean = key in currentRef get structure.data getOrElse true
|
||||
if (get(showSuccess)) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class MultiHandler[S, T](builtIn: S => Option[T], root: Option[S => Option
|
|||
def applyNonRoots(info: S): List[(URI, T)] =
|
||||
nonRoots flatMap { case (definingURI, loader) => loader(info) map { unit => (definingURI, unit) } }
|
||||
|
||||
private[this] def warn(baseMessage: String, log: Logger, matching: Seq[(URI, T)]) {
|
||||
private[this] def warn(baseMessage: String, log: Logger, matching: Seq[(URI, T)]): Unit = {
|
||||
log.warn(baseMessage)
|
||||
log.debug("Non-root build resolvers defined in:")
|
||||
log.debug(matching.map(_._1).mkString("\n\t"))
|
||||
|
|
@ -139,4 +139,4 @@ final class BuildLoader(
|
|||
val load = full(info) getOrElse fail(uri)
|
||||
load()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ object BuildPaths {
|
|||
def getDefault = { checkTransition(state, default); default }
|
||||
getFileSetting(globalBaseDirectory, GlobalBaseProperty, getDefault)(state)
|
||||
}
|
||||
private[this] def checkTransition(state: State, versioned: File) {
|
||||
private[this] def checkTransition(state: State, versioned: File): Unit = {
|
||||
val unversioned = defaultGlobalBase
|
||||
def globalDefined(base: File): Boolean =
|
||||
getGlobalPluginsDirectory(state, base).exists ||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ object BuildUtil {
|
|||
BuildDependencies(cp.toMap, agg.toMap)
|
||||
}
|
||||
|
||||
def checkCycles(units: Map[URI, LoadedBuildUnit]) {
|
||||
def checkCycles(units: Map[URI, LoadedBuildUnit]): Unit = {
|
||||
def getRef(pref: ProjectRef) = units(pref.build).defined(pref.project)
|
||||
def deps(proj: ResolvedProject)(base: ResolvedProject => Seq[ProjectRef]): Seq[ResolvedProject] = Dag.topologicalSort(proj)(p => base(p) map getRef)
|
||||
// check for cycles
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ package sbt
|
|||
import java.io.File
|
||||
|
||||
object ConsoleProject {
|
||||
def apply(state: State, extra: String, cleanupCommands: String = "", options: Seq[String] = Nil)(implicit log: Logger) {
|
||||
def apply(state: State, extra: String, cleanupCommands: String = "", options: Seq[String] = Nil)(implicit log: Logger): Unit = {
|
||||
val extracted = Project extract state
|
||||
val cpImports = new Imports(extracted, state)
|
||||
val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil
|
||||
|
|
|
|||
|
|
@ -1253,7 +1253,7 @@ object Classpaths {
|
|||
@deprecated("Split into ivyBaseSettings and jvmBaseSettings.", "0.13.2")
|
||||
val baseSettings: Seq[Setting[_]] = ivyBaseSettings ++ jvmBaseSettings
|
||||
|
||||
def warnResolversConflict(ress: Seq[Resolver], log: Logger) {
|
||||
def warnResolversConflict(ress: Seq[Resolver], log: Logger): Unit = {
|
||||
val resset = ress.toSet
|
||||
for ((name, r) <- resset groupBy (_.name) if r.size > 1) {
|
||||
log.warn("Multiple resolvers having different access mechanism configured with same name '" + name + "'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`).")
|
||||
|
|
@ -1588,7 +1588,7 @@ object Classpaths {
|
|||
def interSort(projectRef: ProjectRef, conf: Configuration, data: Settings[Scope], deps: BuildDependencies): Seq[(ProjectRef, String)] =
|
||||
{
|
||||
val visited = asScalaSet(new LinkedHashSet[(ProjectRef, String)])
|
||||
def visit(p: ProjectRef, c: Configuration) {
|
||||
def visit(p: ProjectRef, c: Configuration): Unit = {
|
||||
val applicableConfigs = allConfigs(c)
|
||||
for (ac <- applicableConfigs) // add all configurations in this project
|
||||
visited add (p -> ac.name)
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ object EvaluateTask {
|
|||
}
|
||||
}
|
||||
def logIncResult(result: Result[_], state: State, streams: Streams) = result match { case Inc(i) => logIncomplete(i, state, streams); case _ => () }
|
||||
def logIncomplete(result: Incomplete, state: State, streams: Streams) {
|
||||
def logIncomplete(result: Incomplete, state: State, streams: Streams): Unit = {
|
||||
val all = Incomplete linearize result
|
||||
val keyed = for (Incomplete(Some(key: ScopedKey[_]), _, msg, _, ex) <- all) yield (key, msg, ex)
|
||||
val un = all.filter { i => i.node.isEmpty || i.message.isEmpty }
|
||||
|
|
|
|||
|
|
@ -340,12 +340,12 @@ object Load {
|
|||
}
|
||||
case Nil => (references, builds, loaders)
|
||||
}
|
||||
def checkProjectBase(buildBase: File, projectBase: File) {
|
||||
def checkProjectBase(buildBase: File, projectBase: File): Unit = {
|
||||
checkDirectory(projectBase)
|
||||
assert(buildBase == projectBase || IO.relativize(buildBase, projectBase).isDefined, "Directory " + projectBase + " is not contained in build root " + buildBase)
|
||||
}
|
||||
def checkBuildBase(base: File) = checkDirectory(base)
|
||||
def checkDirectory(base: File) {
|
||||
def checkDirectory(base: File): Unit = {
|
||||
assert(base.isAbsolute, "Not absolute: " + base)
|
||||
if (base.isFile)
|
||||
sys.error("Not a directory: " + base)
|
||||
|
|
@ -360,7 +360,7 @@ object Load {
|
|||
(uri, unit.resolveRefs(ref => Scope.resolveProjectRef(uri, rootProject, ref)))
|
||||
}
|
||||
}
|
||||
def checkAll(referenced: Map[URI, List[ProjectReference]], builds: Map[URI, sbt.PartBuildUnit]) {
|
||||
def checkAll(referenced: Map[URI, List[ProjectReference]], builds: Map[URI, sbt.PartBuildUnit]): Unit = {
|
||||
val rootProject = getRootProject(builds)
|
||||
for ((uri, refs) <- referenced; ref <- refs) {
|
||||
val ProjectRef(refURI, refID) = Scope.resolveProjectRef(uri, rootProject, ref)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ object LogManager {
|
|||
else {
|
||||
val logging = s.globalLogging
|
||||
def get[T](key: SettingKey[T]) = key in GlobalScope get data
|
||||
def transfer(l: AbstractLogger, traceKey: SettingKey[Int], levelKey: SettingKey[Level.Value]) {
|
||||
def transfer(l: AbstractLogger, traceKey: SettingKey[Int], levelKey: SettingKey[Level.Value]): Unit = {
|
||||
get(traceKey).foreach(l.setTrace)
|
||||
get(levelKey).foreach(l.setLevel)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,13 +211,13 @@ object BuiltinCommands {
|
|||
if (Project.isProjectLoaded(s)) loadedEval(s, arg) else rawEval(s, arg)
|
||||
s
|
||||
}
|
||||
private[this] def loadedEval(s: State, arg: String) {
|
||||
private[this] def loadedEval(s: State, arg: String): Unit = {
|
||||
val extracted = Project extract s
|
||||
import extracted._
|
||||
val result = session.currentEval().eval(arg, srcName = "<eval>", imports = autoImports(extracted))
|
||||
s.log.info(s"ans: ${result.tpe} = ${result.getValue(currentLoader)}")
|
||||
}
|
||||
private[this] def rawEval(s: State, arg: String) {
|
||||
private[this] def rawEval(s: State, arg: String): Unit = {
|
||||
val app = s.configuration.provider
|
||||
val classpath = app.mainClasspath ++ app.scalaProvider.jars
|
||||
val result = Load.mkEval(classpath, s.baseDir, Nil).eval(arg, srcName = "<eval>", imports = new EvalImports(Nil, ""))
|
||||
|
|
@ -405,7 +405,7 @@ object BuiltinCommands {
|
|||
case (s, Some(modifyBuilds)) => transformExtraBuilds(s, modifyBuilds)
|
||||
case (s, None) => showProjects(s); s
|
||||
}
|
||||
def showProjects(s: State) {
|
||||
def showProjects(s: State): Unit = {
|
||||
val extracted = Project extract s
|
||||
import extracted._
|
||||
import currentRef.{ build => curi, project => cid }
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ object Plugins extends PluginsFunctions {
|
|||
private[this] def literalsString(lits: Seq[Literal]): String =
|
||||
lits map { case Atom(l) => l; case Negated(Atom(l)) => l } mkString(", ")
|
||||
|
||||
private[this] def duplicateProvidesError(byAtom: Seq[(Atom, AutoPlugin)]) {
|
||||
private[this] def duplicateProvidesError(byAtom: Seq[(Atom, AutoPlugin)]): Unit = {
|
||||
val dupsByAtom = byAtom.groupBy(_._1).mapValues(_.map(_._2))
|
||||
val dupStrings = for( (atom, dups) <- dupsByAtom if dups.size > 1 ) yield
|
||||
s"${atom.label} by ${dups.mkString(", ")}"
|
||||
|
|
@ -215,7 +215,7 @@ object Plugins extends PluginsFunctions {
|
|||
val message = s"Plugin$ns provided by multiple AutoPlugins:$nl${dupStrings.mkString(nl)}"
|
||||
throw AutoPluginException(message)
|
||||
}
|
||||
private[this] def exlusionConflictError(requested: Plugins, selected: Seq[AutoPlugin], conflicting: Seq[AutoPlugin]) {
|
||||
private[this] def exlusionConflictError(requested: Plugins, selected: Seq[AutoPlugin], conflicting: Seq[AutoPlugin]): Unit = {
|
||||
def listConflicts(ns: Seq[AutoPlugin]) = (ns map { c =>
|
||||
val reasons = (if (flatten(requested) contains c) List("requested")
|
||||
else Nil) ++
|
||||
|
|
|
|||
|
|
@ -451,12 +451,12 @@ object Project extends ProjectExtra {
|
|||
}
|
||||
def settingGraph(structure: BuildStructure, basedir: File, scoped: ScopedKey[_])(implicit display: Show[ScopedKey[_]]): SettingGraph =
|
||||
SettingGraph(structure, basedir, scoped, 0)
|
||||
def graphSettings(structure: BuildStructure, basedir: File)(implicit display: Show[ScopedKey[_]]) {
|
||||
def graphSettings(structure: BuildStructure, basedir: File)(implicit display: Show[ScopedKey[_]]): Unit = {
|
||||
def graph(actual: Boolean, name: String) = graphSettings(structure, actual, name, new File(basedir, name + ".dot"))
|
||||
graph(true, "actual_dependencies")
|
||||
graph(false, "declared_dependencies")
|
||||
}
|
||||
def graphSettings(structure: BuildStructure, actual: Boolean, graphName: String, file: File)(implicit display: Show[ScopedKey[_]]) {
|
||||
def graphSettings(structure: BuildStructure, actual: Boolean, graphName: String, file: File)(implicit display: Show[ScopedKey[_]]): Unit = {
|
||||
val rel = relation(structure, actual)
|
||||
val keyToString = display.apply _
|
||||
DotGraph.generateGraph(file, graphName, rel, keyToString, keyToString)
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ object Resolvers {
|
|||
val mercurial: Resolver = new DistributedVCS {
|
||||
override val scheme = "hg"
|
||||
|
||||
override def clone(from: String, to: File) {
|
||||
override def clone(from: String, to: File): Unit = {
|
||||
run("hg", "clone", "-q", from, to.getAbsolutePath)
|
||||
}
|
||||
|
||||
override def checkout(branch: String, in: File) {
|
||||
override def checkout(branch: String, in: File): Unit = {
|
||||
run(Some(in), "hg", "checkout", "-q", branch)
|
||||
}
|
||||
}.toResolver
|
||||
|
|
@ -121,11 +121,10 @@ object Resolvers {
|
|||
isWindows && !isCygwin
|
||||
}
|
||||
|
||||
def run(command: String*) {
|
||||
def run(command: String*): Unit =
|
||||
run(None, command: _*)
|
||||
}
|
||||
|
||||
def run(cwd: Option[File], command: String*) {
|
||||
def run(cwd: Option[File], command: String*): Unit = {
|
||||
val result = Process(
|
||||
if (onWindows) "cmd" +: "/c" +: command
|
||||
else command,
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ object SessionSettings {
|
|||
def pluralize(size: Int, of: String) = size.toString + (if (size == 1) of else (of + "s"))
|
||||
|
||||
/** Checks to see if any session settings are being discarded and issues a warning. */
|
||||
def checkSession(newSession: SessionSettings, oldState: State) {
|
||||
def checkSession(newSession: SessionSettings, oldState: State): Unit = {
|
||||
val oldSettings = (oldState get Keys.sessionSettings).toList.flatMap(_.append).flatMap(_._2)
|
||||
if (newSession.append.isEmpty && oldSettings.nonEmpty)
|
||||
oldState.log.warn("Discarding " + pluralize(oldSettings.size, " session setting") + ". Use 'session save' to persist session settings.")
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ trait SplitExpression {
|
|||
trait SplitExpressionsBehavior extends SplitExpression {
|
||||
this: SpecificationLike =>
|
||||
|
||||
def oldExpressionsSplitter(implicit splitter: SplitExpressions.SplitExpression) {
|
||||
def oldExpressionsSplitter(implicit splitter: SplitExpressions.SplitExpression): Unit = {
|
||||
|
||||
"parse a simple setting" in {
|
||||
val (imports, settingsAndDefs) = split("""version := "1.0"""")
|
||||
|
|
@ -60,7 +60,7 @@ trait SplitExpressionsBehavior extends SplitExpression {
|
|||
|
||||
}
|
||||
|
||||
def newExpressionsSplitter(implicit splitter: SplitExpressions.SplitExpression) {
|
||||
def newExpressionsSplitter(implicit splitter: SplitExpressions.SplitExpression): Unit = {
|
||||
|
||||
"parse a two settings without intervening blank line" in {
|
||||
val (imports, settings) = split("""version := "1.0"
|
||||
|
|
@ -90,4 +90,4 @@ lazy val root = (project in file(".")).enablePlugins(PlayScala)""")
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ object Scripted {
|
|||
launchOpts: Array[String], prescripted: java.util.List[File]): Unit
|
||||
}
|
||||
|
||||
def doScripted(launcher: File, scriptedSbtClasspath: Seq[Attributed[File]], scriptedSbtInstance: ScalaInstance, sourcePath: File, args: Seq[String], prescripted: File => Unit) {
|
||||
def doScripted(launcher: File, scriptedSbtClasspath: Seq[Attributed[File]], scriptedSbtInstance: ScalaInstance, sourcePath: File, args: Seq[String], prescripted: File => Unit): Unit = {
|
||||
System.err.println(s"About to run tests: ${args.mkString("\n * ", "\n * ", "\n")}")
|
||||
val noJLine = new classpath.FilteredLoader(scriptedSbtInstance.loader, "jline." :: Nil)
|
||||
val loader = classpath.ClasspathUtilities.toLoader(scriptedSbtClasspath.files, noJLine)
|
||||
|
|
|
|||
|
|
@ -82,9 +82,9 @@ object SiteMap {
|
|||
private[this] def writeXML(output: File, node: xml.Node): Unit =
|
||||
write(output, new xml.PrettyPrinter(1000, 4).format(node))
|
||||
|
||||
private[this] def write(output: File, xmlString: String) {
|
||||
private[this] def write(output: File, xmlString: String): Unit = {
|
||||
// use \n as newline because toString uses PrettyPrinter, which hard codes line endings to be \n
|
||||
IO.write(output, s"<?xml version='1.0' encoding='${IO.utf8.name}'?>\n")
|
||||
IO.append(output, xmlString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ object Transform {
|
|||
file
|
||||
}
|
||||
}
|
||||
def copyPropertiesFile(source: File, newMain: String, target: File) {
|
||||
def copyPropertiesFile(source: File, newMain: String, target: File): Unit = {
|
||||
def subMain(line: String): String = if (line.trim.startsWith("class:")) " class: " + newMain else line
|
||||
IO.writeLines(target, IO.readLines(source) map subMain)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,13 +54,13 @@ class Run(instance: ScalaInstance, trapExit: Boolean, nativeTmp: File) extends S
|
|||
|
||||
if (trapExit) Run.executeTrapExit(execute(), log) else directExecute()
|
||||
}
|
||||
private def run0(mainClassName: String, classpath: Seq[File], options: Seq[String], log: Logger) {
|
||||
private def run0(mainClassName: String, classpath: Seq[File], options: Seq[String], log: Logger): Unit = {
|
||||
log.debug(" Classpath:\n\t" + classpath.mkString("\n\t"))
|
||||
val loader = ClasspathUtilities.makeLoader(classpath, instance, nativeTmp)
|
||||
val main = getMainMethod(mainClassName, loader)
|
||||
invokeMain(loader, main, options)
|
||||
}
|
||||
private def invokeMain(loader: ClassLoader, main: Method, options: Seq[String]) {
|
||||
private def invokeMain(loader: ClassLoader, main: Method, options: Seq[String]): Unit = {
|
||||
val currentThread = Thread.currentThread
|
||||
val oldLoader = Thread.currentThread.getContextClassLoader
|
||||
currentThread.setContextClassLoader(loader)
|
||||
|
|
|
|||
|
|
@ -84,14 +84,14 @@ object TrapExit {
|
|||
s"${hex(System.identityHashCode(t))}"
|
||||
|
||||
/** Waits for the given `thread` to terminate. However, if the thread state is NEW, this method returns immediately. */
|
||||
private def waitOnThread(thread: Thread, log: Logger) {
|
||||
private def waitOnThread(thread: Thread, log: Logger): Unit = {
|
||||
log.debug("Waiting for thread " + thread.getName + " to terminate.")
|
||||
thread.join
|
||||
log.debug("\tThread " + thread.getName + " exited.")
|
||||
}
|
||||
|
||||
// interrupts the given thread, but first replaces the exception handler so that the InterruptedException is not printed
|
||||
private def safeInterrupt(thread: Thread, log: Logger) {
|
||||
private def safeInterrupt(thread: Thread, log: Logger): Unit = {
|
||||
val name = thread.getName
|
||||
log.debug("Interrupting thread " + thread.getName)
|
||||
thread.setUncaughtExceptionHandler(new TrapInterrupt(thread.getUncaughtExceptionHandler))
|
||||
|
|
@ -100,7 +100,7 @@ object TrapExit {
|
|||
}
|
||||
// an uncaught exception handler that swallows InterruptedExceptions and otherwise defers to originalHandler
|
||||
private final class TrapInterrupt(originalHandler: Thread.UncaughtExceptionHandler) extends Thread.UncaughtExceptionHandler {
|
||||
def uncaughtException(thread: Thread, e: Throwable) {
|
||||
def uncaughtException(thread: Thread, e: Throwable): Unit = {
|
||||
withCause[InterruptedException, Unit](e) { interrupted => () } { other => originalHandler.uncaughtException(thread, e) }
|
||||
thread.setUncaughtExceptionHandler(originalHandler)
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
}
|
||||
|
||||
// wait for all non-daemon threads to terminate
|
||||
private[this] def waitForExit(app: App) {
|
||||
private[this] def waitForExit(app: App): Unit = {
|
||||
var daemonsOnly = true
|
||||
app.processThreads { thread =>
|
||||
// check isAlive because calling `join` on a thread that hasn't started returns immediately
|
||||
|
|
@ -244,7 +244,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
|
||||
val exitCode = new ExitCode
|
||||
|
||||
def run() {
|
||||
def run(): Unit = {
|
||||
try execute()
|
||||
catch {
|
||||
case x: Throwable =>
|
||||
|
|
@ -282,7 +282,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
}
|
||||
|
||||
/** Registers the logging exception handler on `t`, delegating to the existing handler if it isn't the default. */
|
||||
private[this] def setExceptionHandler(t: Thread) {
|
||||
private[this] def setExceptionHandler(t: Thread): Unit = {
|
||||
val group = t.getThreadGroup
|
||||
val previousHandler = t.getUncaughtExceptionHandler match {
|
||||
case null | `group` | (_: LoggingExceptionHandler) => None
|
||||
|
|
@ -302,7 +302,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
cleanup(threads)
|
||||
cleanup(groups)
|
||||
}
|
||||
private[this] def cleanup(resources: TrieMap[ThreadID, _]) {
|
||||
private[this] def cleanup(resources: TrieMap[ThreadID, _]): Unit = {
|
||||
val snap = resources.readOnlySnapshot
|
||||
resources.clear()
|
||||
for ((id, _) <- snap)
|
||||
|
|
@ -312,7 +312,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
// only want to operate on unterminated threads
|
||||
// want to drop terminated threads, including those that have been gc'd
|
||||
/** Evaluates `f` on each `Thread` started by this [[App]] at single instant shortly after this method is called. */
|
||||
def processThreads(f: Thread => Unit) {
|
||||
def processThreads(f: Thread => Unit): Unit = {
|
||||
// pulls in threads that weren't recorded by checkAccess(Thread) (which is jvm-dependent)
|
||||
// but can be reached via the Threads in the ThreadGroups recorded by checkAccess(ThreadGroup) (not jvm-dependent)
|
||||
addUntrackedThreads()
|
||||
|
|
@ -372,7 +372,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
}
|
||||
}
|
||||
|
||||
private[this] def stopAllThreads(app: App) {
|
||||
private[this] def stopAllThreads(app: App): Unit = {
|
||||
// only try to dispose frames if we think the App used AWT
|
||||
// otherwise, we initialize AWT as a side effect of asking for the frames
|
||||
// also, we only assume one AWT application at a time
|
||||
|
|
@ -419,17 +419,17 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
// These are overridden to do nothing because there is a substantial filesystem performance penalty
|
||||
// when there is a SecurityManager defined. The default implementations of these construct a
|
||||
// FilePermission, and its initialization involves canonicalization, which is expensive.
|
||||
override def checkRead(file: String) {}
|
||||
override def checkRead(file: String, context: AnyRef) {}
|
||||
override def checkWrite(file: String) {}
|
||||
override def checkDelete(file: String) {}
|
||||
override def checkExec(cmd: String) {}
|
||||
override def checkRead(file: String): Unit = ()
|
||||
override def checkRead(file: String, context: AnyRef): Unit = ()
|
||||
override def checkWrite(file: String): Unit = ()
|
||||
override def checkDelete(file: String): Unit = ()
|
||||
override def checkExec(cmd: String): Unit = ()
|
||||
|
||||
override def checkPermission(perm: Permission) {
|
||||
override def checkPermission(perm: Permission): Unit = {
|
||||
if (delegateManager ne null)
|
||||
delegateManager.checkPermission(perm)
|
||||
}
|
||||
override def checkPermission(perm: Permission, context: AnyRef) {
|
||||
override def checkPermission(perm: Permission, context: AnyRef): Unit = {
|
||||
if (delegateManager ne null)
|
||||
delegateManager.checkPermission(perm, context)
|
||||
}
|
||||
|
|
@ -439,7 +439,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
* This is not reliably called on different jvm implementations. On openjdk and similar jvms, the Thread constructor
|
||||
* calls setPriority, which triggers this SecurityManager check. For Java 6 on OSX, this is not called, however.
|
||||
*/
|
||||
override def checkAccess(t: Thread) {
|
||||
override def checkAccess(t: Thread): Unit = {
|
||||
if (active) {
|
||||
val group = t.getThreadGroup
|
||||
noteAccess(group) { app =>
|
||||
|
|
@ -455,7 +455,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
* This is specified to be called in every Thread's constructor and every time a ThreadGroup is created.
|
||||
* This allows us to reliably track every ThreadGroup that is created and map it back to the constructing application.
|
||||
*/
|
||||
override def checkAccess(tg: ThreadGroup) {
|
||||
override def checkAccess(tg: ThreadGroup): Unit = {
|
||||
if (active && !isSystemGroup(tg)) {
|
||||
noteAccess(tg) { app =>
|
||||
app.register(tg)
|
||||
|
|
@ -476,7 +476,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
|
|||
/** `true` if there is at least one application currently being managed. */
|
||||
private[this] def active = running.get > 0
|
||||
|
||||
private def disposeAllFrames(log: Logger) {
|
||||
private def disposeAllFrames(log: Logger): Unit = {
|
||||
val allFrames = java.awt.Frame.getFrames
|
||||
if (allFrames.nonEmpty) {
|
||||
log.debug(s"Disposing ${allFrames.length} top-level windows...")
|
||||
|
|
@ -512,7 +512,7 @@ private final class ExitCode {
|
|||
* It logs the thread and the exception.
|
||||
*/
|
||||
private final class LoggingExceptionHandler(log: Logger, delegate: Option[Thread.UncaughtExceptionHandler]) extends Thread.UncaughtExceptionHandler {
|
||||
def uncaughtException(t: Thread, e: Throwable) {
|
||||
def uncaughtException(t: Thread, e: Throwable): Unit = {
|
||||
log.error("(" + t.getName + ") " + e.toString)
|
||||
log.trace(e)
|
||||
delegate.foreach(_.uncaughtException(t, e))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package sbt
|
|||
*/
|
||||
private final class TrapExitSecurityException(val exitCode: Int) extends SecurityException {
|
||||
private var accessAllowed = false
|
||||
def allowAccess() {
|
||||
def allowAccess(): Unit = {
|
||||
accessAllowed = true
|
||||
}
|
||||
override def printStackTrace = ifAccessAllowed(super.printStackTrace)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ object TestBuild extends Build
|
|||
|
||||
lazy val b = Project("b", file("b")).settings(t <<= Def.task("").updateState(updater))
|
||||
|
||||
def checkState(runs: Int, s: State) {
|
||||
def checkState(runs: Int, s: State): Unit = {
|
||||
val stored = s.get(akey).getOrElse(0)
|
||||
assert(stored == runs, "Expected " + runs + ", got " + stored)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ package jartest
|
|||
|
||||
object Main
|
||||
{
|
||||
def main(args: Array[String]) {}
|
||||
}
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ check := {
|
|||
val adel = (del in projA).?.value // should be None
|
||||
same(adel, None, "del in projA")
|
||||
val bdel = (del in projB).?.value // should be None
|
||||
same(bdel, None, "del in projB")
|
||||
same(bdel, None, "del in projB")
|
||||
val ddel = (del in projD).?.value // should be None
|
||||
same(ddel, None, "del in projD")
|
||||
//
|
||||
|
|
@ -78,6 +78,6 @@ keyTest := "foo"
|
|||
|
||||
topLevelKeyTest := "bar"
|
||||
|
||||
def same[T](actual: T, expected: T, label: String) {
|
||||
def same[T](actual: T, expected: T, label: String): Unit = {
|
||||
assert(actual == expected, s"Expected '$expected' for `$label`, got '$actual'")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ lazy val b = project.settings(
|
|||
|
||||
// ---------------- Verification
|
||||
|
||||
def same[T](x: T, y: T) {
|
||||
def same[T](x: T, y: T): Unit = {
|
||||
assert(x == y, s"Actual: '$x', Expected: '$y'")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ class SimpleTest extends Properties("Simple")
|
|||
{
|
||||
property("increment scala") = forAll( (i: Int) => (new a.b.ScalaA).increment(i) == i+1)
|
||||
property("increment java") = forAll( (i: Int) => (new JavaA).inc(i) == i+1)
|
||||
|
||||
|
||||
property("decrement scala") = forAll( (i: Int) => (new b.ScalaB).decrement(i) == i+1)
|
||||
property("decrement java") = forAll( (i: Int) => (new a.JavaB).dec(i) == i+1)
|
||||
}
|
||||
object MainTest
|
||||
{
|
||||
def main(args: Array[String]) {}
|
||||
}
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,9 @@ object MyBuild extends Build {
|
|||
|
||||
lazy val check = taskKey[Unit]("Verifies that the junit dependency has the newer version (4.8)")
|
||||
|
||||
def checkVersion(report: UpdateReport) {
|
||||
def checkVersion(report: UpdateReport): Unit = {
|
||||
for(mod <- report.allModules) {
|
||||
if(mod.name == "junit") assert(mod.revision == "4.8", s"JUnit version (${mod.revision}) does not have the correct version")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ check := {
|
|||
same(bv, "2.10")
|
||||
}
|
||||
|
||||
def same(actual: String, expected: String) {
|
||||
def same(actual: String, expected: String): Unit = {
|
||||
assert(actual == expected, s"Expected binary version to be $expected, was $actual")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
object O {
|
||||
def main(argv: Array[String]) {
|
||||
def main(argv: Array[String]): Unit = {
|
||||
new java.awt.Color(0,0,0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ concurrentRestrictions in Global := Seq(
|
|||
Tags.limitAll(math.max(EvaluateTask.SystemProcessors, 2) )
|
||||
)
|
||||
|
||||
def waitForCStart =
|
||||
def waitForCStart =
|
||||
Def.task {
|
||||
waitFor( (baseDirectory in c).value / "started" )
|
||||
}
|
||||
|
||||
def waitFor(f: File) {
|
||||
def waitFor(f: File): Unit = {
|
||||
if(!f.exists) {
|
||||
Thread.sleep(300)
|
||||
waitFor(f)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import java.io.File
|
||||
|
||||
object C {
|
||||
def main(args: Array[String]) {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val base = new File(args(0))
|
||||
create(new File(base, "started"))
|
||||
val bFin = new File(base, "../b/finished")
|
||||
|
|
@ -9,16 +9,16 @@ object C {
|
|||
create(new File(base, "finished"))
|
||||
}
|
||||
|
||||
def create(f: File) {
|
||||
def create(f: File): Unit = {
|
||||
val fabs = f.getAbsoluteFile
|
||||
fabs.getParentFile.mkdirs
|
||||
fabs.createNewFile
|
||||
}
|
||||
|
||||
def waitFor(f: File) {
|
||||
def waitFor(f: File): Unit = {
|
||||
if(!f.exists) {
|
||||
Thread.sleep(300)
|
||||
waitFor(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,22 +2,19 @@
|
|||
|
||||
object DaemonExit
|
||||
{
|
||||
def main(args: Array[String])
|
||||
{
|
||||
def main(args: Array[String]): Unit = {
|
||||
val t = new Thread {
|
||||
override def run() {
|
||||
override def run(): Unit = {
|
||||
Thread.sleep(1000)
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
// t.setDaemon(true)
|
||||
t.start()
|
||||
|
||||
|
||||
val t2 = new Thread {
|
||||
override def run() {
|
||||
synchronized { wait() }
|
||||
}
|
||||
override def run(): Unit = synchronized { wait() }
|
||||
}
|
||||
t2.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ object Daemon
|
|||
def main(args: Array[String])
|
||||
{
|
||||
val t = new Thread {
|
||||
override def run() {
|
||||
synchronized { wait() }
|
||||
}
|
||||
override def run(): Unit = synchronized { wait() }
|
||||
}
|
||||
t.setDaemon(true);
|
||||
t.start
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
object Spawn
|
||||
{
|
||||
def main(args: Array[String]) { System.exit(1); }
|
||||
}
|
||||
def main(args: Array[String]): Unit = System.exit(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
object Spawn
|
||||
{
|
||||
def main(args: Array[String]) { System.exit(0); }
|
||||
}
|
||||
def main(args: Array[String]): Unit = System.exit(0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
object Spawn
|
||||
{
|
||||
def main(args: Array[String]) {}
|
||||
}
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
object CheckLoader {
|
||||
def main(args: Array[String]) { apply() }
|
||||
def apply() {
|
||||
def main(args: Array[String]): Unit = apply()
|
||||
def apply(): Unit = {
|
||||
val loader = getClass.getClassLoader
|
||||
val appLoader = ClassLoader.getSystemClassLoader
|
||||
assert(loader eq appLoader, "Application classes not loaded in the system class loader")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
object ForkTest {
|
||||
def main(args:Array[String]) {
|
||||
def main(args:Array[String]): Unit = {
|
||||
val name = Option(System.getenv("flag.name")) getOrElse("flag")
|
||||
println("Name: " + name)
|
||||
val cwd = (new java.io.File(name)).getAbsoluteFile
|
||||
|
|
|
|||
|
|
@ -5,31 +5,25 @@
|
|||
|
||||
object Spawn
|
||||
{
|
||||
def main(args: Array[String])
|
||||
{
|
||||
def main(args: Array[String]): Unit = {
|
||||
(new ThreadA).start
|
||||
}
|
||||
class ThreadA extends Thread
|
||||
{
|
||||
override def run()
|
||||
{
|
||||
|
||||
class ThreadA extends Thread {
|
||||
override def run(): Unit = {
|
||||
sleep()
|
||||
(new ThreadB).start()
|
||||
}
|
||||
}
|
||||
class ThreadB extends Thread
|
||||
{
|
||||
override def run() { sleep() }
|
||||
class ThreadB extends Thread {
|
||||
override def run(): Unit = sleep()
|
||||
}
|
||||
private def sleep()
|
||||
{
|
||||
private def sleep(): Unit = {
|
||||
try { Thread.sleep(1000) }
|
||||
catch
|
||||
{
|
||||
case e: InterruptedException =>
|
||||
val msg = "TrapExit improperly interrupted non-daemon thread"
|
||||
System.err.println(msg)
|
||||
error(msg)
|
||||
catch { case e: InterruptedException =>
|
||||
val msg = "TrapExit improperly interrupted non-daemon thread"
|
||||
System.err.println(msg)
|
||||
error(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,5 @@ object C {
|
|||
import A._, B._
|
||||
implicitly[Ordering[Int]]
|
||||
|
||||
def main(args: Array[String]) {}
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ class B {
|
|||
// not public, so this shouldn't be tracked as an inherited dependency
|
||||
private[this] class X extends D with E[Int]
|
||||
|
||||
def x(i: Int) {
|
||||
def x(i: Int): Unit = {
|
||||
// not public, not an inherited dependency
|
||||
trait Y extends D
|
||||
}
|
||||
|
||||
def y(j: Int) {
|
||||
def y(j: Int): Unit = {
|
||||
// not public
|
||||
val w: D { def length: Int } = ???
|
||||
()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ verifyDeps := {
|
|||
same(inheritedDeps("J"), JDeps)
|
||||
}
|
||||
|
||||
def same[T](x: T, y: T) {
|
||||
def same[T](x: T, y: T): Unit = {
|
||||
assert(x == y, s"\nActual: $x, \nExpected: $y")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ lazy val pairs =
|
|||
lazy val expectedDeps = (Relation.empty[File,File] /: pairs) { case (r, (x,ys)) => r + (x,ys) }
|
||||
def toFile(s: String) = file(s + ".java").getAbsoluteFile
|
||||
|
||||
def same[T](x: T, y: T) {
|
||||
def same[T](x: T, y: T): Unit = {
|
||||
assert(x == y, s"\nActual: $x, \nExpected: $y")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
class S {
|
||||
def foo(s:String) { println("I am foo") }
|
||||
def foo(s:String): Unit = println("I am foo")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
class S {
|
||||
def foo2(s:String) { println("I am foo") }
|
||||
def foo2(s:String): Unit = println("I am foo")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
object First
|
||||
{
|
||||
def main(args: Array[String]) {}
|
||||
}
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
object Second
|
||||
{
|
||||
def main(args: Array[String]) {}
|
||||
}
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
object B
|
||||
{
|
||||
def main(args: Array[String]) {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val a = new A
|
||||
a.x(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class X extends E with C with B
|
|||
|
||||
object Main {
|
||||
|
||||
def main(args: Array[String]) {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val x = new X
|
||||
val expected = args(0).toInt
|
||||
assert(x.x == expected, "Expected " + expected + ", got " + x.x)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import org.scalatest.Tag
|
|||
|
||||
class ArgumentTest extends FixtureFunSuite{
|
||||
type FixtureParam = Map[String,Any]
|
||||
override def withFixture(test: OneArgTest) {
|
||||
override def withFixture(test: OneArgTest): Unit = {
|
||||
test(test.configMap)
|
||||
}
|
||||
test("1", Tag("test1")){ conf => sys.error("error #1") }
|
||||
test("2", Tag("test2")){ conf => () }
|
||||
test("3", Tag("test3")){ conf => () }
|
||||
test("4", Tag("test4")){ conf => sys.error("error #4") }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue