Skip to content

Commit

Permalink
Commit before moving analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
cage433 committed Nov 8, 2015
1 parent 8fe46f0 commit 6a5fe2e
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 25 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Maker is a scala build tool, written out of frustration with the complexity of S
Installation
------------
Download and run the script [maker.py](maker.py) in the directory in which your project will live. You will be prompted for the name of your project, and a minimal config file
will be created at ./maker/Project.scala. This specifies for each module its dependencies,
will be created at ./maker/Project.scala.

Configuration
-------------
This specifies for each module its dependencies,
both external and on other modules.

Projects and modules
Expand Down
5 changes: 0 additions & 5 deletions maker/src/maker/project/Continuously.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ object Continuously {

def lastSrcModificationTime : Option[Long] = {
FileUtils.lastModifiedFileTime(allSourceFiles)
//allSourceFiles.map(FileUtils.lastModifiedFileTime(watchedFiles)).max
//allUpstreamTestModules.map(proj => {
//val watchedFiles = proj.compilePhase.sourceFiles ++ proj.testCompilePhase.sourceFiles
//FileUtils.lastModifiedFileTime(watchedFiles)
//}).max
}
printWaitingMessage
while (true) {
Expand Down
5 changes: 2 additions & 3 deletions maker/src/maker/project/Module.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ import org.apache.commons.io.output.TeeOutputStream
/**
* Corresponds to a module in IntelliJ
*/

class Module(
val root : File,
val name : String,
val immediateUpstreamModules : Seq[Module] = Nil,
val testModuleDependencies : Seq[Module] = Nil,
val analyses : ConcurrentHashMap[File, Analysis] = Module.analyses,
val scalaVersion: ScalaVersion = ScalaVersion.TWO_ELEVEN_DEFAULT
val scalaVersion: ScalaVersion = ScalaVersion.TWO_ELEVEN_DEFAULT,
val analyses : ConcurrentHashMap[File, Analysis] = Module.analyses
)
extends ProjectTrait
with DependencyPimps
Expand Down
2 changes: 1 addition & 1 deletion maker/src/maker/project/TmuxIntegration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait TmuxIntegration extends ProjectTrait{
private lazy val hasTmux = Command("which", "tmux").withNoOutput.run == 0
def tmux(args : String*){
if (hasTmux)
Command(("tmux"::args.toList) : _*).withNoOutput.runAsync
Command(("tmux"::args.toList) : _*).withNoOutput.runAsync()
}

private def tmuxReportTaskFailed(msg : String){
Expand Down
29 changes: 17 additions & 12 deletions maker/src/maker/utils/os/Command.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import maker.utils.Int
case class Command(
overrideOutput : Option[OutputStream],
timeout : Option[Duration],
overrideInput: Option[InputStream] = None,
overrideWorkingDirectory : Option[File] = None,
overrideExitValues : Option[Seq[Int]] = None,
overrideStreamHandler: Option[ExecuteStreamHandler] = None,
args : Seq[String]
)
extends Log
Expand Down Expand Up @@ -40,9 +42,10 @@ case class Command(
new ExecuteWatchdog(timeoutMillis)
}
def executor = {
val streamHandler = overrideOutput match {
case Some(os) => new PumpStreamHandler(os)
case None => new PumpStreamHandler()
val streamHandler = overrideStreamHandler.getOrElse {
val out = overrideOutput.getOrElse(null)
val in = overrideInput.getOrElse(null)
new PumpStreamHandler(out, out, in)
}

val executor_ = new DefaultExecutor()
Expand All @@ -59,26 +62,28 @@ case class Command(
result
}

def runAsync() = {
val resultHandler = new ExecuteResultHandler(){
def onProcessComplete(exitValue : Int) = {
// do nothing
}
def onProcessFailed(e : ExecuteException) = {
// do nothing
}
}
def runAsync(resultHandler: ExecuteResultHandler = new Command.DoNothingResultHandler()) = {
logger.info(s"running command '${toString}' asynchronously")
executor.execute(commandLine, resultHandler)
}
}

object Command {
class DoNothingResultHandler extends ExecuteResultHandler {
def onProcessComplete(exitValue : Int) = {
// do nothing
}
def onProcessFailed(e : ExecuteException) = {
// do nothing
}
}
def apply(args : String*) : Command = Command(
overrideOutput = None,
timeout = None,
overrideInput = None,
overrideWorkingDirectory = None,
overrideExitValues = None,
overrideStreamHandler = None,
args
)

Expand Down
4 changes: 2 additions & 2 deletions maker/tests/maker/project/TestModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class TestModule(
name,
upstreamProjects,
upstreamTestProjects,
analyses,
scalaVersion
scalaVersion,
analyses
) with ClassicLayout with DependencyPimps {

override def constructorCodeAsString : String = {
Expand Down
12 changes: 11 additions & 1 deletion maker/tests/maker/task/compile/CompileTaskTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ import java.util.concurrent.ConcurrentHashMap
import sbt.inc.Analysis
import com.typesafe.zinc.Compiler
import maker.utils.FileUtils
import maker.TestMaker

class CompileTaskTests extends FunSuite with TestUtils with Matchers with ModuleTestPimps{

ignore("Can compile a single module project") {
withTempDir{
rootDirectory =>
val testMaker = TestMaker(
rootDirectory
).withModule("a")(rootDirectory)
}
}

ignore("Can compile 2.10 and 2.11 scala versions"){
withTempDir{
moduleRoot =>
Expand Down Expand Up @@ -127,7 +137,7 @@ class CompileTaskTests extends FunSuite with TestUtils with Matchers with Module
(proj, module, files)
}

test("Compilation makes class files, writes dependencies, and package makes jar"){
ignore("Compilation makes class files, writes dependencies, and package makes jar"){
withTempDir {
dir =>
val (proj, module, _) = simpleProject(dir)
Expand Down
Loading

0 comments on commit 6a5fe2e

Please sign in to comment.