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

binder_ndk_sys: Allow code to build inside a workspace #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MarijnS95
Copy link

CC @rsglobal for #9 (comment)

When this file is generated into target/, it might still think it belongs to a parent [workspace] crate and fail to compile:

   Compiling binder_ndk_sys v0.2.0 (binder_rs/binder_ndk_sys)
error: failed to run custom build command for `binder_ndk_sys v0.2.0 (binder_rs/binder_ndk_sys)`

Caused by:
  process didn't exit successfully: `my-hidl-crate/target/debug/build/binder_ndk_sys-a839da7d88e99ce9/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=src/BinderBindings.hpp
  cargo:rerun-if-changed=src/symbols.txt

  --- stderr
  error: current package believes it's in a workspace when it's not:
  current:   my-hidl-crate/target/aarch64-linux-android/debug/build/binder_ndk_sys-a3aef417509c2387/out/libbinder_ndk/Cargo.toml
  workspace: my-hidl-crate/Cargo.toml

  this may be fixable by ensuring that this crate is depended on by the workspace root: my-hidl-crate/Cargo.toml
  Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.

Follow the suggestion from cargo and turn the generated libbinder_ndk/Cargo.toml crate into a new workspace root.

This would have previously gone unnoticed as the invocation of cargo build did not check whether it had a nonzero exit code: this is now asserted on too.

We also revert commit 6627342 ("Fix build failed when used in workspace (#5)") which was working around the issue within this repository only, but that doesn't apply to users/consumers of this crate via i.e. crates.io.

When this file is generated into `target/`, it might still think it
belongs to a parent `[workspace]` crate and fail to compile:

       Compiling binder_ndk_sys v0.2.0 (binder_rs/binder_ndk_sys)
    error: failed to run custom build command for `binder_ndk_sys v0.2.0 (binder_rs/binder_ndk_sys)`

    Caused by:
      process didn't exit successfully: `my-hidl-crate/target/debug/build/binder_ndk_sys-a839da7d88e99ce9/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-changed=src/BinderBindings.hpp
      cargo:rerun-if-changed=src/symbols.txt

      --- stderr
      error: current package believes it's in a workspace when it's not:
      current:   my-hidl-crate/target/aarch64-linux-android/debug/build/binder_ndk_sys-a3aef417509c2387/out/libbinder_ndk/Cargo.toml
      workspace: my-hidl-crate/Cargo.toml

      this may be fixable by ensuring that this crate is depended on by the workspace root: my-hidl-crate/Cargo.toml
      Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.

Follow the suggestion from `cargo` and turn the generated
`libbinder_ndk/Cargo.toml` crate into a new workspace root.

This would have previously gone unnoticed as the invocation of `cargo
build` did not check whether it had a nonzero exit code: this is now
asserted on too.

We also revert commit 6627342 ("Fix build failed when used in workspace
(Kernel-SU#5)") which was working around the issue _within this repository
only_, but that doesn't apply to users/consumers of this crate via i.e.
crates.io.
@MarijnS95 MarijnS95 force-pushed the fix-workspace-build branch from 902226c to bf8a863 Compare November 5, 2024 14:11
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

Successfully merging this pull request may close these issues.

1 participant