Skip to content

Commit 69a45ad

Browse files
committed
Fix extension and module name
1 parent 70447ae commit 69a45ad

5 files changed

Lines changed: 8918 additions & 8914 deletions

File tree

cli/src/commands.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub fn list_disabled_methods(json: bool) -> Result<()> {
263263
Err(_) => continue,
264264
};
265265

266-
scan_methods_in_file(&raw, entry.path(), &bindings_src, &enabled, &mut entries);
266+
scan_methods_in_file(&raw, entry.path(), &bindings_src, &enabled, &manifest.crate_ident(), &mut entries);
267267
}
268268

269269
entries.sort_by(|a, b| a.method.cmp(&b.method).then_with(|| a.class.cmp(&b.class)));
@@ -331,6 +331,7 @@ fn scan_methods_in_file(
331331
file: &std::path::Path,
332332
bindings_src: &std::path::Path,
333333
enabled: &BTreeSet<String>,
334+
crate_ident: &str,
334335
out: &mut Vec<MethodEntry>,
335336
) {
336337
let namespace = derive_namespace(file, bindings_src);
@@ -388,7 +389,7 @@ fn scan_methods_in_file(
388389
out.push(MethodEntry {
389390
method,
390391
class: class.clone(),
391-
path: format!("engage_il2cpp::{namespace}::{class}"),
392+
path: format!("{crate_ident}::{namespace}::{class}"),
392393
feature: feat.clone(),
393394
returns,
394395
args,

cli/src/manifest.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

cli/src/scan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'a> PathVisitor<'a> {
111111
let candidate: String = segments[..n].join("::");
112112

113113
// Matches either the canonical path or the short re-export form code
114-
// usually writes (engage_il2cpp::app::Fade). Record the canonical so it
114+
// usually writes (engage::app::Fade). Record the canonical so it
115115
// maps to a feature downstream.
116116
if let Some((canonical, _)) = self.manifest.resolve_path(&candidate) {
117117
let canonical = canonical.to_string();

0 commit comments

Comments
 (0)