Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
env:
JVM_OPTS: "-Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8"
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: zulu
java-version: 8
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Test
run: |
sbt -v "^test"
sbt -v "^publishLocal"
sbt -v "it:test"
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: zulu
java-version: 8
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Test
run: |
sbt -v "+test"
sbt -v "+publishLocal"
sbt -v "all support/IntegrationTest/test build/IntegrationTest/test"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
target/
target-*
__pycache__/
docs/src/sphinx/version.py
.bsp
.devcontainer
.metals
.vscode
temp/
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package com.typesafe.dbuild.logging

import akka.actor.{ ActorRef, Actor, Props, PoisonPill, Terminated }
import sbt.{
Level,
LogEvent,
Success,
Log,
Trace,
SetLevel,
SetTrace,
SetSuccess,
ControlEvent,
StackTrace
}
import sbt.io.IO
import sbt.io.Path._
import sbt.io.syntax._
import sbt.util.{ Level, LogEvent, Log, Trace, ControlEvent }
import sbt.internal.util.StackTrace

/** A command to the logging system to log a given event into a particular path. */
case class LogCmd(path: String, evt: LogEvent, projName: String)
Expand All @@ -29,16 +22,12 @@ import Level._
def success(msg: => String): Unit =
sendLog(Level.Info, msg)
def buffer[T](t: => T): T = t // TODO - buffer actor messages....
def err(s: => String): Unit =
sendLog(Error, s)
def out(s: => String): Unit =
sendLog(Info, s)
def control(event: sbt.ControlEvent.Value, msg: => String): Unit =
def control(event: ControlEvent.Value, msg: => String): Unit =
sendLogEvent(new ControlEvent(event, msg))
def logAll(events: Seq[sbt.LogEvent]): Unit = {
def logAll(events: Seq[LogEvent]): Unit = {
events foreach sendLogEvent
}
def log(level: sbt.Level.Value, msg: => String): Unit =
def log(level: Level.Value, msg: => String): Unit =
sendLog(level, msg)
private def sendLog(level: Level.Value, msg: => String): Unit =
sendLogEvent(new Log(level, msg))
Expand Down Expand Up @@ -84,13 +73,13 @@ trait LogToOutput {
def log(lo: LogCmd): Unit = lo.evt match {
case t: Trace =>
// TODO - Real trace levels...
writeLog(sbt.StackTrace.trimmed(t.exception, 1))
writeLog(StackTrace.trimmed(t.exception, 1))
case l: Log if l.level >= level =>
val sb = new StringBuffer()
for (line <- l.msg.split("""\n"""")) {
// if projName, we are more interested in the project name,
// rather than the error level (unless it is something other than "info")
if (lo.projName != "" && l.level == sbt.Level.Info)
if (lo.projName != "" && l.level == Level.Info)
sb append ("[") append (lo.projName) append "] "
else {
sb append ("[")
Expand All @@ -105,19 +94,18 @@ trait LogToOutput {
}

def writeLog(in: String): Unit
def level: sbt.Level.Value
def level: Level.Value
}

/** An actor that takes LogCmd messages and writes them to a file. */
class LoggerFileWriteActor(logDir: java.io.File, path: String) extends Actor with LogToOutput {
import sbt.Path._
def logFile = logDir / (ActorLogHelper.cleanPath(path) + ".log")
def newWriter = {
val f = logFile
sbt.IO touch f
IO touch f
new java.io.FileWriter(f)
}
var level: sbt.Level.Value = Level.Debug
var level: Level.Value = Level.Debug
var output = newWriter

override def postStop() = output.close()
Expand Down Expand Up @@ -151,7 +139,6 @@ class LoggerFileWriteActor(logDir: java.io.File, path: String) extends Actor wit

/** An actor that takes LogCmd messages and writes them to a file. */
class SystemOutLoggerActor(debug: Boolean) extends Actor with LogToOutput {
import sbt.Path._
val output = System.out
val level = if (debug) Level.Debug else Level.Info

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import scala.concurrent.duration._
import com.typesafe.dbuild.project.resolve.ProjectResolver
import java.io.File
import com.typesafe.dbuild.repo.core._
import sbt.IO
import sbt.io.{ IO, DirectoryFilter }
import sbt.io.Path._
import sbt.io.syntax._
import com.typesafe.dbuild.project.cleanup.Recycling._
import sbt.Path._
import com.typesafe.dbuild.repo.core.GlobalDirs.buildDir
import com.typesafe.dbuild.project.{ BuildSystem, BuildData }
import com.typesafe.dbuild.utils.TrackedProcessBuilder
Expand All @@ -25,7 +26,7 @@ case class RunBuild(build: RepeatableProjectBuild, outProjects: Seq[Project], ch
class CleaningBuildActor extends Actor {
def receive = {
case target: File =>
IO.delete(buildDir(target).*(sbt.DirectoryFilter).get.filter(markedForDeletion))
IO.delete(buildDir(target).*(DirectoryFilter).get.filter(markedForDeletion))
self ! PoisonPill
}
}
Expand All @@ -36,7 +37,7 @@ class BuildRunnerActor(builder: LocalBuildRunner, target: File, exp: CleanupExpi
override def preStart() = {
// Cleanup works in two stages; see ExtractorActor for details.
// Note that cleanup is performed independently for the extraction and build directories
buildDir(target).*(sbt.DirectoryFilter).get.filter(upForDeletion(_, exp)).foreach(prepareForDeletion)
buildDir(target).*(DirectoryFilter).get.filter(upForDeletion(_, exp)).foreach(prepareForDeletion)
// spawn the cleaning actor
context.actorOf(Props(new CleaningBuildActor)) ! target
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.dbuild.model.{ ProjectBuildConfig, ExtractionConfig, ExtractionFailed, TimedOut }
import _root_.java.io.File
import sbt.Path._
import sbt.io.Path._
import sbt.io.syntax._
import ExtractionDirs.projectExtractionDir
import com.typesafe.dbuild.repo.core.GlobalDirs.extractionDir
import com.typesafe.dbuild.model.CleanupExpirations
import com.typesafe.dbuild.project.cleanup.Recycling._
import sbt.{ IO, DirectoryFilter }
import sbt.io.{ IO, DirectoryFilter }
import com.typesafe.dbuild.logging.Logger
import Logger.prepareLogMsg
import scala.util.{Success,Failure}
Expand Down
3 changes: 3 additions & 0 deletions adapter/src/main/scala-2.10/Adapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ object LoggingInterface {
val Level = sbt.Level
type Logger = sbt.Logger
type LogEvent = sbt.LogEvent
type Log = sbt.Log
type Trace = sbt.Trace
val ControlEvent = sbt.ControlEvent
type ControlEvent = sbt.ControlEvent
val StackTrace = sbt.StackTrace
type BasicLogger = sbt.BasicLogger
}
Expand Down
3 changes: 3 additions & 0 deletions adapter/src/main/scala-2.12/Adapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ object LoggingInterface {
val Level = sbt.util.Level
type Logger = sbt.util.Logger
type LogEvent = sbt.util.LogEvent
type Log = sbt.util.Log
type Trace = sbt.util.Trace
val ControlEvent = sbt.util.ControlEvent
type ControlEvent = sbt.util.ControlEvent
val StackTrace = sbt.internal.util.StackTrace
type BasicLogger = sbt.internal.util.BasicLogger
}
Expand Down
Loading