Skip to content

Commit

Permalink
Everything seems much more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Apr 7, 2024
1 parent 290523b commit 99fb70e
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 187 deletions.
12 changes: 5 additions & 7 deletions fury
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ repo propensive/probably 0000000000000000000000000000000000000000
repo propensive/galilei 0000000000000000000000000000000000000000
repo propensive/jacinta 0000000000000000000000000000000000000000
repo propensive/cellulose 0000000000000000000000000000000000000000
repo propensive/embarcadero 0000000000000000000000000000000000000000
repo propensive/impressionism 0000000000000000000000000000000000000000
repo propensive/aviation 0000000000000000000000000000000000000000
repo propensive/imperial 0000000000000000000000000000000000000000
repo propensive/gastronomy 0000000000000000000000000000000000000000
Expand All @@ -24,28 +26,24 @@ repo propensive/zeppelin 0000000000000000000000000000000000000000
project fury
module model
compiler scala
include xylophone/core acyclicity/core galilei/core telekinesis/client aviation/core escritoire/core cellulose/core punctuation/core imperial/core gastronomy/core acyclicity/core nettlesome/url octogenarian/core surveillance/core exoskeleton/core exoskeleton/completions ethereal/core eucalyptus/ansi eucalyptus/syslog superlunary/core hallucination/core
include acyclicity/core aviation/core cellulose/core escritoire/core exoskeleton/completions jacinta/core octogenarian/core punctuation/core telekinesis/client xylophone/core
sources src/model
lib scalajs-linker-interface https://repo1.maven.org/maven2/org/scala-js/scalajs-linker-interface_2.13/1.14.0/scalajs-linker-interface_2.13-1.14.0.jar
lib scalajs-logging https://repo1.maven.org/maven2/org/scala-js/scalajs-logging_2.13/1.1.1/scalajs-logging_2.13-1.1.1.jar

module engine
compiler scala
include fury/model feudalism/core anthology/scala dendrology/dag zeppelin/core harlequin/core revolution/core embarcadero/core
include fury/model anthology/scala anthology/java revolution/core harlequin/ansi dendrology/dag zeppelin/core ethereal/core embarcadero/core
sources src/engine

module cli
compiler scala
include fury/engine
include fury/engine hallucination/core impressionism/core eucalyptus/ansi eucalyptus/syslog
sources src/cli
main fury.main
artifact dist/rage
counter res/build.id

module core
sources src/core
include fury/model

module test
compiler scala
sources src/test
Expand Down
2 changes: 1 addition & 1 deletion res/build.id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1427
1589
19 changes: 13 additions & 6 deletions src/cli/actions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import nettlesome.*
import zeppelin.*
import octogenarian.*
import surveillance.*
import parasite.*
import parasite.*, asyncOptions.escalateExceptions
import profanity.*
import quantitative.*
import rudiments.*
Expand Down Expand Up @@ -102,12 +102,18 @@ object actions:
if !noTabCompletions then info(TabCompletions.install(force = true).communicate)
ExitStatus.Ok

def clean()(using FrontEnd, Installation): ExitStatus raises UserError =
import filesystemOptions.doNotCreateNonexistent
import filesystemOptions.doNotDereferenceSymlinks
import filesystemOptions.deleteRecursively
def clean(all: Boolean)(using FrontEnd, Installation): ExitStatus raises UserError =
import filesystemOptions.
{doNotCreateNonexistent, doNotDereferenceSymlinks, deleteRecursively}

val size0 = safely(installation.cache.as[Directory].size()).or(0.b)
safely(installation.cache.delete())

if all then safely(installation.cache.delete())
else
safely(installation.build.wipe())
safely(installation.tmp.delete())
safely(installation.work.wipe())

val size = safely(size0 - installation.cache.as[Directory].size()).or(0.b)
info(t"$size was cleaned up")
ExitStatus.Ok
Expand Down Expand Up @@ -236,3 +242,4 @@ object actions:
def versionInfo()(using FrontEnd): ExitStatus =
info(msg"Fury version 1.0")
ExitStatus.Ok

54 changes: 27 additions & 27 deletions src/cli/cli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import inimitable.*
import iridescence.*, colors.*
import kaleidoscope.*
import nettlesome.*
import parasite.*, threadModels.virtual
import parasite.*, threadModels.platform, asyncOptions.cancelOrphans
import profanity.*, terminalOptions.terminalSizeDetection
import quantitative.*
import rudiments.*, homeDirectories.virtualMachine
Expand All @@ -47,9 +47,6 @@ import spectacular.*
import turbulence.*
import vacuous.*

enum BusMessage:
case Ping

given Realm = realm"fury"
given Decimalizer = Decimalizer(2)

Expand All @@ -69,6 +66,7 @@ object cli:
Switch(t"discover", false, List('D'), t"Try to discover build details from the directory")

val Force = Switch(t"force", false, List('F'), t"Overwrite existing files if necessary")
val All = Switch(t"all", false, List('a'), t"Clean system artifacts as well")
val ForceRebuild = Switch(t"force", false, List('f'), t"Force the module to be rebuilt")

def Dir(using Raises[PathError]) =
Expand Down Expand Up @@ -105,7 +103,6 @@ given (using Raises[UserError]): HomeDirectory =

homeDirectories.virtualMachine


given (using Cli): WorkingDirectory = workingDirectories.daemonClient

given installation(using Raises[UserError]): Installation =
Expand Down Expand Up @@ -148,7 +145,7 @@ def main(): Unit =
initTime.let: initTime =>
Log.info(msg"Initialized Fury in ${(now() - initTime).show}")

cliService[BusMessage]:
cliService:
attempt[UserError]:
Log.envelop(Uuid().show.take(8)):
if Version().present then execute(frontEnd(actions.versionInfo())) else arguments match
Expand All @@ -164,22 +161,23 @@ def main(): Unit =

ExitStatus.Ok

case Init() :: Nil =>
case Init() :: _ =>

execute:
frontEnd:
val directory = safely(workingDirectory).or:
abort(UserError(msg"The working directory could not be determined."))
actions.build.initialize(directory)

case Config() :: Nil =>
case Config() :: _ =>
execute:
frontEnd:
info(installation.config.debug)
ExitStatus.Ok

case Clean() :: Nil =>
execute(frontEnd(actions.clean()))
case Clean() :: _ =>
val all: Boolean = All().present
execute(frontEnd(actions.clean(all)))

case Cache() :: subcommands => subcommands match
case Nil => execute(frontEnd(actions.cache.about()))
Expand Down Expand Up @@ -299,20 +297,23 @@ def main(): Unit =
subcommand().populated.let(ActionName(_)).or(workspace.build.default).let: action =>
workspace.build.actions.where(_.name == action).let: action =>
internet(online):
frontEnd:
val buildTask = task(t"build"):
action.modules.each(actions.build.run(_, watch, force, concise))

daemon:
terminal.events.stream.each:
case Keypress.Escape | Keypress.Ctrl('C') =>
summon[FrontEnd].abort()

case other =>
()

buildTask.await().also(Out.print(t"\e[?25h"))
ExitStatus.Ok
async:
frontEnd:
val buildTask = task(t"build"):
action.modules.each(actions.build.run(_, watch, force, concise))

daemon:
terminal.events.stream.each:
case Keypress.Escape | Keypress.Ctrl('C') =>
summon[FrontEnd].abort()

case other =>
()

buildTask.await().also(Out.print(t"\e[?25h"))
info(t"Compilation finished.")
ExitStatus.Ok
.await()

.or:
subcommand.let(frontEnd(actions.invalidSubcommand(_))).or:
Expand Down Expand Up @@ -344,9 +345,7 @@ def about()(using stdio: Stdio): ExitStatus =
Out.print(t" "*19)
Out.println(line)

val buildId = safely:
val resource = Classpath / p"build.id"
resource().readAs[Text].trim
val buildId = safely((Classpath / p"build.id")().readAs[Text].trim)

val scalaProperties = unsafely:
val resource = Classpath / p"compiler.properties"
Expand Down Expand Up @@ -384,3 +383,4 @@ def about()(using stdio: Stdio): ExitStatus =
e" ${Italic}(${Properties.os.name()} ${Properties.os.version()}, ${Properties.os.arch()})\n"

ExitStatus.Ok

15 changes: 8 additions & 7 deletions src/cli/clifrontend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import turbulence.*
import exoskeleton.*
import acyclicity.*
import contingency.*
import parasite.*
import parasite.*, asyncOptions.cancelOrphans
import dendrology.*, dagStyles.default
import vacuous.*
import hieroglyph.*, textMetrics.uniform
Expand All @@ -40,13 +40,14 @@ import scala.collection.concurrent as scc
import java.util.concurrent as juc


def frontEnd[ResultType](lambda: CliFrontEnd ?=> Terminal ?=> ResultType)(using Cli, Log[Display], Monitor)
def frontEnd[ResultType](lambda: CliFrontEnd ?=> Terminal ?=> ResultType)
(using Cli, Log[Display], Monitor)
: ResultType =
terminal:
val frontEnd = CliFrontEnd()
FrontEnd.register(frontEnd)
var continue: Boolean = true
val loop = async(while continue.also(frontEnd.render()) do sleep(50*Milli(Second)))
val loop = task(t"frontend")(while continue.also(frontEnd.render()) do sleep(50*Milli(Second)))

try lambda(using frontEnd).also { continue = false } finally
safely(loop.await())
Expand Down Expand Up @@ -97,13 +98,14 @@ class CliFrontEnd()(using Terminal) extends FrontEnd:

active.at(target) match
case 1.0 =>
e"$Bold(${colors.Gray}($target))$prefix$edge${Bg(rgb"#009966")}( ${colors.Black}($Bold(OK)) )$edge"
val graphRow = e"$Bold(${colors.Gray}($target))$prefix$edge"
e"$graphRow${Bg(rgb"#009966")}( ${colors.Black}($Bold(OK)) )$edge"

case -1.0 =>
e"$Bold(${colors.Gray}($target))$prefix$edge${Bg(rgb"#003333")}( )$edge"
val graphRow = e"$Bold(${colors.Gray}($target))$prefix$edge"
e"$graphRow${Bg(rgb"#003333")}( )$edge"

case Unset =>
e"${colors.Gray}(${target.show})"
e"$Bold(${colors.Gray}(${target}))$prefix$edge $edge"

case progress: Double =>
Expand All @@ -129,4 +131,3 @@ object ProgressBar:
val bars: IArray[Text] = IArray.from:
(0 to 96).map: progress =>
unsafely(((t""*(progress/8))+partial.at(progress%8).vouch.show).fit(12))

Loading

0 comments on commit 99fb70e

Please sign in to comment.