Skip to content

Commit 499bca2

Browse files
authored
Quick update of ARCHITECTURE.md (#1339)
1 parent 432c79e commit 499bca2

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

ARCHITECTURE.md

+23-14
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,24 @@ flowchart TD
1515
subgraph BUILTIN_CMDS ["Built-in commands"]
1616
direction LR
1717
BLD[scarb build]
18-
CLN[scarb clean]
18+
CHK[scarb check]
19+
UPD[scarb update]
20+
FTH[scarb fetch]
1921
FMT[scarb fmt]
20-
RUN[scarb run]
22+
CLN[scarb clean]
23+
CAC[scarb cache]
2124
NEW[scarb init/new]
2225
UPD[scarb add/rm/update]
26+
PUB[scarb package/publish]
2327
MET[scarb metadata]
2428
CMD[scarb commands]
2529
MAN[scarb manifest-path]
2630
end
2731
subgraph EXT_CMDS ["External subcommands system"]
2832
direction LR
2933
CAIRO_LS["Cairo Language Server"]
34+
CAIRO_RUN["scarb run"]
35+
SCARB_DOC["scarb doc"]
3036
SNFORGE["scarb test\n(can redirect to either snforge,\ncairo-test or other runner)"]
3137
end
3238
```
@@ -74,12 +80,14 @@ classDiagram
7480
- compilers
7581
}
7682
class CairoPluginRepository {
77-
- compiler macro plugins
83+
- built-in compiler macro plugins
7884
}
7985
class StarknetContractCompiler {
8086
}
8187
class LibCompiler {
8288
}
89+
class TestCompiler {
90+
}
8391
class Workspace~'c~ {
8492
+ members() Iter~Package~
8593
}
@@ -107,10 +115,12 @@ classDiagram
107115
+ String name
108116
+ VersionReq
109117
+ SourceId
118+
+ DepKind
110119
}
111120
class Target {
112121
+ TargetKind
113122
+ String name
123+
+ Optional group_id
114124
+ BTreeMap<String, *> params
115125
}
116126
class CompilationUnit {
@@ -144,6 +154,7 @@ classDiagram
144154
CompilationUnit ..> Target : is created from
145155
CodegenRepository *-- StarknetContractCompiler
146156
CodegenRepository *-- LibCompiler
157+
CodegenRepository *-- TestCompiler
147158
```
148159

149160
### Sources and the internal registry
@@ -158,15 +169,15 @@ classDiagram
158169
}
159170
class PathSource
160171
class GitSource
161-
class StandardLibSource
162-
class RegistrySource {
163-
<<Future>>
172+
class RegistrySource
173+
class StandardLibSource {
174+
/embedded/
164175
}
165176
166177
PathSource ..|> Source
167178
GitSource ..|> Source
168-
StandardLibSource ..|> Source
169179
RegistrySource ..|> Source
180+
StandardLibSource ..|> Source
170181
```
171182

172183
A _source_ is an object that finds and downloads remote packages based on names and versions.
@@ -176,10 +187,9 @@ There are various `Source` implementation for different methods of downloading p
176187
1. `PathSource` simply provides an ability to operate on packages from local file system.
177188
2. `GitSource` downloads packages from Git repositories.
178189
3. `RegistrySource` downloads packages from package registries.
190+
4. `StandardLibSource` unpacks packages embedded into the Scarb binary itself.
179191
4. And more...
180192

181-
**CURRENTLY ONLY PATH AND GIT SOURCES ARE IMPLEMENTED.**
182-
183193
The `Registry` object gathers all `Source` objects in a single mapping, and provides a unified interface for querying
184194
_any_ package, no matter of its source.
185195

@@ -202,9 +212,7 @@ internally.
202212

203213
### Lockfile
204214

205-
**THIS IS NOT IMPLEMENTED YET.**
206-
207-
TODO(mkaput): Write this section.
215+
See Scarb documentation.
208216

209217
## Scarb Compiler
210218

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

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

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

283292
### RootDatabase management within the compiler

0 commit comments

Comments
 (0)