[英]How to add relative path for srcs :[] in android.bp file
I m using androidmk tool to convert Android.mk files to Android.bp at many places we have Android.mk chanining so it produces relative path for srcs:[], but its not working with Android.bp build.我在很多地方使用 androidmk 工具将 Android.mk 文件转换为 Android.bp,我们有 Android.mk chanining,因此它生成 srcs:[] 的相对路径,但它不适用于 Android.bp 构建。 Throwing error : Path is outside directory: ../../XX.cpp
抛出错误:路径在目录之外:../../XX.cpp
srcs:[ "example1.cpp" "../../example2.cpp" --- error for this file ] srcs:[“example1.cpp”“../../example2.cpp”---此文件错误]
Path is outside directory:"../../example2.cpp"路径在目录之外:“../../example2.cpp”
This is not allowed in Soong
.这在
Soong
是不允许的。 You have to move your Android.bp
to a common parent folder so that it looks like this.您必须将您的
Android.bp
移动到一个公共的父文件夹,以便它看起来像这样。
srcs: ["a/b/example1.cpp", "example2.cpp"]
We don't allow references outside of the current directory and its subdirectories in Soong我们不允许在 Soong 中的当前目录及其子目录之外进行引用
There are two ways to overcome to resolve the above issue.有两种方法可以克服以解决上述问题。
Define the below code in parent or root dir:在父目录或根目录中定义以下代码:
filegroup {
name: "commaonfile",
srcs: ["common/**/*.cpp"],
}
And use the filegroup in inner dirs where wants to use like below code:并在想要使用的内部目录中使用文件组,如下所示:
cc_binary {
name: "abc"
srcs: [
"src/a/b/abc.cpp"
":commaonfile"
],
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.