Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 70 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ eyre = "0.6.8"
# needs real I/O (git fetch, filesystem), so it's off by default for
# `comline-core`'s wasm32 consumers (the playground editor, the language
# server); the CLI is the one consumer that actually runs `comline build`.
comline-core = { git = "https://github.com/ComlineProject/core", rev = "98d64faedfc48ab4d2c93722e2b099debedd503c", features = ["deps"] }
comline-core = { git = "https://github.com/ComlineProject/core", rev = "2ae998634bad418e4a03ce7494e673275dafcc01", features = ["deps"] }
# All three pinned to revs that agree on one `comline-codegen`, and bumped
# together: comline-rust and comline-typescript's codegen crates consume
# `comline-codegen`'s types, so the rev below must be byte-identical to the
# one *they* pin - Cargo only unifies a git dependency across identical rev
# strings, and two copies of `GenRequest` are two incompatible types.
comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "b116831182c32e70fb4452ff9fce4b463ce4bd99" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "0e5c60ebdfab9cd172f23691a18084d651bfb33a", optional = true }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "765fc2d1177d0044498b00160000ac5084540af2", optional = true }
comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "de7ceb4c266d1fb5d6dc3c918d84cb226003f6b6" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "5346678b82fc275fca741bf5ca0cfad1e8edf075", optional = true }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "c2096cd500f7cd3a83d495fbbbf5df72bc12ecc7", optional = true }
# `comline conformance`: the conformance runner (corpus loading, judging,
# profile proofs) and its case format, a public spec. Pinned by git rev.
comline-runtime-conformance = { git = "https://github.com/ComlineProject/runtime", rev = "6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" }
Expand Down
16 changes: 15 additions & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ none, from `code_generation.languages` in `config.idp`.
[generate]
out = "generated" # output root, relative to comline.toml
layout = "{{language}}/{{namespace}}.{{ext}}" # path of each file under the root
mode = "code" # code | lib | dylib (only `code` today)
mode = "code" # code (loose source) | lib (a buildable package)
external_std = false # reference comline_std instead of inlining it (rust only)
package_versions = "latest" # latest | all | ["0.3.0", "0.4.0"]

Expand All @@ -248,6 +248,20 @@ out = "src/generated"
variables: `{{language}}`, `{{namespace}}` (`/`-joined), `{{ext}}`,
`{{lang_version}}`, `{{spec_version}}`, `{{package_version}}`.

**Editor support.** `comline.toml` has a JSON Schema, generated from the
same types `comline generate` parses it with, at
`https://comlineproject.github.io/docs/schemas/comline-toml/0.x.json`. A
`comline new` project's `comline.toml` starts with a line naming it:

```toml
#:schema https://comlineproject.github.io/docs/schemas/comline-toml/0.x.json
```

It's a TOML comment, so `comline` ignores it; editors using Taplo (Even
Better TOML in VS Code) read it, and complete keys, describe them, and flag
an unknown key or a wrong value (`mode = "dylib"`) as you type. Add the line
to an existing `comline.toml` to get the same.

**`layout` only applies to `code` mode.** A `lib`-mode target ignores it
entirely (`comline generate` warns if you set one) and always writes the
crate's fixed internal shape (`Cargo.toml`, `src/lib.rs`, …) at
Expand Down
3 changes: 2 additions & 1 deletion src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ use comline_core::package::config::ir::frozen::FrozenUnit as ConfigUnit;
use miette::{IntoDiagnostic, Result, WrapErr};

use crate::commands::ensure_project;
use crate::gen_config::{self, ComlineToml, DeclaredLang, Overrides};
use crate::gen_config::Destination;
use crate::ui;
use comline_codegen::config::{self as gen_config, ComlineToml, DeclaredLang, Overrides};

pub fn run(work_dir: &Path, dry_run: bool) -> Result<()> {
ensure_project(work_dir)?;
Expand Down
5 changes: 4 additions & 1 deletion src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ use miette::{miette, IntoDiagnostic, Result, WrapErr};

use crate::commands::{core_err, ensure_project};
use crate::external::{self, External};
use crate::gen_config::{self, ComlineToml, DeclaredLang, Overrides, VersionSpec};
use crate::gen_config::Destination;
use crate::lang_targets::{self, TargetError};
use crate::{history, ui, watch};
use comline_codegen::config::{
self as gen_config, ComlineToml, DeclaredLang, Overrides, VersionSpec,
};

/// The generator registry, composed from the per-language `comline-codegen-*`
/// crates this CLI was built with — one `register()` per crate, each behind its
Expand Down
1 change: 1 addition & 0 deletions src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const GITIGNORE: &str = "\
/// only says where each lands. Everything here is commented by default, so a
/// new project writes to `generated/{{language}}/{{namespace}}.{{ext}}`.
const COMLINE_TOML: &str = "\
#:schema https://comlineproject.github.io/docs/schemas/comline-toml/0.x.json
# comline.toml — where `comline generate` writes code, and how.
#
# Which languages are generated comes from `config.idp`'s
Expand Down
2 changes: 1 addition & 1 deletion src/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use miette::{miette, Result};

/// How long one call to a generator may take, unless the target sets
/// `timeout` (in seconds).
pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(60);
pub const DEFAULT_TIMEOUT: Duration = comline_codegen::config::DEFAULT_TIMEOUT;
/// The most a generator may write to stdout: one encoded response.
pub const STDOUT_CAP: usize = 256 * 1024 * 1024;
/// The most generated file contents one response may carry, all files
Expand Down
Loading
Loading