diff --git a/ivy/src/main/scala/sbt/ConvertResolver.scala b/ivy/src/main/scala/sbt/ConvertResolver.scala index 613de970e..a36d7430c 100644 --- a/ivy/src/main/scala/sbt/ConvertResolver.scala +++ b/ivy/src/main/scala/sbt/ConvertResolver.scala @@ -5,15 +5,14 @@ package sbt import java.net.URL import java.util.Collections -import org.apache.ivy.{ core, plugins } -import core.module.id.ModuleRevisionId -import core.module.descriptor.DependencyDescriptor -import core.resolve.ResolveData -import core.settings.IvySettings -import plugins.resolver.{ BasicResolver, DependencyResolver, IBiblioResolver, RepositoryResolver } -import plugins.resolver.{ AbstractPatternsBasedResolver, AbstractSshBasedResolver, FileSystemResolver, SFTPResolver, SshResolver, URLResolver } -import plugins.repository.url.{ URLRepository => URLRepo } -import plugins.repository.file.{ FileRepository => FileRepo, FileResource } +import org.apache.ivy.core.module.id.ModuleRevisionId +import org.apache.ivy.core.module.descriptor.DependencyDescriptor +import org.apache.ivy.core.resolve.ResolveData +import org.apache.ivy.core.settings.IvySettings +import org.apache.ivy.plugins.resolver.{ BasicResolver, DependencyResolver, IBiblioResolver, RepositoryResolver } +import org.apache.ivy.plugins.resolver.{ AbstractPatternsBasedResolver, AbstractSshBasedResolver, FileSystemResolver, SFTPResolver, SshResolver, URLResolver } +import org.apache.ivy.plugins.repository.url.{ URLRepository => URLRepo } +import org.apache.ivy.plugins.repository.file.{ FileRepository => FileRepo, FileResource } import java.io.File import org.apache.ivy.util.ChecksumHelper import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact } diff --git a/ivy/src/main/scala/sbt/CustomPomParser.scala b/ivy/src/main/scala/sbt/CustomPomParser.scala index 12ae48675..5e0deb7c4 100644 --- a/ivy/src/main/scala/sbt/CustomPomParser.scala +++ b/ivy/src/main/scala/sbt/CustomPomParser.scala @@ -1,14 +1,13 @@ package sbt -import org.apache.ivy.{ core, plugins, util } -import core.module.id.ModuleRevisionId -import core.module.descriptor.{ DefaultArtifact, DefaultExtendsDescriptor, DefaultModuleDescriptor, ModuleDescriptor } -import core.module.descriptor.{ DefaultDependencyDescriptor, DependencyDescriptor } -import plugins.parser.{ m2, ModuleDescriptorParser, ModuleDescriptorParserRegistry, ParserSettings } -import m2.{ PomModuleDescriptorBuilder, PomModuleDescriptorParser } -import plugins.repository.Resource -import plugins.namespace.NamespaceTransformer -import util.extendable.ExtendableItem +import org.apache.ivy.core.module.id.ModuleRevisionId +import org.apache.ivy.core.module.descriptor.{ DefaultArtifact, DefaultExtendsDescriptor, DefaultModuleDescriptor, ModuleDescriptor } +import org.apache.ivy.core.module.descriptor.{ DefaultDependencyDescriptor, DependencyDescriptor } +import org.apache.ivy.plugins.parser.{ ModuleDescriptorParser, ModuleDescriptorParserRegistry, ParserSettings } +import org.apache.ivy.plugins.parser.m2.{ PomModuleDescriptorBuilder, PomModuleDescriptorParser } +import org.apache.ivy.plugins.repository.Resource +import org.apache.ivy.plugins.namespace.NamespaceTransformer +import org.apache.ivy.util.extendable.ExtendableItem import java.io.{ File, InputStream } import java.net.URL diff --git a/ivy/src/main/scala/sbt/CustomXmlParser.scala b/ivy/src/main/scala/sbt/CustomXmlParser.scala index 0afa87fbd..c5462070c 100644 --- a/ivy/src/main/scala/sbt/CustomXmlParser.scala +++ b/ivy/src/main/scala/sbt/CustomXmlParser.scala @@ -6,12 +6,11 @@ package sbt import java.io.ByteArrayInputStream import java.net.URL -import org.apache.ivy.{ core, plugins } -import core.module.descriptor.{ DefaultDependencyDescriptor, DefaultModuleDescriptor } -import core.settings.IvySettings -import plugins.parser.xml.XmlModuleDescriptorParser -import plugins.repository.Resource -import plugins.repository.url.URLResource +import org.apache.ivy.core.module.descriptor.{ DefaultDependencyDescriptor, DefaultModuleDescriptor } +import org.apache.ivy.core.settings.IvySettings +import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser +import org.apache.ivy.plugins.repository.Resource +import org.apache.ivy.plugins.repository.url.URLResource /** Subclasses the default Ivy file parser in order to provide access to protected methods.*/ private[sbt] object CustomXmlParser extends XmlModuleDescriptorParser { diff --git a/ivy/src/main/scala/sbt/Ivy.scala b/ivy/src/main/scala/sbt/Ivy.scala index be029c422..7f54fb4b4 100644 --- a/ivy/src/main/scala/sbt/Ivy.scala +++ b/ivy/src/main/scala/sbt/Ivy.scala @@ -11,21 +11,21 @@ import java.util.concurrent.Callable import java.util.{ Collection, Collections => CS } import CS.singleton -import org.apache.ivy.{ core, plugins, util, Ivy } -import core.{ IvyPatternHelper, LogOptions } -import core.cache.{ CacheMetadataOptions, DefaultRepositoryCacheManager, ModuleDescriptorWriter } -import core.module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact } -import core.module.descriptor.{ DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor, License } -import core.module.descriptor.{ OverrideDependencyDescriptorMediator } -import core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } -import core.resolve.{ IvyNode, ResolveData, ResolvedModuleRevision } -import core.settings.IvySettings -import plugins.latest.LatestRevisionStrategy -import plugins.matcher.PatternMatcher -import plugins.parser.m2.PomModuleDescriptorParser -import plugins.resolver.{ ChainResolver, DependencyResolver } -import util.{ Message, MessageLogger } -import util.extendable.ExtendableItem +import org.apache.ivy.Ivy +import org.apache.ivy.core.{ IvyPatternHelper, LogOptions } +import org.apache.ivy.core.cache.{ CacheMetadataOptions, DefaultRepositoryCacheManager, ModuleDescriptorWriter } +import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact } +import org.apache.ivy.core.module.descriptor.{ DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor, License } +import org.apache.ivy.core.module.descriptor.{ OverrideDependencyDescriptorMediator } +import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } +import org.apache.ivy.core.resolve.{ IvyNode, ResolveData, ResolvedModuleRevision } +import org.apache.ivy.core.settings.IvySettings +import org.apache.ivy.plugins.latest.LatestRevisionStrategy +import org.apache.ivy.plugins.matcher.PatternMatcher +import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser +import org.apache.ivy.plugins.resolver.{ ChainResolver, DependencyResolver } +import org.apache.ivy.util.{ Message, MessageLogger } +import org.apache.ivy.util.extendable.ExtendableItem import scala.xml.{ NodeSeq, Text } diff --git a/ivy/src/main/scala/sbt/IvyActions.scala b/ivy/src/main/scala/sbt/IvyActions.scala index 5e2d0359c..c87666373 100644 --- a/ivy/src/main/scala/sbt/IvyActions.scala +++ b/ivy/src/main/scala/sbt/IvyActions.scala @@ -6,14 +6,14 @@ package sbt import java.io.File import scala.xml.{ Node => XNode, NodeSeq } -import org.apache.ivy.{ core, plugins, Ivy } -import core.{ IvyPatternHelper, LogOptions } -import core.deliver.DeliverOptions -import core.install.InstallOptions -import core.module.descriptor.{ Artifact => IArtifact, MDArtifact, ModuleDescriptor, DefaultModuleDescriptor } -import core.report.ResolveReport -import core.resolve.ResolveOptions -import plugins.resolver.{ BasicResolver, DependencyResolver } +import org.apache.ivy.Ivy +import org.apache.ivy.core.{ IvyPatternHelper, LogOptions } +import org.apache.ivy.core.deliver.DeliverOptions +import org.apache.ivy.core.install.InstallOptions +import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, MDArtifact, ModuleDescriptor, DefaultModuleDescriptor } +import org.apache.ivy.core.report.ResolveReport +import org.apache.ivy.core.resolve.ResolveOptions +import org.apache.ivy.plugins.resolver.{ BasicResolver, DependencyResolver } final class DeliverConfiguration(val deliverIvyPattern: String, val status: String, val configurations: Option[Seq[Configuration]], val logging: UpdateLogging.Value) final class PublishConfiguration(val ivyFile: Option[File], val resolverName: String, val artifacts: Map[Artifact, File], val checksums: Seq[String], val logging: UpdateLogging.Value, diff --git a/ivy/src/main/scala/sbt/IvyCache.scala b/ivy/src/main/scala/sbt/IvyCache.scala index fe520d96c..51e02b60c 100644 --- a/ivy/src/main/scala/sbt/IvyCache.scala +++ b/ivy/src/main/scala/sbt/IvyCache.scala @@ -6,13 +6,12 @@ package sbt import java.io.File import java.net.URL -import org.apache.ivy.{ core, plugins, util } -import core.cache.{ ArtifactOrigin, CacheDownloadOptions, DefaultRepositoryCacheManager } -import core.module.descriptor.{ Artifact => IvyArtifact, DefaultArtifact } -import plugins.repository.file.{ FileRepository => IvyFileRepository, FileResource } -import plugins.repository.{ ArtifactResourceResolver, Resource, ResourceDownloader } -import plugins.resolver.util.ResolvedResource -import util.FileUtil +import org.apache.ivy.core.cache.{ ArtifactOrigin, CacheDownloadOptions, DefaultRepositoryCacheManager } +import org.apache.ivy.core.module.descriptor.{ Artifact => IvyArtifact, DefaultArtifact } +import org.apache.ivy.plugins.repository.file.{ FileRepository => IvyFileRepository, FileResource } +import org.apache.ivy.plugins.repository.{ ArtifactResourceResolver, Resource, ResourceDownloader } +import org.apache.ivy.plugins.resolver.util.ResolvedResource +import org.apache.ivy.util.FileUtil class NotInCache(val id: ModuleID, cause: Throwable) extends RuntimeException(NotInCache(id, cause), cause) { diff --git a/ivy/src/main/scala/sbt/IvyScala.scala b/ivy/src/main/scala/sbt/IvyScala.scala index 5cc3bdd48..e2468a81a 100644 --- a/ivy/src/main/scala/sbt/IvyScala.scala +++ b/ivy/src/main/scala/sbt/IvyScala.scala @@ -6,11 +6,10 @@ package sbt import java.util.Collections.emptyMap import scala.collection.mutable.HashSet -import org.apache.ivy.{ core, plugins } -import core.module.descriptor.{ DefaultExcludeRule, ExcludeRule } -import core.module.descriptor.{ DependencyDescriptor, DefaultModuleDescriptor, ModuleDescriptor, OverrideDependencyDescriptorMediator } -import core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } -import plugins.matcher.ExactPatternMatcher +import org.apache.ivy.core.module.descriptor.{ DefaultExcludeRule, ExcludeRule } +import org.apache.ivy.core.module.descriptor.{ DependencyDescriptor, DefaultModuleDescriptor, ModuleDescriptor, OverrideDependencyDescriptorMediator } +import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } +import org.apache.ivy.plugins.matcher.ExactPatternMatcher object ScalaArtifacts { import xsbti.ArtifactInfo._ diff --git a/ivy/src/main/scala/sbt/MakePom.scala b/ivy/src/main/scala/sbt/MakePom.scala index 6e51befca..be3baba63 100644 --- a/ivy/src/main/scala/sbt/MakePom.scala +++ b/ivy/src/main/scala/sbt/MakePom.scala @@ -13,10 +13,10 @@ import java.io.File import scala.xml.{ Elem, Node => XNode, NodeSeq, PrettyPrinter, PrefixedAttribute } import Configurations.Optional -import org.apache.ivy.{ core, plugins, Ivy } -import core.settings.IvySettings -import core.module.descriptor.{ DependencyArtifactDescriptor, DependencyDescriptor, License, ModuleDescriptor, ExcludeRule } -import plugins.resolver.{ ChainResolver, DependencyResolver, IBiblioResolver } +import org.apache.ivy.Ivy +import org.apache.ivy.core.settings.IvySettings +import org.apache.ivy.core.module.descriptor.{ DependencyArtifactDescriptor, DependencyDescriptor, License, ModuleDescriptor, ExcludeRule } +import org.apache.ivy.plugins.resolver.{ ChainResolver, DependencyResolver, IBiblioResolver } class MakePom(val log: Logger) { @deprecated("Use `write(Ivy, ModuleDescriptor, ModuleInfo, Option[Iterable[Configuration]], Set[String], NodeSeq, XNode => XNode, MavenRepository => Boolean, Boolean, File)` instead", "0.11.2") diff --git a/ivy/src/main/scala/sbt/ProjectResolver.scala b/ivy/src/main/scala/sbt/ProjectResolver.scala index caff3d496..92fa48bfe 100644 --- a/ivy/src/main/scala/sbt/ProjectResolver.scala +++ b/ivy/src/main/scala/sbt/ProjectResolver.scala @@ -6,14 +6,13 @@ package sbt import java.io.File import java.util.Date -import org.apache.ivy.{ core, plugins } -import core.{ cache, module, report, resolve, search } +import org.apache.ivy.core.{ cache, module, report, resolve, search } import cache.{ ArtifactOrigin, RepositoryCacheManager } import search.{ ModuleEntry, OrganisationEntry, RevisionEntry } import module.id.ModuleRevisionId import module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DependencyDescriptor, ModuleDescriptor } -import plugins.namespace.Namespace -import plugins.resolver.{ DependencyResolver, ResolverSettings } +import org.apache.ivy.plugins.namespace.Namespace +import org.apache.ivy.plugins.resolver.{ DependencyResolver, ResolverSettings } import report.{ ArtifactDownloadReport, DownloadReport, DownloadStatus, MetadataArtifactDownloadReport } import resolve.{ DownloadOptions, ResolveData, ResolvedModuleRevision } diff --git a/main/settings/src/main/scala/sbt/Scope.scala b/main/settings/src/main/scala/sbt/Scope.scala index c9f0211f9..d921225fd 100644 --- a/main/settings/src/main/scala/sbt/Scope.scala +++ b/main/settings/src/main/scala/sbt/Scope.scala @@ -20,10 +20,10 @@ object Scope { val GlobalScope = Scope(Global, Global, Global, Global) def resolveScope(thisScope: Scope, current: URI, rootProject: URI => String): Scope => Scope = - resolveProject(current, rootProject) compose replaceThis(thisScope) + resolveProject(current, rootProject) compose replaceThis(thisScope) compose subThisProject def resolveBuildScope(thisScope: Scope, current: URI): Scope => Scope = - buildResolve(current) compose replaceThis(thisScope) + buildResolve(current) compose replaceThis(thisScope) compose subThisProject def replaceThis(thisScope: Scope): Scope => Scope = (scope: Scope) => Scope(subThis(thisScope.project, scope.project), subThis(thisScope.config, scope.config), subThis(thisScope.task, scope.task), subThis(thisScope.extra, scope.extra)) @@ -31,6 +31,15 @@ object Scope { def subThis[T](sub: ScopeAxis[T], into: ScopeAxis[T]): ScopeAxis[T] = if (into == This) sub else into + /** + * `Select(ThisProject)` cannot be resolved by [[resolveProject]] (it doesn't know what to replace it with), so we + * perform this transformation so that [[replaceThis]] picks it up. + */ + def subThisProject: Scope => Scope = { + case s @ Scope(Select(ThisProject), _, _, _) => s.copy(project = This) + case s => s + } + def fillTaskAxis(scope: Scope, key: AttributeKey[_]): Scope = scope.task match { case _: Select[_] => scope @@ -59,7 +68,6 @@ object Scope { } def resolveProjectBuild(current: URI, ref: ProjectReference): ProjectReference = ref match { - case ThisProject => RootProject(current) case LocalRootProject => RootProject(current) case LocalProject(id) => ProjectRef(current, id) case RootProject(uri) => RootProject(resolveBuild(current, uri)) @@ -79,8 +87,8 @@ object Scope { def resolveProjectRef(current: URI, rootProject: URI => String, ref: ProjectReference): ProjectRef = ref match { - case ThisProject | LocalRootProject => ProjectRef(current, rootProject(current)) - case LocalProject(id) => ProjectRef(current, id) + case LocalRootProject => ProjectRef(current, rootProject(current)) + case LocalProject(id) => ProjectRef(current, id) case RootProject(uri) => val res = resolveBuild(current, uri); ProjectRef(res, rootProject(res)) case ProjectRef(uri, id) => ProjectRef(resolveBuild(current, uri), id) diff --git a/main/src/main/scala/sbt/Build.scala b/main/src/main/scala/sbt/Build.scala index d36ccbb97..6fd43bda0 100644 --- a/main/src/main/scala/sbt/Build.scala +++ b/main/src/main/scala/sbt/Build.scala @@ -4,7 +4,7 @@ package sbt import java.io.File -import Keys.{ name, organization, thisProject } +import Keys.{ name, organization, thisProject, autoGeneratedProject } import Def.{ ScopedKey, Setting } // name is more like BuildDefinition, but that is too long @@ -49,13 +49,13 @@ object Build { // TODO - Can we move this somewhere else? ordering of settings is causing this to get borked. // if the user has overridden the name, use the normal organization that is derived from the name. organization := { - val overridden = thisProject.value.id == name.value + def isDefault(o: String) = thisProject.value.id == o organization.?.value match { - case Some(o) if !overridden => o - case _ => "default" + case Some(o) if !isDefault(o) => o + case _ => "default" } - //(thisProject, organization, name) { (p, o, n) => if(p.id == n) "default" else o } - } + }, + autoGeneratedProject := true ) def defaultAggregatedProject(id: String, base: File, agg: Seq[ProjectRef]): Project = defaultProject(id, base).aggregate(agg: _*) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index a6d696342..81db813de 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -301,7 +301,8 @@ object Defaults extends BuildCommon { import ScopeFilter.Make.{ inDependencies => inDeps, _ } val selectDeps = ScopeFilter(inDeps(ThisProject, includeRoot = false)) val allUpdates = update.?.all(selectDeps) - Def.task { allUpdates.value.flatten } + // If I am a "build" (a project inside project/) then I have a globalPluginUpdate. + Def.task { allUpdates.value.flatten ++ globalPluginUpdate.?.value } } def watchSetting: Initialize[Watched] = (pollInterval, thisProjectRef, watchingMessage, triggeredMessage) { (interval, base, msg, trigMsg) => diff --git a/main/src/main/scala/sbt/GlobalPlugin.scala b/main/src/main/scala/sbt/GlobalPlugin.scala index 8118c84e1..88b767b94 100644 --- a/main/src/main/scala/sbt/GlobalPlugin.scala +++ b/main/src/main/scala/sbt/GlobalPlugin.scala @@ -18,6 +18,7 @@ object GlobalPlugin { projectDescriptors ~= { _ ++ gp.descriptors }, projectDependencies ++= gp.projectID +: gp.dependencies, resolvers <<= resolvers { rs => (rs ++ gp.resolvers).distinct }, + globalPluginUpdate := gp.updateReport, // TODO: these shouldn't be required (but are): the project* settings above should take care of this injectInternalClasspath(Runtime, gp.internalClasspath), injectInternalClasspath(Compile, gp.internalClasspath) @@ -44,10 +45,16 @@ object GlobalPlugin { { import structure.{ data, root, rootProject } val p: Scope = Scope.GlobalScope in ProjectRef(root, rootProject(root)) - val taskInit = (projectID, projectDependencies, projectDescriptors, resolvers, fullClasspath in Runtime, internalDependencyClasspath in Runtime, exportedProducts in Runtime, ivyModule) map { - (pid, pdeps, pdescs, rs, cp, intcp, prods, mod) => - val depMap = pdescs + mod.dependencyMapping(state.log) - GlobalPluginData(pid, pdeps, depMap, rs, cp, (prods ++ intcp).distinct) + + val taskInit = Def.task { + val intcp = (internalDependencyClasspath in Runtime).value + val prods = (exportedProducts in Runtime).value + val depMap = projectDescriptors.value + ivyModule.value.dependencyMapping(state.log) + // If we reference it directly (if it's an executionRoot) then it forces an update, which is not what we want. + val updateReport = Def.taskDyn { Def.task { update.value } }.value + + GlobalPluginData(projectID.value, projectDependencies.value, depMap, resolvers.value, (fullClasspath in Runtime).value, + (prods ++ intcp).distinct)(updateReport) } val resolvedTaskInit = taskInit mapReferenced Project.mapScope(Scope replaceThis p) val task = resolvedTaskInit evaluate data @@ -72,5 +79,5 @@ object GlobalPlugin { version := "0.0" )) } -final case class GlobalPluginData(projectID: ModuleID, dependencies: Seq[ModuleID], descriptors: Map[ModuleRevisionId, ModuleDescriptor], resolvers: Seq[Resolver], fullClasspath: Classpath, internalClasspath: Classpath) +final case class GlobalPluginData(projectID: ModuleID, dependencies: Seq[ModuleID], descriptors: Map[ModuleRevisionId, ModuleDescriptor], resolvers: Seq[Resolver], fullClasspath: Classpath, internalClasspath: Classpath)(val updateReport: UpdateReport) final case class GlobalPlugin(data: GlobalPluginData, structure: BuildStructure, inject: Seq[Setting[_]], base: File) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 1f46e57c7..41f010aef 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -36,6 +36,7 @@ object Keys { val sLog = SettingKey[Logger]("setting-logger", "Logger usable by settings during project loading.", CSetting) // Project keys + val autoGeneratedProject = SettingKey[Boolean]("autogeneratedProject", "If it exists, represents that the project (and name) were automaticlaly craeted, rather than user specified.", DSetting) val projectCommand = AttributeKey[Boolean]("project-command", "Marks Commands that were registered for the current Project.", Invisible) val sessionSettings = AttributeKey[SessionSettings]("session-settings", "Tracks current build, project, and setting modifications.", DSetting) val stateBuildStructure = AttributeKey[BuildStructure]("build-structure", "Data structure containing all information about the build definition.", BSetting) @@ -345,6 +346,7 @@ object Keys { val stateStreams = AttributeKey[Streams]("streams-manager", "Streams manager, which provides streams for different contexts. Setting this on State will override the default Streams implementation.") val resolvedScoped = Def.resolvedScoped val pluginData = TaskKey[PluginData]("plugin-data", "Information from the plugin build needed in the main build definition.", DTask) + val globalPluginUpdate = TaskKey[UpdateReport]("global-plugin-update", "A hook to get the UpdateReport of the global plugin.", DTask) // wrapper to work around SI-2915 private[sbt] final class TaskProgress(val progress: ExecuteProgress[Task]) diff --git a/main/src/main/scala/sbt/Load.scala b/main/src/main/scala/sbt/Load.scala index 34d4bbcc3..a3dc684d0 100755 --- a/main/src/main/scala/sbt/Load.scala +++ b/main/src/main/scala/sbt/Load.scala @@ -73,25 +73,17 @@ object Load { } def buildGlobalSettings(base: File, files: Seq[File], config: sbt.LoadBuildConfiguration): ClassLoader => Seq[Setting[_]] = { - val eval = mkEval(data(config.classpath), base, defaultEvalOptions) + val eval = mkEval(data(config.globalPluginClasspath), base, defaultEvalOptions) val imports = BuildUtil.baseImports ++ BuildUtil.importAllRoot(config.globalPluginNames) loader => EvaluateConfigurations(eval, files, imports)(loader).settings } def loadGlobal(state: State, base: File, global: File, config: sbt.LoadBuildConfiguration): sbt.LoadBuildConfiguration = if (base != global && global.exists) { val gp = GlobalPlugin.load(global, state, config) - val pm = setGlobalPluginLoader(gp, config.pluginManagement) - val cp = (gp.data.fullClasspath ++ config.classpath).distinct - config.copy(globalPlugin = Some(gp), pluginManagement = pm, classpath = cp) + config.copy(globalPlugin = Some(gp)) } else config - private[this] def setGlobalPluginLoader(gp: GlobalPlugin, pm: PluginManagement): PluginManagement = - { - val newLoader = ClasspathUtilities.toLoader(data(gp.data.fullClasspath), pm.initialLoader) - pm.copy(initialLoader = newLoader) - } - def defaultDelegates: sbt.LoadedBuild => Scope => Seq[Scope] = (lb: sbt.LoadedBuild) => { val rootProject = getRootProject(lb.units) def resolveRef(project: Reference): ResolvedReference = Scope.resolveReference(lb.root, rootProject, project) @@ -688,7 +680,6 @@ object Load { DiscoveredProjects(root.headOption, nonRoot, rawFiles) } - @deprecated("No longer used.", "0.13.0") def globalPluginClasspath(globalPlugin: Option[GlobalPlugin]): Seq[Attributed[File]] = globalPlugin match { case Some(cp) => cp.data.fullClasspath @@ -733,7 +724,7 @@ object Load { !(dir * -GlobFilter(DefaultTargetName)).get.isEmpty } def noPlugins(dir: File, config: sbt.LoadBuildConfiguration): sbt.LoadedPlugins = - loadPluginDefinition(dir, config, PluginData(config.classpath, None, None)) + loadPluginDefinition(dir, config, PluginData(config.globalPluginClasspath, None, None)) def buildPlugins(dir: File, s: State, config: sbt.LoadBuildConfiguration): sbt.LoadedPlugins = loadPluginDefinition(dir, config, buildPluginDefinition(dir, s, config)) @@ -903,11 +894,8 @@ final case class LoadBuildConfiguration( globalPlugin: Option[GlobalPlugin], extraBuilds: Seq[URI], log: Logger) { - @deprecated("Use `classpath`.", "0.13.0") - lazy val globalPluginClasspath = classpath - @deprecated("Use `pluginManagement.initialLoader`.", "0.13.0") - lazy val globalPluginLoader = pluginManagement.initialLoader - lazy val globalPluginNames = if (classpath.isEmpty) Nil else Load.getPluginNames(classpath, pluginManagement.initialLoader) + lazy val (globalPluginClasspath, globalPluginLoader) = Load.pluginDefinitionLoader(this, Load.globalPluginClasspath(globalPlugin)) + lazy val globalPluginNames = if (globalPluginClasspath.isEmpty) Nil else Load.getPluginNames(globalPluginClasspath, globalPluginLoader) } final class IncompatiblePluginsException(msg: String, cause: Throwable) extends Exception(msg, cause) diff --git a/project/Sbt.scala b/project/Sbt.scala index ddac000c3..f22136d94 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -46,12 +46,12 @@ object Sbt extends Build { def lameAgregateTask(task: String): String = s"all control/$task collections/$task io/$task completion/$task" "setupBuildScala211" :: - /// First test - lameAgregateTask("test") :: - // Note: You need the sbt-pgp plugin installed to release. - lameAgregateTask("publishSigned") :: - // Now restore the defaults. - "reload" :: state + /// First test + lameAgregateTask("test") :: + // Note: You need the sbt-pgp plugin installed to release. + lameAgregateTask("publishSigned") :: + // Now restore the defaults. + "reload" :: state }, commands += Command.command("release-sbt") { state => // TODO - Any sort of validation diff --git a/project/Util.scala b/project/Util.scala index 987d80096..fa2df13bf 100644 --- a/project/Util.scala +++ b/project/Util.scala @@ -174,7 +174,7 @@ object Common { def lib(m: ModuleID) = libraryDependencies += m lazy val jlineDep = "jline" % "jline" % "2.11" lazy val jline = lib(jlineDep) - lazy val ivy = lib("org.scala-sbt.ivy" % "ivy" % "2.4.0-sbt-d6fca11d63402c92e4167cdf2da91a660d043392") + lazy val ivy = lib("org.apache.ivy" % "ivy" % "2.3.0") lazy val httpclient = lib("commons-httpclient" % "commons-httpclient" % "3.1") lazy val jsch = lib("com.jcraft" % "jsch" % "0.1.46" intransitive ()) lazy val sbinary = libraryDependencies += "org.scala-tools.sbinary" %% "sbinary" % "0.4.2" diff --git a/project/build.properties b/project/build.properties index 8ac605a3d..be6c454fb 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.2 +sbt.version=0.13.5 diff --git a/sbt/src/sbt-test/project/auto-plugins/build.sbt b/sbt/src/sbt-test/project/auto-plugins/build.sbt index 8819060f1..27cdb97cd 100644 --- a/sbt/src/sbt-test/project/auto-plugins/build.sbt +++ b/sbt/src/sbt-test/project/auto-plugins/build.sbt @@ -18,7 +18,10 @@ lazy val projF = project disablePlugins(plugins.IvyPlugin) check := { - // TODO - this will pass when the raw disablePlugin works. + // Ensure organization on root is overridable. + val rorg = (organization).value // Should be None + same(rorg, "override", "organization") + // this will pass when the raw disablePlugin works. val dversion = (projectID in projD).?.value // Should be None same(dversion, None, "projectID in projD") val rversion = projectID.?.value // Should be None @@ -44,6 +47,8 @@ check := { same(qValue, Some(" Q R"), "del in projC in q") val optInValue = (del in projE in q).value same(optInValue, " Q S R", "del in projE in q") + val overrideOrgValue = (organization in projE).value + same(overrideOrgValue, "S", "organization in projE") } keyTest := "foo" diff --git a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala index afdf64b78..b607b170b 100644 --- a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala +++ b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala @@ -1,7 +1,7 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/ import sbt._ - import sbt.Keys.{name, resolvedScoped} + import sbt.Keys.{name, resolvedScoped, organization } import java.util.concurrent.atomic.{AtomicInteger => AInt} object Imports @@ -19,6 +19,13 @@ object Imports lazy val check = taskKey[Unit]("Verifies settings are as they should be.") } +object OrgPlugin extends AutoPlugin { + override def trigger = allRequirements + override def projectSettings = Seq( + organization := "override" + ) +} + object X extends AutoPlugin { val autoImport = Imports } @@ -84,6 +91,7 @@ object S extends AutoPlugin override def trigger = noTrigger override def projectSettings = Seq( - del in q += " S" + del in q += " S", + organization := "S" ) } diff --git a/sbt/src/sbt-test/project/auto-plugins/test b/sbt/src/sbt-test/project/auto-plugins/test index b1ab83bf7..518ca1bec 100644 --- a/sbt/src/sbt-test/project/auto-plugins/test +++ b/sbt/src/sbt-test/project/auto-plugins/test @@ -1,2 +1,3 @@ > plugins +> inspect organization > check diff --git a/sbt/src/sbt-test/project/global-plugin-src/test b/sbt/src/sbt-test/project/global-plugin-src/test deleted file mode 100644 index a100beb21..000000000 --- a/sbt/src/sbt-test/project/global-plugin-src/test +++ /dev/null @@ -1,4 +0,0 @@ -# tests that a source file in $sbt.global.base/plugins/ is available to the build definition in project/ - -# dummy to ensure project gets loaded -> name diff --git a/sbt/src/sbt-test/project/global-plugin/changes/Build.scala b/sbt/src/sbt-test/project/global-plugin/changes/Build.scala index 64db72659..2e1d49e2f 100644 --- a/sbt/src/sbt-test/project/global-plugin/changes/Build.scala +++ b/sbt/src/sbt-test/project/global-plugin/changes/Build.scala @@ -10,11 +10,11 @@ object MyBuild extends Build { lazy val proj = Project("my-test-proj", file("."), settings = mySettings) - lazy val check = taskKey[Unit]("Verifies that the junit dependency has the older version (4.5)") + lazy val check = taskKey[Unit]("Verifies that the junit dependency has the newer version (4.8)") def checkVersion(report: UpdateReport) { for(mod <- report.allModules) { - if(mod.name == "junit") assert(mod.revision == "4.5", s"JUnit version (${mod.revision}) was not overridden") + if(mod.name == "junit") assert(mod.revision == "4.8", s"JUnit version (${mod.revision}) does not have the correct version") } } } diff --git a/sbt/src/sbt-test/project/global-plugin/changes/global-plugins.sbt b/sbt/src/sbt-test/project/global-plugin/changes/global-plugins.sbt index 9e2ae07df..2214d0397 100644 --- a/sbt/src/sbt-test/project/global-plugin/changes/global-plugins.sbt +++ b/sbt/src/sbt-test/project/global-plugin/changes/global-plugins.sbt @@ -1,3 +1,3 @@ // use a small java library instead of a plugin to avoid incompatibilities when upgrading -// use an old version to check that it will override a newer version in a build definition +// This version should be overridden by the one in the project. libraryDependencies += "junit" % "junit" % "4.5" diff --git a/sbt/src/sbt-test/project/global-plugin/changes/plugins.sbt b/sbt/src/sbt-test/project/global-plugin/changes/plugins.sbt index 0cfd68572..8c116930a 100644 --- a/sbt/src/sbt-test/project/global-plugin/changes/plugins.sbt +++ b/sbt/src/sbt-test/project/global-plugin/changes/plugins.sbt @@ -1,2 +1,2 @@ -// the version should be overridden by the global plugin +// the version should override the one from the global plugin libraryDependencies += "junit" % "junit" % "4.8" diff --git a/sbt/src/sbt-test/project/global-plugin-src/global/plugins/A.scala b/sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala similarity index 100% rename from sbt/src/sbt-test/project/global-plugin-src/global/plugins/A.scala rename to sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala diff --git a/sbt/src/sbt-test/project/global-plugin-src/project/Build.scala b/sbt/src/sbt-test/project/global-plugin/project/Build.scala similarity index 100% rename from sbt/src/sbt-test/project/global-plugin-src/project/Build.scala rename to sbt/src/sbt-test/project/global-plugin/project/Build.scala diff --git a/sbt/src/sbt-test/project/global-plugin/test b/sbt/src/sbt-test/project/global-plugin/test index 0d7ace21b..f5ab8b106 100644 --- a/sbt/src/sbt-test/project/global-plugin/test +++ b/sbt/src/sbt-test/project/global-plugin/test @@ -11,7 +11,8 @@ $ copy-file changes/global-plugins.sbt global/plugins/plugins.sbt # check that it is on the classpath > eval (x => ()) : (org.junit.Test => Unit) -# ensure that the global plugin version overrides the local version +# ensure that the global plugin version is overridden by the local version +# (because it's older) $ copy-file changes/plugins.sbt project/plugins.sbt > reload > check diff --git a/sbt/src/sbt-test/project/thisProject/build.sbt b/sbt/src/sbt-test/project/thisProject/build.sbt new file mode 100644 index 000000000..6fc79c53d --- /dev/null +++ b/sbt/src/sbt-test/project/thisProject/build.sbt @@ -0,0 +1,10 @@ +val proj2 = project + +name := "proj1" + +val check = taskKey[Unit]("Ensure each project is named appropriately") + +check := { + require(name.value == "proj1") + require((name in proj2).value == "boo") +} diff --git a/sbt/src/sbt-test/project/thisProject/proj2/build.sbt b/sbt/src/sbt-test/project/thisProject/proj2/build.sbt new file mode 100644 index 000000000..7f48be956 --- /dev/null +++ b/sbt/src/sbt-test/project/thisProject/proj2/build.sbt @@ -0,0 +1 @@ +name in ThisProject := "boo" diff --git a/sbt/src/sbt-test/project/thisProject/test b/sbt/src/sbt-test/project/thisProject/test new file mode 100644 index 000000000..15675b169 --- /dev/null +++ b/sbt/src/sbt-test/project/thisProject/test @@ -0,0 +1 @@ +> check diff --git a/src/main/conscript/sbt/launchconfig b/src/main/conscript/sbt/launchconfig index ff85bfccf..e960ad8f9 100644 --- a/src/main/conscript/sbt/launchconfig +++ b/src/main/conscript/sbt/launchconfig @@ -4,7 +4,7 @@ [app] org: ${sbt.organization-org.scala-sbt} name: sbt - version: ${sbt.version-read(sbt.version)[0.13.5-SNAPSHOT]} + version: ${sbt.version-read(sbt.version)[0.13.5]} class: sbt.xMain components: xsbti,extra cross-versioned: ${sbt.cross.versioned-false} @@ -13,7 +13,6 @@ [repositories] local typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - typesafe-ivy-snapshots: http://repo.typesafe.com/typesafe/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly maven-central [boot] diff --git a/src/main/conscript/scalas/launchconfig b/src/main/conscript/scalas/launchconfig index 91882ac37..e1f7487f8 100644 --- a/src/main/conscript/scalas/launchconfig +++ b/src/main/conscript/scalas/launchconfig @@ -4,7 +4,7 @@ [app] org: ${sbt.organization-org.scala-sbt} name: sbt - version: ${sbt.version-read(sbt.version)[0.13.5-SNAPSHOT]} + version: ${sbt.version-read(sbt.version)[0.13.5]} class: sbt.ScriptMain components: xsbti,extra cross-versioned: ${sbt.cross.versioned-false} @@ -13,7 +13,6 @@ [repositories] local typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - typesafe-ivy-snapshots: http://repo.typesafe.com/typesafe/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly maven-central [boot] diff --git a/src/main/conscript/screpl/launchconfig b/src/main/conscript/screpl/launchconfig index b4bbf8354..92d19c97c 100644 --- a/src/main/conscript/screpl/launchconfig +++ b/src/main/conscript/screpl/launchconfig @@ -4,7 +4,7 @@ [app] org: ${sbt.organization-org.scala-sbt} name: sbt - version: ${sbt.version-read(sbt.version)[0.13.5-SNAPSHOT]} + version: ${sbt.version-read(sbt.version)[0.13.5]} class: sbt.ConsoleMain components: xsbti,extra cross-versioned: ${sbt.cross.versioned-false} @@ -13,7 +13,6 @@ [repositories] local typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - typesafe-ivy-snapshots: http://repo.typesafe.com/typesafe/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly maven-central [boot] diff --git a/src/sphinx/Detailed-Topics/Setup-Notes.rst b/src/sphinx/Detailed-Topics/Setup-Notes.rst index ca7fd3ec0..186a36025 100644 --- a/src/sphinx/Detailed-Topics/Setup-Notes.rst +++ b/src/sphinx/Detailed-Topics/Setup-Notes.rst @@ -4,6 +4,18 @@ Setup Notes Some notes on how to set up your `sbt` script. + +JDK8 compat issue +--------------------- + +Since JDK 8 , The MaxPemSize not supported anymore. + +You should remove -XX:MaxPermSize=???m from JAVA_OPTS + +The sbt default configure file locate at /usr/share/sbt-launcher-packaging/bin/sbt-launch-lib.bash + +You may modify it by hand if you want + Do not put `sbt-launch.jar` on your classpath. ------------------------------------------------ diff --git a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala index 8766df7fc..16f7bfc45 100644 --- a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala +++ b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala @@ -4,7 +4,7 @@ import java.io.{ StringWriter, PrintWriter, File } import java.net.InetAddress import scala.collection.mutable.ListBuffer import scala.util.DynamicVariable -import scala.xml.{ Elem, Node, XML } +import scala.xml.{ Elem, Node => XNode, XML } import testing.{ Event => TEvent, Status => TStatus, OptionalThrowable, TestSelector } /** @@ -23,7 +23,7 @@ class JUnitXmlTestsListener(val outputDir: String) extends TestsListener { { val iter = System.getProperties.entrySet.iterator - val props: ListBuffer[Node] = new ListBuffer() + val props: ListBuffer[XNode] = new ListBuffer() while (iter.hasNext) { val next = iter.next props +=