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
13 changes: 5 additions & 8 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,18 @@ pub enum ReleaseLevel {

#[derive(Subcommand, Debug)]
pub enum Commands {
/// Compile the project and freeze a new immutable version
/// Compile the project and record a new build
#[command(long_about = "\
Compile and validate every schema, then freeze the result into the project's \
content-addressable store (`.comline/`). The project version is bumped \
automatically to match the largest schema change since the last build \
(major for breaking changes, minor for new features, patch for tweaks).
content-addressable store (`.comline/`). A build is recorded under a \
pre-release version: the release it leads to and a count (`0.3.0-dev.2`). \
The release follows the largest change since the last release; \
`comline release` makes it.

Examples:
comline build
comline build --watch")]
Build {
/// Enable release optimizations (reserved; currently a no-op)
#[arg(short, long)]
release: bool,

/// Rebuild automatically when a schema or `config.idp` changes
#[arg(short, long)]
watch: bool,
Expand Down
12 changes: 4 additions & 8 deletions src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,17 @@ use crate::commands::{core_err, ensure_project};
use crate::ui;
use crate::watch;

pub fn run(work_dir: &Path, release: bool, watching: bool) -> Result<()> {
pub fn run(work_dir: &Path, watching: bool) -> Result<()> {
ensure_project(work_dir)?;

if watching {
watch::run(work_dir, "build", || build_once(work_dir, release))
watch::run(work_dir, "build", || build_once(work_dir))
} else {
build_once(work_dir, release)
build_once(work_dir)
}
}

fn build_once(work_dir: &Path, release: bool) -> Result<()> {
if release {
ui::note("--release is reserved and currently has no effect");
}

fn build_once(work_dir: &Path) -> Result<()> {
ui::step(format!("Building project{}", ui::at_path(work_dir)));
let spinner = ui::spinner("compiling schemas");
let result = build::build(work_dir);
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn run(cli: Cli) -> Result<()> {
};

match cli.command {
Commands::Build { release, watch } => commands::build::run(&work_dir, release, watch),
Commands::Build { watch } => commands::build::run(&work_dir, watch),
Commands::Check => commands::check::run(&work_dir),
Commands::Generate {
target,
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn freezes_an_initial_version() {

comline_cmd()
.current_dir(&project)
.args(["build", "--release"])
.arg("build")
.assert()
.success()
.stderr(predicate::str::contains("Project built"))
Expand Down
Loading