@@ -3,14 +3,15 @@ use std::{
33 path:: { Component , Path , PathBuf } ,
44} ;
55
6- use anyhow:: { Context , Result } ;
6+ use anyhow:: { bail , Context , Result } ;
77use globset:: { Glob , GlobSet , GlobSetBuilder } ;
88
99use crate :: { app:: AppConfig , views:: config:: DEFAULT_WATCH_PATTERNS } ;
1010
1111#[ derive( Default , Clone , serde:: Deserialize ) ]
1212#[ serde( default ) ]
1313pub struct ProjectConfig {
14+ pub min_version : Option < String > ,
1415 pub custom_make : Option < String > ,
1516 pub target_dir : Option < PathBuf > ,
1617 pub base_dir : Option < PathBuf > ,
@@ -121,6 +122,14 @@ pub fn load_project_config(config: &mut AppConfig) -> Result<()> {
121122 } ;
122123 if let Some ( result) = try_project_config ( project_dir) {
123124 let project_config = result?;
125+ if let Some ( min_version) = & project_config. min_version {
126+ let version_str = env ! ( "CARGO_PKG_VERSION" ) ;
127+ let version = semver:: Version :: parse ( version_str) . unwrap ( ) ;
128+ let version_req = semver:: VersionReq :: parse ( & format ! ( ">={min_version}" ) ) ?;
129+ if !version_req. matches ( & version) {
130+ bail ! ( "Project requires objdiff version {} or higher" , min_version) ;
131+ }
132+ }
124133 config. custom_make = project_config. custom_make ;
125134 config. target_obj_dir = project_config. target_dir . map ( |p| project_dir. join ( p) ) ;
126135 config. base_obj_dir = project_config. base_dir . map ( |p| project_dir. join ( p) ) ;
0 commit comments