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
14 changes: 7 additions & 7 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ 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 = "35ab4b801c9b35af591fb48972407468c8e8af24", features = ["deps"] }
comline-core = { git = "https://github.com/ComlineProject/core", rev = "263e58378bb7efcaa466542ca644228ad14e2884", 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 = "0977d7a339e92ced0ebaac477a0f6b3c1104c680" }
comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "3ad2c79f48242f7de4bed3e8bc23c5673a381a2e" }
# The official Markdown and HTML documentation renderers (`comline doc`),
# linked in like the official generators. Same generation rev as
# `comline-codegen`.
comline-doc-markdown = { git = "https://github.com/ComlineProject/generation", rev = "0977d7a339e92ced0ebaac477a0f6b3c1104c680" }
comline-doc-html = { git = "https://github.com/ComlineProject/generation", rev = "0977d7a339e92ced0ebaac477a0f6b3c1104c680" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "6405b44d1b49d5926ba6519c46eac84bd5467962", optional = true }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "9496b1e9f158029a18e4db9435f5944f501b30cb", optional = true }
comline-doc-markdown = { git = "https://github.com/ComlineProject/generation", rev = "3ad2c79f48242f7de4bed3e8bc23c5673a381a2e" }
comline-doc-html = { git = "https://github.com/ComlineProject/generation", rev = "3ad2c79f48242f7de4bed3e8bc23c5673a381a2e" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "349763589f16fcee43a9b8bc3e2d9af8674fef00", optional = true }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "20bad456df0334b0197ddefdc1460f96c7ff33ae", 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 = "3b9cc9dc53a83fb2830d91b267bd5f477f0a1e51" }
Expand Down
2 changes: 1 addition & 1 deletion src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use miette::Result;

use crate::bounds_migration;
use crate::changes;
use crate::commands::generate::generator_registry;
use crate::commands::generation::generator_registry;
use crate::commands::{core_err, ensure_project};
use crate::lang_targets;
use crate::ui;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn generated_files_for(work_dir: &Path, target: Option<&str>) -> Result<Vec<Path
None => Vec::new(),
};

let registry = super::generate::generator_registry();
let registry = super::generation::generator_registry();
let mut files = Vec::new();
for t in &targets {
// A dedicated output directory: remove it wholesale (stale files too).
Expand Down
63 changes: 46 additions & 17 deletions src/commands/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ use comline_core::doc::{self, ChangelogSpan, DocModel, FrozenDocs, DOC_MODEL_VER
use comline_core::package::build::cas::objects::{Commit, Tree};
use comline_core::package::build::cas::refs;
use comline_core::package::build::cas::storage::Hash;
use comline_core::package::config::ir::frozen::FrozenUnit as ConfigUnit;
use comline_core::package::config::ir::context::ProjectContext;
use comline_core::package::config::ir::frozen::cas::blob::StoredConfigs;
use comline_core::schema::ir::frozen::unit::FrozenUnit;
use miette::{miette, IntoDiagnostic, Result, WrapErr};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -96,8 +97,9 @@ struct Version {
model: DocModel,
/// Its own frozen schemas: not its dependencies' or `std`'s.
schemas: Vec<Vec<FrozenUnit>>,
/// Its frozen config, whose `wire` its changelogs are measured under.
config: Vec<ConfigUnit>,
/// Its frozen configs, own and its dependencies': the `wire` and the
/// encodings its changelogs are measured under.
configs: StoredConfigs,
/// The commits its changelogs are computed from, for the cache key.
changelog_from: Vec<Hash>,
/// What its documentation lacks.
Expand Down Expand Up @@ -217,12 +219,12 @@ pub fn run(work_dir: &Path, flags: Flags) -> Result<()> {
let commit = history::resolve(&history, from)?;
let store = history::open_store(work_dir)?;
let old = history::load_schemas(&store, commit)?;
let old_config = history::load_config(&store, commit)?;
version.model.changelog.push(doc::changelog(
let old_configs = history::load_stored_configs(&store, commit)?;
version.model.changelog.push(changelog(
&commit.version,
(&old, &old_config),
(&old, &old_configs),
&version.id,
(&version.schemas, &version.config),
(&version.schemas, &version.configs),
));
}
let first = document_one(&out, &formats, &renderers, &cfg, version)?;
Expand Down Expand Up @@ -616,7 +618,7 @@ fn every_version(work_dir: &Path, select: Option<&DocVersions>) -> Result<Vec<Ve
commit: None,
model: doc::model(&context, None),
schemas,
config: doc::frozen_config(&context),
configs: compiled_configs(&context),
changelog_from: vec![],
notes: vec![],
});
Expand All @@ -639,11 +641,11 @@ fn every_version(work_dir: &Path, select: Option<&DocVersions>) -> Result<Vec<Ve
};
if let Some(span) = span {
let release = &versions[r];
let mut log = doc::changelog(
let mut log = changelog(
&release.id,
(&release.schemas, &release.config),
(&release.schemas, &release.configs),
&version.id,
(&version.schemas, &version.config),
(&version.schemas, &version.configs),
);
log.span = span;
since_release[i] = Some((log, release.commit));
Expand Down Expand Up @@ -681,11 +683,11 @@ fn every_version(work_dir: &Path, select: Option<&DocVersions>) -> Result<Vec<Ve
let mut out: Vec<Version> = Vec::with_capacity(versions.len());
for (mut version, since) in versions {
if let Some(previous) = out.last() {
let step = doc::changelog(
let step = changelog(
&previous.id,
(&previous.schemas, &previous.config),
(&previous.schemas, &previous.configs),
&version.id,
(&version.schemas, &version.config),
(&version.schemas, &version.configs),
);
version.model.changelog = vec![step];
version.changelog_from.extend(previous.commit);
Expand All @@ -707,6 +709,33 @@ fn kind_of(version: &str) -> (VersionKind, String) {
}
}

/// What a compiled package's changelogs are measured under: its own config and
/// its dependencies', all of which a compile has.
fn compiled_configs(context: &ProjectContext) -> StoredConfigs {
StoredConfigs {
own: doc::frozen_config(context),
own_stored: true,
dependencies: context.dependency_configs.clone(),
unstored: vec![],
}
}

/// What changed from one version to the next, each given as its frozen schemas
/// and configs, the encodings read from the configs.
fn changelog(
from: &str,
old: (&[Vec<FrozenUnit>], &StoredConfigs),
to: &str,
new: (&[Vec<FrozenUnit>], &StoredConfigs),
) -> doc::Changelog {
doc::changelog(
from,
(old.0, &old.1.own, &old.1.encodings()),
to,
(new.0, &new.1.own, &new.1.encodings()),
)
}

/// `--version`'s one built version.
fn frozen_version(work_dir: &Path, spec: &str) -> Result<Version> {
let history = history::load(work_dir)?;
Expand All @@ -726,10 +755,10 @@ fn frozen(work_dir: &Path, hash: Hash, commit: &Commit) -> Result<(Version, Froz
let store = history::open_store(work_dir)?;
// Every compiled schema: the package's own, its dependencies' and std's.
let all_schemas = history::load_schemas(&store, commit)?;
let config = history::load_config(&store, commit)?;
let configs = history::load_stored_configs(&store, commit)?;
// A built version's config doesn't always freeze the package's name;
// the working tree's is the same unless the package was renamed.
let name = comline_core::package::config::ir::frozen::namespace(&config)
let name = comline_core::package::config::ir::frozen::namespace(&configs.own)
.map(str::to_string)
.or_else(|| {
comline_core::package::build::compile_package_without_fetching(work_dir)
Expand Down Expand Up @@ -791,7 +820,7 @@ fn frozen(work_dir: &Path, hash: Hash, commit: &Commit) -> Result<(Version, Froz
commit: Some(hash),
model,
schemas,
config,
configs,
changelog_from: vec![],
notes,
},
Expand Down
Loading
Loading