From 4821f16eb38731e4cb6dde9fc4e868e1347f0f05 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 28 Mar 2011 22:28:54 -0400 Subject: [PATCH] scalaVersion in GlobalScope, delegates test --- main/Defaults.scala | 9 ++++----- .../project/delegates/project/Build.scala | 18 ++++++++++++++++++ sbt/src/sbt-test/project/delegates/test | 5 +++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 sbt/src/sbt-test/project/delegates/project/Build.scala create mode 100644 sbt/src/sbt-test/project/delegates/test diff --git a/main/Defaults.scala b/main/Defaults.scala index fa53941c6..da36181c4 100755 --- a/main/Defaults.scala +++ b/main/Defaults.scala @@ -123,7 +123,7 @@ object Defaults javacOptions in GlobalScope :== Nil, scalacOptions in GlobalScope :== Nil, scalaInstance <<= scalaInstanceSetting, - scalaVersion <<= appConfiguration( _.provider.scalaProvider.version), + scalaVersion in GlobalScope <<= appConfiguration( _.provider.scalaProvider.version), target <<= (target, scalaInstance, crossPaths)( (t,si,cross) => if(cross) t / ("scala-" + si.actualVersion) else t ) ) @@ -497,13 +497,12 @@ object Classpaths projectID <<= (organization,moduleID,version,artifacts){ (org,module,version,as) => ModuleID(org, module, version).cross(true).artifacts(as : _*) }, resolvers in GlobalScope :== Nil, projectDescriptors <<= depMap, - retrievePattern :== "[type]/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]", + retrievePattern in GlobalScope :== "[type]/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]", updateConfiguration <<= (retrieveConfiguration, ivyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, false, level) ), retrieveConfiguration <<= (managedDirectory, retrievePattern, retrieveManaged) { (libm, pattern, enabled) => if(enabled) Some(new RetrieveConfiguration(libm, pattern)) else None }, - ivyConfiguration <<= (fullResolvers, ivyPaths, otherResolvers, moduleConfigurations, offline, appConfiguration) map { (rs, paths, other, moduleConfs, off, app) => - // todo: pass logger from streams directly to IvyActions + ivyConfiguration <<= (fullResolvers, ivyPaths, otherResolvers, moduleConfigurations, offline, appConfiguration, streams) map { (rs, paths, other, moduleConfs, off, app, s) => val lock = app.provider.scalaProvider.launcher.globalLock - new InlineIvyConfiguration(paths, rs, other, moduleConfs, off, Some(lock), ConsoleLogger()) + new InlineIvyConfiguration(paths, rs, other, moduleConfs, off, Some(lock), s.log) }, moduleSettings <<= (projectID, allDependencies, ivyXML, thisProject, defaultConfiguration, ivyScala, ivyValidate) map { (pid, deps, ivyXML, project, defaultConf, ivyS, validate) => new InlineConfiguration(pid, deps, ivyXML, project.configurations, defaultConf, ivyS, validate) diff --git a/sbt/src/sbt-test/project/delegates/project/Build.scala b/sbt/src/sbt-test/project/delegates/project/Build.scala new file mode 100644 index 000000000..9d96b83ad --- /dev/null +++ b/sbt/src/sbt-test/project/delegates/project/Build.scala @@ -0,0 +1,18 @@ +import sbt._ +import complete.DefaultParsers._ +import Keys._ + +object B extends Build +{ + val check = InputKey[Unit]("check-max-errors") + + lazy val projects = Seq(root, sub) + lazy val root = Project("root", file(".")) + lazy val sub = Project("sub", file(".")) delegates(root) settings(check <<= checkTask) + + lazy val checkTask = InputTask(_ => Space ~> NatBasic) { result => + (result, maxErrors) map { (i, max) => + if(i != max) error("Expected max-errors to be " + i + ", but it was " + max) + } + } +} diff --git a/sbt/src/sbt-test/project/delegates/test b/sbt/src/sbt-test/project/delegates/test new file mode 100644 index 000000000..7420a5632 --- /dev/null +++ b/sbt/src/sbt-test/project/delegates/test @@ -0,0 +1,5 @@ +> sub/check-max-errors 100 +> set maxErrors := 17 +> sub/check-max-errors 17 +> set maxErrors in LocalProject("sub") := 13 +> sub/check-max-errors 13