Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work for custom lib.rs filename #161

Open
ogoffart opened this issue Jan 5, 2024 · 1 comment
Open

Doesn't work for custom lib.rs filename #161

ogoffart opened this issue Jan 5, 2024 · 1 comment

Comments

@ogoffart
Copy link

ogoffart commented Jan 5, 2024

I'm using a custom filename in my Cargo.toml like so:

[lib]
crate-type = ["cdylib"]
path = "custom.rs"

Then, if i run x build --arch arm64 --platform android , i'd have an output like so:

[1/3] Fetch precompiled artifacts
info: component 'rust-std' for target 'aarch64-linux-android' is up to date
[1/3] Fetch precompiled artifacts [112ms]
[2/3] Build rust `my_app` [SKIPPED]
[3/3] Create apk [429ms]

It wouldn't build the app and just print [SKIPPED].
It took me a while to realize this is because I'm using a custom path and there is no src/lib.rs
Probably due to this check.

let has_lib = env.root_dir().join("src").join("lib.rs").exists();

I'm not quite sure why this check is there, but I would recommend checking the existence of a [lib] section in Cargo.toml as well.

@MarijnS95
Copy link
Member

@ogoffart indeed! I've previously solved this for cargo-apk (""deprecated"") in rust-mobile/cargo-subcommand#17 (including renames via name = ""), and am now mostly unhappy that xbuild has mostly copy-pasted older implementations rather than reusing that crate (or any other crate that parses/reflects a workspace). To the point that I don't feel like typing up the solutions for the second time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants