From 17c62fd858b4c21d98898c58f54a147f9df6be17 Mon Sep 17 00:00:00 2001 From: maciektr Date: Fri, 5 May 2023 12:51:54 +0200 Subject: [PATCH] Update architecture docs --- ARCHITECTURE.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 5249f890d..db0bd68b4 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -15,12 +15,18 @@ flowchart TD subgraph BUILTIN_CMDS ["Built-in commands"] direction LR BLD[scarb build] + CLN[scarb clean] FMT[scarb fmt] + RUN[scarb run] + NEW[scarb init/new] UPD[scarb add/rm/update] MET[scarb metadata] + CMD[scarb commands] + MAN[scarb manifest-path] end subgraph EXT_CMDS ["External subcommands system"] direction LR + CAIRO_LS["Cairo Language Server"] PROTOSTAR["scarb test\n(will be built from Protostar)"] STARKNET["scarb starknet\n(will be built from Protostar)"] end @@ -58,10 +64,15 @@ classDiagram } class Config~'c~ { - manifest path + - app exe path - app dirs, like config, cache, PATH, etc. - target directory handle - ui + - logging configuration + - cairo plugins + - current profile - global locks + - tokio runtime } class Workspace~'c~ { + members() Iter~Package~ @@ -73,6 +84,9 @@ classDiagram class Manifest { + Summary + Vec~Target~ + + compiler config + + profile definitions + + scripts + not important metadata } class Summary { @@ -88,7 +102,7 @@ classDiagram class Target { + TargetKind + String name - + BTreeMap~String, *~ params + + BTreeMap<String, *> params } class CompilationUnit { Contains all information @@ -121,8 +135,6 @@ classDiagram ### Sources and the internal registry -**THIS IS NOT FULLY IMPLEMENTED YET.** - A _source_ is an object that finds and downloads remote packages based on names and versions. The interface of sources is contained within the `Source` trait. There are various `Source` implementation for different methods of downloading packages: @@ -132,6 +144,8 @@ There are various `Source` implementation for different methods of downloading p 3. `RegistrySource` downloads packages from package registries. 4. And more... +**CURRENTLY ONLY PATH AND GIT SOURCES ARE IMPLEMENTED.** + The `Registry` object gathers all `Source` objects in a single mapping, and provides a unified interface for querying _any_ package, no matter of its source. @@ -182,9 +196,14 @@ overwritten. ### Targets -**THIS IS NOT IMPLEMENTED YET.** +Compilation targets are defined in the `Package` manifest. +Each target corresponds to source files which can be compiled into a package, and the way how the package is compiled. +Packages can have a built-in library target, and/or more externally defined targets. +When building a package, each target of this package will use exactly the same set of dependencies during compilation. +By default, if the manifest does not list any targets, Scarb will assume the library target with its default parameters. - TODO(mkaput): Write this section. +Each compilation target consists of target kind, source path and parameters table. +When building a project, compilation targets are used to construct compilation units. [pubgrub-algo-docs]: https://nex3.medium.com/pubgrub-2fb6470504f