From 5be1870f4ff82fe7d7143c66e0c272a2456d11ff Mon Sep 17 00:00:00 2001 From: dmharrah Date: Fri, 18 Sep 2009 18:23:35 +0000 Subject: [PATCH] Fix version incrementing and add times to cross-compile git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@1026 d89573ee-9141-11dd-94d4-bdf5e562f29c --- project/build.properties | 6 +++--- project/build/CrossCompileProject.scala | 23 +++++++++++++---------- project/build/ReleaseProject.scala | 6 +++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/project/build.properties b/project/build.properties index f777cc7c7..2010424ea 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,7 +1,7 @@ #Project properties -#Sat Sep 12 16:23:28 EDT 2009 +#Fri Sep 18 14:22:56 EDT 2009 project.organization=sbt project.name=Simple Build Tool -sbt.version=0.5.4 -project.version=0.5.5--SNAPSHOT +sbt.version=0.5.5-SNAPSHOT +project.version=0.5.5-SNAPSHOT scala.version=2.7.2 diff --git a/project/build/CrossCompileProject.scala b/project/build/CrossCompileProject.scala index eb2e84a6a..6b8f4a40b 100644 --- a/project/build/CrossCompileProject.scala +++ b/project/build/CrossCompileProject.scala @@ -33,15 +33,15 @@ abstract class CrossCompileProject extends BasicScalaProject with MavenStyleScal private val buildConfigurations = allConfigurations//conf_2_7_2 :: conf_2_8_0 :: Nil//conf_2_7_2 :: conf_2_7_3 :: conf_2_7_4 :: conf_2_7_5 :: Nil // the configuration to use for normal development (when cross-building is not done) private def developmentVersion = buildConfigurations.first - + /* Methods to derive the configuration name from the base name 'v'.*/ private def optional(v: Configuration) = config("optional-" + v.toString) private def scalac(v: Configuration) = config("scalac-" + v.toString) private def sbt(v: Configuration) = config("sbt_" + v.toString) private def depConf(v: Configuration) = v.toString + "->default" - + // =========== Cross-compilation across scala versions =========== - + // The dependencies that should go in each configuration are: // base Required dependencies that are the same across all scala versions. // Required dependencies to use with Scala @@ -123,14 +123,14 @@ abstract class CrossCompileProject extends BasicScalaProject with MavenStyleScal } private def scalaDependency(name: String, scalaVersion: Configuration) = - + /** Creates a comment containing the version of Scala*/ private def scalaComment(scalaVersion: Configuration) = scala.xml.Comment("Scala " + scalaVersion) /** Creates a dependency element for a test. See 'testOrg' for a description of uniformTestOrg.*/ private def testDependency(name: String, version: String, uniformTestOrg: Boolean, baseConf: Configuration) = - + /** Returns the organization for the given test library. If uniform is true, * the 'org.scala-tools.testing' organization is used. Otherwise, 'org.' is prefixed to the module name.*/ private def testOrg(name: String, uniform: Boolean) = @@ -140,7 +140,7 @@ abstract class CrossCompileProject extends BasicScalaProject with MavenStyleScal /** Disable filtering Scala jars from dependency management, because we need them and are putting them * in custom configurations and are using them in a separate process than sbt runs in.*/ override def filterScalaJars = false - + /** The lib directory is now only for building using the 'build' script.*/ override def unmanagedClasspath = path("ignore_lib_directory") /** When cross-compiling, replace mainCompilePath with the classes directory for the version being compiled.*/ @@ -149,10 +149,10 @@ abstract class CrossCompileProject extends BasicScalaProject with MavenStyleScal super.fullUnmanagedClasspath(config) else classesPath(config) +++ mainResourcesPath - + // include the optional- dependencies as well as the ones common across all scala versions def optionalClasspath(version: Configuration) = fullClasspath(optional(version)) +++ super.optionalClasspath - + private val CompilerMainClass = "scala.tools.nsc.Main" // use a publish configuration that publishes the 'base' + all configurations (base is required because // the configurations extend it) @@ -194,17 +194,20 @@ abstract class CrossCompileProject extends BasicScalaProject with MavenStyleScal for(err <- setupResult) log.error(err) // the classpath containing the scalac compiler val compilerClasspath = concatPaths(fullClasspath(scalac(version))) - + // The libraries to compile sbt against val classpath = fullClasspath(version) +++ optionalClasspath(version) val sources: List[String] = pathListStrings(filteredSources) val compilerOptions = List("-cp", concatPaths(classpath), "-d", classes.toString) val compilerArguments: List[String] = compilerOptions ::: sources - + // the compiler classpath has to be appended to the boot classpath to work properly val allArguments = "-Xmx512M" :: ("-Xbootclasspath/a:" + compilerClasspath) :: CompilerMainClass :: compilerArguments log.debug("Running external compiler with command: java " + allArguments.mkString(" ")) + val start = System.currentTimeMillis val exitValue = Process("java", allArguments) ! log + val stop = System.currentTimeMillis + log.info("Compiled sbt with Scala " + version.name + " in " + ((stop-start)/1000.0) + " s") if(exitValue == 0) None else diff --git a/project/build/ReleaseProject.scala b/project/build/ReleaseProject.scala index 2456d51af..c728ad69e 100644 --- a/project/build/ReleaseProject.scala +++ b/project/build/ReleaseProject.scala @@ -75,13 +75,13 @@ trait ReleaseProject extends ExecProject lazy val nextVersion = (incrementVersions && commitProperties) dependsOn(releaseChecks) lazy val incrementVersions = task { incrementVersionNumbers(); None } - def incrementVersionNumbers(): Unit = + def incrementVersionNumbers(): Unit = for( v <- projectVersion) { sbtVersion() = v.toString val incremented = v.asInstanceOf[BasicVersion].incrementMicro // BasicVersion checked by releaseChecks import incremented._ - val newVersion = BasicVersion(major, minor, micro, Some("-SNAPSHOT")) + val newVersion = BasicVersion(major, minor, micro, Some("SNAPSHOT")) log.info("Changing version to " + newVersion) projectVersion() = newVersion saveEnvironment @@ -89,7 +89,7 @@ trait ReleaseProject extends ExecProject } package sbt { - object ProcessXML { + object ProcessXML { implicit def elemToPB(command: scala.xml.Elem): ProcessBuilder = impl.CommandParser.parse(command.text.trim).fold(error, Function.tupled(Process.apply)) }