Skip to content

Commit

Permalink
Quick update of ARCHITECTURE.md (software-mansion#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciektr authored Jun 6, 2024
1 parent 432c79e commit 499bca2
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ flowchart TD
subgraph BUILTIN_CMDS ["Built-in commands"]
direction LR
BLD[scarb build]
CLN[scarb clean]
CHK[scarb check]
UPD[scarb update]
FTH[scarb fetch]
FMT[scarb fmt]
RUN[scarb run]
CLN[scarb clean]
CAC[scarb cache]
NEW[scarb init/new]
UPD[scarb add/rm/update]
PUB[scarb package/publish]
MET[scarb metadata]
CMD[scarb commands]
MAN[scarb manifest-path]
end
subgraph EXT_CMDS ["External subcommands system"]
direction LR
CAIRO_LS["Cairo Language Server"]
CAIRO_RUN["scarb run"]
SCARB_DOC["scarb doc"]
SNFORGE["scarb test\n(can redirect to either snforge,\ncairo-test or other runner)"]
end
```
Expand Down Expand Up @@ -74,12 +80,14 @@ classDiagram
- compilers
}
class CairoPluginRepository {
- compiler macro plugins
- built-in compiler macro plugins
}
class StarknetContractCompiler {
}
class LibCompiler {
}
class TestCompiler {
}
class Workspace~'c~ {
+ members() Iter~Package~
}
Expand Down Expand Up @@ -107,10 +115,12 @@ classDiagram
+ String name
+ VersionReq
+ SourceId
+ DepKind
}
class Target {
+ TargetKind
+ String name
+ Optional group_id
+ BTreeMap<String, *> params
}
class CompilationUnit {
Expand Down Expand Up @@ -144,6 +154,7 @@ classDiagram
CompilationUnit ..> Target : is created from
CodegenRepository *-- StarknetContractCompiler
CodegenRepository *-- LibCompiler
CodegenRepository *-- TestCompiler
```

### Sources and the internal registry
Expand All @@ -158,15 +169,15 @@ classDiagram
}
class PathSource
class GitSource
class StandardLibSource
class RegistrySource {
<<Future>>
class RegistrySource
class StandardLibSource {
/embedded/
}
PathSource ..|> Source
GitSource ..|> Source
StandardLibSource ..|> Source
RegistrySource ..|> Source
StandardLibSource ..|> Source
```

A _source_ is an object that finds and downloads remote packages based on names and versions.
Expand All @@ -176,10 +187,9 @@ There are various `Source` implementation for different methods of downloading p
1. `PathSource` simply provides an ability to operate on packages from local file system.
2. `GitSource` downloads packages from Git repositories.
3. `RegistrySource` downloads packages from package registries.
4. `StandardLibSource` unpacks packages embedded into the Scarb binary itself.
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 All @@ -202,9 +212,7 @@ internally.

### Lockfile

**THIS IS NOT IMPLEMENTED YET.**

TODO(mkaput): Write this section.
See Scarb documentation.

## Scarb Compiler

Expand Down Expand Up @@ -274,10 +282,11 @@ Plugins appropriate to be used for building a specific package are applied to th
When using Scarb as a library, Cairo plugins can be defined with configuration builder.
If not specified otherwise, Scarb comes with predefined StarkNet Cairo plugin, that can be used for StarkNet contracts
compilation.
In the future, Scarb will also provide a way to define Cairo plugins as package dependencies.

**The mechanism for requiring Cairo plugins as package dependencies or compiling them in Scarb runtime is not implemented yet.**
### Procedural Macros

Procedural macros provide a mechanism for defining custom macros as package dependencies.
The package with macro source code definition will be pulled and compiled by Scarb.
Please see [the design document](design/01-proc-macro.md) for more information.

### RootDatabase management within the compiler
Expand Down

0 comments on commit 499bca2

Please sign in to comment.