rules_android_ndk icon indicating copy to clipboard operation
rules_android_ndk copied to clipboard

Remove "ndk/"-prefixed include path compatibility workarounds

Open ahumesky opened this issue 3 years ago • 2 comments

With the way that the native version of android_ndk_repository structured / symlinked the NDK into bazel's external repository directory, the way to include things like cpu-features was

#include "ndk/sources/android/cpufeatures/cpu-features.h"

With the way the Starlark version of android_ndk_repository structures the NDK symlinks, the ndk/ prefix is not needed:

#include "sources/android/cpufeatures/cpu-features.h"

However this presents a migration issue for projects that use the native version of the rule, so a workaround was introduced to allow including the headers with the ndk/ prefix (by adding another symlink that results in the previous include path). We should migrate projects and remove this workaround.

ahumesky avatar Jan 11 '23 23:01 ahumesky

IMO, better to go a step further and migrate people to https://github.com/google/cpu_features. The only reason the NDK still ships its own is because we don't want to break existing builds that depend on it. If someone needs to put in effort to migrate, they might as well migrate to the new thing that's actually maintained (there's even an interface that's compatible with the old NDK one for use as a drop-in replacement: https://github.com/google/cpu_features/tree/main/ndk_compat)

DanAlbert avatar Jan 12 '23 01:01 DanAlbert

I wasn't aware of the separate cpu_features project -- I'll add a note about this! For now, some users are blocked from moving to the starlark version of android_ndk_repository because other projects aren't migrated to either https://github.com/google/cpu_features or non-ndk/-prefixed include paths (this is all pretty new so they're probably not even aware, and I'm sure we'll uncover other migration issues).

ahumesky avatar Jan 13 '23 00:01 ahumesky