@@ -55,6 +55,8 @@ pub struct Vfox {
5555 pub cmd_env : Option < IndexMap < String , String > > ,
5656 /// Optional GitHub token for Lua http requests to GitHub API endpoints.
5757 pub github_token : Option < String > ,
58+ /// Optional runtime env type (`gnu` or `musl`) exposed to plugin hooks.
59+ pub runtime_env_type : Option < String > ,
5860 log_tx : Option < mpsc:: Sender < String > > ,
5961}
6062
@@ -123,7 +125,9 @@ impl Vfox {
123125 }
124126
125127 pub fn get_sdk ( & self , name : & str ) -> Result < Plugin > {
126- Plugin :: from_name_or_dir ( name, & self . plugin_dir . join ( name) )
128+ let mut plugin = Plugin :: from_name_or_dir ( name, & self . plugin_dir . join ( name) ) ?;
129+ plugin. runtime_env_type = self . runtime_env_type . clone ( ) ;
130+ Ok ( plugin)
127131 }
128132
129133 fn get_sdk_with_env ( & self , name : & str ) -> Result < Plugin > {
@@ -146,12 +150,16 @@ impl Vfox {
146150 // Check filesystem first - allows user to override embedded plugins
147151 let plugin_dir = self . plugin_dir . join ( sdk) ;
148152 if plugin_dir. exists ( ) {
149- return Plugin :: from_dir ( & plugin_dir) ;
153+ let mut plugin = Plugin :: from_dir ( & plugin_dir) ?;
154+ plugin. runtime_env_type = self . runtime_env_type . clone ( ) ;
155+ return Ok ( plugin) ;
150156 }
151157
152158 // Fall back to embedded plugin if available
153159 if let Some ( embedded) = crate :: embedded_plugins:: get_embedded_plugin ( sdk) {
154- return Plugin :: from_embedded ( sdk, embedded) ;
160+ let mut plugin = Plugin :: from_embedded ( sdk, embedded) ?;
161+ plugin. runtime_env_type = self . runtime_env_type . clone ( ) ;
162+ return Ok ( plugin) ;
155163 }
156164
157165 // Otherwise install from registry
@@ -175,7 +183,9 @@ impl Vfox {
175183 debug ! ( "Installing plugin {sdk}" ) ;
176184 xx:: git:: clone ( url. as_ref ( ) , & plugin_dir, & Default :: default ( ) ) ?;
177185 }
178- Plugin :: from_dir ( & plugin_dir)
186+ let mut plugin = Plugin :: from_dir ( & plugin_dir) ?;
187+ plugin. runtime_env_type = self . runtime_env_type . clone ( ) ;
188+ Ok ( plugin)
179189 }
180190
181191 pub fn uninstall_plugin ( & self , sdk : & str ) -> Result < ( ) > {
@@ -588,6 +598,7 @@ impl Default for Vfox {
588598 skip_verification : false ,
589599 cmd_env : None ,
590600 github_token : None ,
601+ runtime_env_type : None ,
591602 log_tx : None ,
592603 }
593604 }
@@ -615,6 +626,7 @@ mod tests {
615626 skip_verification : false ,
616627 cmd_env : None ,
617628 github_token : None ,
629+ runtime_env_type : None ,
618630 log_tx : None ,
619631 }
620632 }
0 commit comments