mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 18:29:35 +00:00
New translations multi-package-workspace.mdx (Russian)
[ci skip]
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
---
|
---
|
||||||
sidebar_label: Multi-package workspace
|
sidebar_label: Рабочая область с несколькими пакетами
|
||||||
---
|
---
|
||||||
|
|
||||||
# Multi-Package Workspace
|
# Рабочая область с несколькими пакетами
|
||||||
|
|
||||||
A project with three packages: two libraries and a binary.
|
Проект из трёх пакетов: библиотека, утилита и основной бинарник.
|
||||||
|
|
||||||
## Structure
|
## Структура
|
||||||
|
|
||||||
```
|
```
|
||||||
workspace/
|
workspace/
|
||||||
├── dcr.toml # root workspace
|
├── dcr.toml # корневой workspace
|
||||||
├── lib-core/
|
├── lib-core/
|
||||||
│ ├── dcr.toml
|
│ ├── dcr.toml
|
||||||
│ └── src/core.c
|
│ └── src/lib.rs
|
||||||
├── lib-utils/
|
├── lib-utils/
|
||||||
│ ├── dcr.toml
|
│ ├── dcr.toml
|
||||||
│ └── src/utils.c
|
│ └── src/utils.c
|
||||||
@@ -22,7 +22,7 @@ workspace/
|
|||||||
└── src/main.c
|
└── src/main.c
|
||||||
```
|
```
|
||||||
|
|
||||||
## Root dcr.toml
|
## Корневой dcr.toml
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[package]
|
[package]
|
||||||
@@ -33,22 +33,17 @@ type = "none"
|
|||||||
[build]
|
[build]
|
||||||
inherit = true
|
inherit = true
|
||||||
language = "c"
|
language = "c"
|
||||||
standard = "c11"
|
standard = "c17"
|
||||||
|
|
||||||
[workspace.lib-core]
|
[workspace]
|
||||||
path = "lib-core"
|
members = [
|
||||||
|
{ path = "lib-core" },
|
||||||
[workspace.lib-utils]
|
{ path = "lib-utils", deps = ["lib-core"] },
|
||||||
path = "lib-utils"
|
{ path = "app", deps = ["lib-core", "lib-utils"], main = true },
|
||||||
deps = ["lib-core"]
|
]
|
||||||
|
|
||||||
[workspace.app]
|
|
||||||
path = "app"
|
|
||||||
deps = ["lib-core", "lib-utils"]
|
|
||||||
main = true
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Packages
|
## Пакеты
|
||||||
|
|
||||||
`lib-core/dcr.toml`:
|
`lib-core/dcr.toml`:
|
||||||
|
|
||||||
@@ -56,7 +51,7 @@ main = true
|
|||||||
[package]
|
[package]
|
||||||
name = "lib-core"
|
name = "lib-core"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
type = "none"
|
type = "lib"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
kind = "staticlib"
|
kind = "staticlib"
|
||||||
@@ -68,7 +63,7 @@ kind = "staticlib"
|
|||||||
[package]
|
[package]
|
||||||
name = "lib-utils"
|
name = "lib-utils"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
type = "none"
|
type = "lib"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
kind = "staticlib"
|
kind = "staticlib"
|
||||||
@@ -80,23 +75,23 @@ kind = "staticlib"
|
|||||||
[package]
|
[package]
|
||||||
name = "app"
|
name = "app"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
type = "none"
|
type = "app"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
kind = "bin"
|
kind = "bin"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build
|
## Сборка
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd workspace
|
cd workspace
|
||||||
dcr build # builds everything in correct order
|
dcr build # собирает всё в правильном порядке
|
||||||
dcr build --workspace app # only app (lib-core and lib-utils built as deps)
|
dcr build --workspace app # только app (lib-core и lib-utils собираются как зависимости)
|
||||||
dcr run # builds and runs main package
|
dcr run # собирает и запускает main-пакет
|
||||||
```
|
```
|
||||||
|
|
||||||
Build order (topological sort):
|
Порядок сборки (топологическая сортировка):
|
||||||
|
|
||||||
1. `lib-core`
|
1. `lib-core`
|
||||||
2. `lib-utils` (depends on lib-core)
|
2. `lib-utils` (зависит от lib-core)
|
||||||
3. `app` (depends on lib-core, lib-utils)
|
3. `app` (зависит от lib-core, lib-utils)
|
||||||
|
|||||||
Reference in New Issue
Block a user