@@ -9,16 +9,18 @@ pub struct Manifest {
99 pub schema_version : u32 ,
1010 #[ serde( rename = "crate" ) ]
1111 pub crate_name : String ,
12+ #[ serde( default ) ]
13+ pub import : Option < String > ,
1214 #[ allow( dead_code) ]
1315 pub version : String ,
1416 pub paths : BTreeMap < String , String > ,
1517 pub dependencies : BTreeMap < String , Vec < String > > ,
1618 #[ serde( skip) ]
1719 pub ext_wrappers : BTreeMap < String , Vec < String > > ,
1820 /// Short re-export path -> canonical path. Types live at
19- /// `engage_il2cpp ::<ns>::<module>::<Type>` but the generated `<ns>` module
21+ /// `engage ::<ns>::<module>::<Type>` but the generated `<ns>` module
2022 /// re-exports them one level up (the `pub use <module>::{Type}` lines in
21- /// app.rs etc), so code usually imports the short `engage_il2cpp ::<ns>::<Type>`.
23+ /// app.rs etc), so code usually imports the short `engage ::<ns>::<Type>`.
2224 /// This maps that short form back so the scanner recognizes it.
2325 #[ serde( skip) ]
2426 pub reexports : BTreeMap < String , String > ,
@@ -50,16 +52,16 @@ impl Manifest {
5052 }
5153
5254 pub fn crate_ident ( & self ) -> String {
53- self . crate_name . replace ( '-' , "_" )
55+ self . import . as_ref ( ) . unwrap_or ( & self . crate_name ) . replace ( '-' , "_" )
5456 }
5557
5658 pub fn paths_with_leaf ( & self , leaf : & str ) -> Vec < ( & String , & String ) > {
5759 self . paths . iter ( ) . filter ( |( path, _) | path. split ( "::" ) . last ( ) == Some ( leaf) ) . collect ( )
5860 }
5961
6062 /// Resolve a path as written in code to its (canonical path, gating feature).
61- /// Accepts the canonical path itself (engage_il2cpp ::app::fade::Fade) or the
62- /// short re-export form code usually writes (engage_il2cpp ::app::Fade), and
63+ /// Accepts the canonical path itself (engage ::app::fade::Fade) or the
64+ /// short re-export form code usually writes (engage ::app::Fade), and
6365 /// always hands back the canonical one so callers agree on a single key.
6466 /// Returns None if the path names no known engage type. This is the one place
6567 /// that knows about re-exports, so both the scanner and the prune import check
@@ -97,8 +99,8 @@ impl Manifest {
9799}
98100
99101/// Invert the namespace-root re-exports: for each canonical
100- /// `engage_il2cpp ::<ns>::<module>::<Type>`, the `<ns>` module re-exports it as
101- /// `engage_il2cpp ::<ns>::<Type>`, so drop the module segment (second to last) to
102+ /// `engage ::<ns>::<module>::<Type>`, the `<ns>` module re-exports it as
103+ /// `engage ::<ns>::<Type>`, so drop the module segment (second to last) to
102104/// get the short form code actually imports. A real `pub use` at one level can't
103105/// name two types the same way, so if two canonicals ever collapse to the same
104106/// short form we drop it rather than guess.
0 commit comments