[英]How do you set command line flags for d8 in a Bazel project?
For example if I wanted to set --min-api
to 26: https://r8.googlesource.com/r8/+/b9cb6ae34047f19320885d9e2c594f81364fa896/src/main/java/com/android/tools/r8/D8CommandParser.java#120例如,如果我想将
--min-api
设置为 26: https : --min-api
I've tried various .bazelrc
combinations with Bazel's -s
flag on to see the subcommands called with their flags and I don't see anything being added as I'd would like:我已经尝试了各种带有 Bazel 的
-s
标志的.bazelrc
组合,以查看使用其标志调用的子命令,但我没有看到任何添加的内容,因为我希望:
build:d8 --define=min-api=26
build:d8 --min-api=26
build:d8 --min-api 26
Ideally though this would be set somewhere in a BUILD file so it's configurable per target.理想情况下,这将设置在 BUILD 文件中的某个位置,因此它可以针对每个目标进行配置。
Unfortunately this doesn't seem possible.不幸的是,这似乎不可能。 Bazel uses
CompatDexBuilder
while we remove the remaining dex support code: Bazel 使用
CompatDexBuilder
而我们删除了剩余的 dex 支持代码:
https://github.com/bazelbuild/bazel/blob/d1ff8c2d15454444094f94765d4b57ce0232bb51/tools/android/BUILD.tools#L42 https://github.com/bazelbuild/bazel/blob/d1ff8c2d15454444094f94765d4b57ce0232bb51/tools/android/BUILD.tools#L42
and CompatDexBuilder
appears to hardcode the min api level:并且
CompatDexBuilder
似乎对最小 api 级别进行了硬编码:
https://r8.googlesource.com/r8/+/41d2ea5adff39b579b297219310199fd566e778b/src/main/java/com/android/tools/r8/compatdexbuilder/CompatDexBuilder.java#169 https://r8.googlesource.com/r8/+/41d2ea5adff39b579b297219310199fd566e778b/src/main/java/com/android/tools/r8/compatdexbuilder/CompatDexBuilder.java#169
H_MR2 corresponds to 13: H_MR2对应13:
https://r8.googlesource.com/r8/+/60e493f814cb2a37e3b02a30c09023c56b6d1bf9/src/main/java/com/android/tools/r8/utils/AndroidApiLevel.java#32 https://r8.googlesource.com/r8/+/60e493f814cb2a37e3b02a30c09023c56b6d1bf9/src/main/java/com/android/tools/r8/utils/AndroidApiLevel.java#32
I filed a github issue here: https://github.com/bazelbuild/bazel/issues/10556我在这里提交了一个 github 问题: https : //github.com/bazelbuild/bazel/issues/10556
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.