From 719bc9b77f08d4a85c73af0c7aec61ee434cac93 Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Mon, 11 Nov 2024 11:30:16 +0100 Subject: [PATCH] Update indentation style --- src/cli/actions.scala | 50 ++++++------ src/cli/clifrontend.scala | 4 +- src/engine/build.scala | 158 +++++++++++++++++++------------------- src/engine/cache.scala | 26 +++---- src/model/model.scala | 128 +++++++++++++++--------------- 5 files changed, 183 insertions(+), 183 deletions(-) diff --git a/src/cli/actions.scala b/src/cli/actions.scala index 12fe4be..beb54e4 100644 --- a/src/cli/actions.scala +++ b/src/cli/actions.scala @@ -55,16 +55,16 @@ case class InitError(initMessage: Message) extends Error(initMessage) object actions: object install: def installInteractive(force: Boolean, noTabCompletions: Boolean) - (using DaemonService[?], - Log[Display], - SystemProperties, - Environment, - WorkingDirectory, - HomeDirectory, - Effectful, - CliFrontEnd, - Terminal, - Stdio) + (using DaemonService[?], + Log[Display], + SystemProperties, + Environment, + WorkingDirectory, + HomeDirectory, + Effectful, + CliFrontEnd, + Terminal, + Stdio) : Exit raises UserError = tend: @@ -87,14 +87,14 @@ object actions: case DismissError() => Exit.Fail(1) def batch(force: Boolean, noTabCompletions: Boolean) - (using DaemonService[?], - FrontEnd, - Log[Display], - SystemProperties, - Environment, - WorkingDirectory, - HomeDirectory, - Effectful) + (using DaemonService[?], + FrontEnd, + Log[Display], + SystemProperties, + Environment, + WorkingDirectory, + HomeDirectory, + Effectful) : Exit raises UserError = tend: @@ -171,13 +171,13 @@ object actions: object project: def publish(projectId: ProjectId, streamId: Optional[StreamId]) - (using WorkingDirectory, - Stdio, - Environment, - SystemProperties, - GitCommand, - Log[Display], - Internet) + (using WorkingDirectory, + Stdio, + Environment, + SystemProperties, + GitCommand, + Log[Display], + Internet) : Exit raises UserError = import filesystemOptions.doNotCreateNonexistent diff --git a/src/cli/clifrontend.scala b/src/cli/clifrontend.scala index 6063944..75038bf 100644 --- a/src/cli/clifrontend.scala +++ b/src/cli/clifrontend.scala @@ -40,7 +40,7 @@ import java.util.concurrent as juc def frontEnd[ResultType](lambda: CliFrontEnd ?=> Terminal ?=> ResultType) - (using Cli, Log[Display], Monitor) + (using Cli, Log[Display], Monitor) : ResultType = terminal: val frontEnd = CliFrontEnd() @@ -57,7 +57,7 @@ def frontEnd[ResultType](lambda: CliFrontEnd ?=> Terminal ?=> ResultType) FrontEnd.unregister(frontEnd) def interactive[ResultType](using frontEnd: CliFrontEnd) - (block: Stdio ?=> Interactivity[TerminalEvent] ?=> ResultType) + (block: Stdio ?=> Interactivity[TerminalEvent] ?=> ResultType) : ResultType = block(using frontEnd.terminal.stdio)(using frontEnd.terminal) diff --git a/src/engine/build.scala b/src/engine/build.scala index 063e224..f521a09 100644 --- a/src/engine/build.scala +++ b/src/engine/build.scala @@ -106,13 +106,13 @@ class Builder(): private val tasks: Mutex[scm.HashMap[Hash, Task[Directory]]] = Mutex(scm.HashMap()) def runTask(name: Text, hash: Hash) - (using Monitor, - Environment, - FrontEnd, - SystemProperties, - Installation, - DaemonService[?], - Internet) + (using Monitor, + Environment, + FrontEnd, + SystemProperties, + Installation, + DaemonService[?], + Internet) : Task[Directory] logs Message = Log.info(m"Building task for $hash") @@ -124,26 +124,26 @@ class Builder(): extension (library: Library) def phase(workspace: Workspace, target: Target) - (using Installation, - Internet, - Monitor, - WorkingDirectory, - Universe, - GitCommand, - FrontEnd) + (using Installation, + Internet, + Monitor, + WorkingDirectory, + Universe, + GitCommand, + FrontEnd) : LibraryPhase raises ConcurrencyError raises PathError raises GitError raises BuildError raises ExecError raises IoError logs Message = LibraryPhase(installation.build, library, target) extension (artifact: Artifact) def phase(workspace: Workspace, target: Target) - (using Installation, - Internet, - Monitor, - WorkingDirectory, - Universe, - GitCommand, - FrontEnd) + (using Installation, + Internet, + Monitor, + WorkingDirectory, + Universe, + GitCommand, + FrontEnd) : ArtifactPhase raises ConcurrencyError raises PathError raises GitError raises BuildError raises ExecError raises IoError logs Message = @@ -184,7 +184,7 @@ class Builder(): extension (exec: Exec) def phase(workspace: Workspace, target: Target) - (using Installation, Internet, Universe, Monitor, WorkingDirectory, FrontEnd, GitCommand) + (using Installation, Internet, Universe, Monitor, WorkingDirectory, FrontEnd, GitCommand) : ExecPhase raises ConcurrencyError raises GitError raises PathError raises ExecError raises IoError raises BuildError raises StreamError logs Message = @@ -201,7 +201,7 @@ class Builder(): extension (module: Module) def phase(workspace: Workspace, target: Target) - (using Installation, Internet, Universe, Monitor, WorkingDirectory, FrontEnd, GitCommand) + (using Installation, Internet, Universe, Monitor, WorkingDirectory, FrontEnd, GitCommand) : ModulePhase raises ConcurrencyError raises GitError raises PathError raises ExecError raises IoError raises BuildError raises StreamError logs Message = @@ -248,7 +248,7 @@ class Builder(): unsafely(build / Name(hash.keep(2)) / Name(hash.skip(2))) def run(name: Text, hash: Hash) - (using FrontEnd, DaemonService[?], Installation, Monitor, SystemProperties, Environment, Internet) + (using FrontEnd, DaemonService[?], Installation, Monitor, SystemProperties, Environment, Internet) : Directory logs Message raises BuildError case class ArtifactPhase @@ -272,13 +272,13 @@ class Builder(): val binaries: List[Hash] = Nil def run(name: Text, hash: Hash) - (using FrontEnd, - DaemonService[?], - Installation, - Monitor, - SystemProperties, - Environment, - Internet) + (using FrontEnd, + DaemonService[?], + Installation, + Monitor, + SystemProperties, + Environment, + Internet) : Directory logs Message raises BuildError = antecedents.each: (hash, name) => @@ -445,7 +445,7 @@ class Builder(): val binaries: List[Hash] = List(digest) def run(name: Text, hash: Hash) - (using FrontEnd, DaemonService[?], Installation, Monitor, SystemProperties, Environment, Internet) + (using FrontEnd, DaemonService[?], Installation, Monitor, SystemProperties, Environment, Internet) : Directory raises BuildError logs Message = accrue(BuildError()): @@ -516,24 +516,24 @@ class Builder(): .within(output.as[Directory]) case class ExecPhase - (build: Path, - target: Target, - exec: Exec, - classpath: List[Hash], - antecedents: Map[Hash, Text], - watches: Set[Path]) + (build: Path, + target: Target, + exec: Exec, + classpath: List[Hash], + antecedents: Map[Hash, Text], + watches: Set[Path]) extends Phase: def digest = (antecedents).digest[Sha2[256]] def binaries: List[Hash] = Nil def run(name: Text, hash: Hash) - (using FrontEnd, - DaemonService[?], - Installation, - Monitor, - SystemProperties, - Environment, - Internet) + (using FrontEnd, + DaemonService[?], + Installation, + Monitor, + SystemProperties, + Environment, + Internet) : Directory logs Message raises BuildError = val inputs = @@ -614,13 +614,13 @@ class Builder(): val binaries: List[Hash] = Nil def run(name: Text, hash: Hash) - (using FrontEnd, - DaemonService[?], - Installation, - Monitor, - SystemProperties, - Environment, - Internet) + (using FrontEnd, + DaemonService[?], + Installation, + Monitor, + SystemProperties, + Environment, + Internet) : Directory logs Message raises BuildError = Log.info(m"Starting to build") @@ -765,13 +765,13 @@ class Builder(): def schedule(digest: Hash): Dag[Target] = dag(digest).map(_.target) def build(target: Target)(using Universe) - (using Monitor, - Clock, - WorkingDirectory, - Internet, - Installation, - GitCommand, - FrontEnd) + (using Monitor, + Clock, + WorkingDirectory, + Internet, + Installation, + GitCommand, + FrontEnd) : Task[Hash] raises BuildError logs Message = synchronized: builds.establish(target): Log.info(m"Building target $target") @@ -840,13 +840,13 @@ class Builder(): unsafely(installation.build / Name(hash.keep(2)) / Name(hash.skip(2))) def run(name: Text, hash: Hash, force: Boolean) - (using DaemonService[?], - Installation, - FrontEnd, - Monitor, - SystemProperties, - Environment, - Internet) + (using DaemonService[?], + Installation, + FrontEnd, + Monitor, + SystemProperties, + Environment, + Internet) : Directory raises ConcurrencyError raises StreamError raises ZipError raises IoError raises PathError raises BuildError raises CompileError logs Message = @@ -855,12 +855,12 @@ class Builder(): extension (workspace: Workspace) def locals() - (using Monitor, WorkingDirectory, Internet, Installation, GitCommand) + (using Monitor, WorkingDirectory, Internet, Installation, GitCommand) : Map[ProjectId, Definition] raises ConcurrencyError raises WorkspaceError logs Message = Cache.projectsMap(workspace).await() def universe() - (using Monitor, Clock, WorkingDirectory, Internet, Installation, GitCommand) + (using Monitor, Clock, WorkingDirectory, Internet, Installation, GitCommand) : Universe raises ConcurrencyError raises VaultError raises WorkspaceError logs Message = Log.info(m"Constructing universe") @@ -882,17 +882,17 @@ extension (workspace: Workspace) def apply(projectId: ProjectId): Project = workspace.projects(projectId) def apply(path: WorkPath) - (using Installation, - Internet, - Monitor, - WorkingDirectory, - FrontEnd, - GitCommand, - Tactic[ConcurrencyError], - Tactic[GitError], - Tactic[PathError], - Tactic[ExecError], - Tactic[IoError]) + (using Installation, + Internet, + Monitor, + WorkingDirectory, + FrontEnd, + GitCommand, + Tactic[ConcurrencyError], + Tactic[GitError], + Tactic[PathError], + Tactic[ExecError], + Tactic[IoError]) : Path logs Message = workspace.mounts.keys.where(_.precedes(path)).lay(workspace.directory.path + path.link): mount => diff --git a/src/engine/cache.scala b/src/engine/cache.scala index 8f76885..fa46e6a 100644 --- a/src/engine/cache.scala +++ b/src/engine/cache.scala @@ -52,7 +52,7 @@ given Timezone = tz"Etc/UTC" case class CachedFile(lastModified: Instant, text: Task[Text], hash: Task[Hash]) case class CacheInfo - (ecosystems: Int, snapshots: Int, workspaces: Int, files: Int, dataSize: ByteSize) + (ecosystems: Int, snapshots: Int, workspaces: Int, files: Int, dataSize: ByteSize) object Cache: private val ecosystems: scc.TrieMap[Ecosystem, Task[Vault]] = scc.TrieMap() @@ -96,15 +96,15 @@ object Cache: case Progress.RemoteCompressing(percent) => 0.8 + percent/5.0 def apply(snapshot: Snapshot) - (using Installation, - Internet, - WorkingDirectory, - GitCommand, - FrontEnd, - Tactic[ExecError], - Tactic[PathError], - Tactic[IoError], - Tactic[GitError]) + (using Installation, + Internet, + WorkingDirectory, + GitCommand, + FrontEnd, + Tactic[ExecError], + Tactic[PathError], + Tactic[IoError], + Tactic[GitError]) : Task[Directory] logs Message = snapshots.establish(snapshot): @@ -126,7 +126,7 @@ object Cache: Log.info(m"Finished cloning ${snapshot.url}") def apply(ecosystem: Ecosystem)(using installation: Installation) - (using Internet, WorkingDirectory, GitCommand) + (using Internet, WorkingDirectory, GitCommand) : Task[Vault] raises VaultError logs Message = ecosystems.establish(ecosystem): @@ -209,7 +209,7 @@ object Cache: Vault(t"vent", 1, current) def workspace(path: Path) - (using Installation, Internet, WorkingDirectory, GitCommand) + (using Installation, Internet, WorkingDirectory, GitCommand) : Task[Workspace] raises WorkspaceError logs Message = val lastModified = @@ -225,7 +225,7 @@ object Cache: workspaces(path) = (lastModified, async) def projectsMap(workspace: Workspace) - (using Installation, Internet, WorkingDirectory, GitCommand) + (using Installation, Internet, WorkingDirectory, GitCommand) : Task[Map[ProjectId, Definition]] raises WorkspaceError raises ConcurrencyError logs Message = locals.establish(workspace): diff --git a/src/model/model.scala b/src/model/model.scala index 691743a..831b410 100644 --- a/src/model/model.scala +++ b/src/model/model.scala @@ -70,17 +70,17 @@ object Release: given relabelling: CodlRelabelling[Release] = () => Map(t"packages" -> t"provide") case class Release - (id: ProjectId, - stream: StreamId, - name: Text, - website: Optional[HttpUrl], - description: InlineMd, - license: LicenseId, - date: Date, - lifetime: Int, - repo: Snapshot, - packages: List[Fqcn], - keywords: List[Keyword]): + (id: ProjectId, + stream: StreamId, + name: Text, + website: Optional[HttpUrl], + description: InlineMd, + license: LicenseId, + date: Date, + lifetime: Int, + repo: Snapshot, + packages: List[Fqcn], + keywords: List[Keyword]): def expiry: Date = date + lifetime.days @@ -122,12 +122,12 @@ object Build: t"mounts" -> t"mount") case class Build - (prelude: Optional[Prelude], - ecosystem: Ecosystem, - actions: List[Action], - default: Optional[ActionName], - projects: List[Project], - mounts: List[Mount]): + (prelude: Optional[Prelude], + ecosystem: Ecosystem, + actions: List[Action], + default: Optional[ActionName], + projects: List[Project], + mounts: List[Mount]): def defaultAction: Optional[Action] = actions.where(_.name == default) case class Prelude(terminator: Text, comment: List[Text]) @@ -145,20 +145,20 @@ object Project: t"streams" -> t"stream") case class Project - (id: ProjectId, - name: Text, - description: InlineMd, - modules: List[Module], - libraries: List[Library], - artifacts: List[Artifact], - containers: List[Container], - loads: List[Load], - variables: List[Variable], - execs: List[Exec], - website: HttpUrl, - license: Optional[LicenseId], - keywords: List[Keyword], - streams: List[Stream]): + (id: ProjectId, + name: Text, + description: InlineMd, + modules: List[Module], + libraries: List[Library], + artifacts: List[Artifact], + containers: List[Container], + loads: List[Load], + variables: List[Variable], + execs: List[Exec], + website: HttpUrl, + license: Optional[LicenseId], + keywords: List[Keyword], + streams: List[Stream]): def suggestion: Suggestion = Suggestion(id.show, t"$name: $description") @@ -224,17 +224,17 @@ object Artifact: t"suffixes" -> t"suffix") case class Artifact - (id: GoalId, - path: WorkPath, - basis: Optional[Basis], - includes: List[Target], - main: Optional[Fqcn], - prefixes: List[WorkPath], - suffixes: List[WorkPath], - counter: Optional[WorkPath], - executable: Optional[Boolean], - manifest: List[ManifestEntry], - resources: List[Resource]) + (id: GoalId, + path: WorkPath, + basis: Optional[Basis], + includes: List[Target], + main: Optional[Fqcn], + prefixes: List[WorkPath], + suffixes: List[WorkPath], + counter: Optional[WorkPath], + executable: Optional[Boolean], + manifest: List[ManifestEntry], + resources: List[Resource]) case class Resource(path: WorkPath, jarPath: WorkPath) @@ -248,11 +248,11 @@ case class Insertion(source: WorkPath, destination: WorkPath) case class Extraction(source: WorkPath, destination: WorkPath) case class Container - (id: GoalId, - dockerfile: WorkPath, - root: WorkPath, - insertions: List[Insertion], - extractions: List[Extraction]) + (id: GoalId, + dockerfile: WorkPath, + root: WorkPath, + insertions: List[Insertion], + extractions: List[Extraction]) object Exec: given relabelling: CodlRelabelling[Exec] = () => @@ -271,17 +271,17 @@ object Module: t"assists" -> t"assist") case class Module - (id: GoalId, - includes: List[Target], - requirements: List[Target], - sources: List[WorkPath], - packages: List[Fqcn], - usages: List[Target], - omissions: List[Target], - assists: List[Assist], - compiler: Optional[Text], - main: Optional[Fqcn], - coverage: Optional[Target]) + (id: GoalId, + includes: List[Target], + requirements: List[Target], + sources: List[WorkPath], + packages: List[Fqcn], + usages: List[Target], + omissions: List[Target], + assists: List[Assist], + compiler: Optional[Text], + main: Optional[Fqcn], + coverage: Optional[Target]) case class Library(id: GoalId, url: HttpUrl) @@ -375,12 +375,12 @@ case class WorkPath(descent: List[Name[Posix]]): def link: Relative = Relative(0, descent) case class Definition - (name: Text, - description: InlineMd, - website: Optional[HttpUrl], - license: Optional[LicenseId], - keywords: List[Keyword], - source: Vault | Workspace) + (name: Text, + description: InlineMd, + website: Optional[HttpUrl], + license: Optional[LicenseId], + keywords: List[Keyword], + source: Vault | Workspace) object Workspace: def apply()(using WorkingDirectory): Workspace raises WorkspaceError =