Skip to content

Commit

Permalink
Update architecture docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maciektr committed May 5, 2023
1 parent 878f6b7 commit 17c62fd
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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~
Expand All @@ -73,6 +84,9 @@ classDiagram
class Manifest {
+ Summary
+ Vec~Target~
+ compiler config
+ profile definitions
+ scripts
+ not important metadata
}
class Summary {
Expand All @@ -88,7 +102,7 @@ classDiagram
class Target {
+ TargetKind
+ String name
+ BTreeMap~String, *~ params
+ BTreeMap<String, *> params
}
class CompilationUnit {
Contains all information
Expand Down Expand Up @@ -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:
Expand All @@ -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.

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 17c62fd

Please sign in to comment.