Android Soong没有android.PathForSourceRelaxed和ctx.Config().BuildOSTarget。
创始人
2024-08-15 18:30:10
0

在Android Soong中,android.PathForSourceRelaxed和ctx.Config().BuildOSTarget都不是默认提供的函数或变量。然而,可以通过自定义函数和变量来实现相似的功能。以下是一个示例解决方法:

// 在build/soong/android/paths.go文件中,定义一个函数android.PathForSourceRelaxed
func PathForSourceRelaxed(ctx android.ModuleContext, paths ...string) android.Path {
    srcDir := android.PathForModuleSrc(ctx).String()
    return android.PathForOutput(ctx, strings.TrimPrefix(filepath.Join(srcDir, filepath.Join(paths...)), srcDir))
}

// 在build/soong/android/config.go文件中,定义一个函数BuildOSTarget
func (c Config) BuildOSTarget() string {
    // 根据具体需求,返回对应的BuildOSTarget
    return "android"
}

然后,你可以在Soong蓝图文件中使用这些自定义函数和变量:

// 在Android.bp文件中
// 使用自定义函数PathForSourceRelaxed
module {
    name: "my_module",
    srcs: ["src/my_file.cc"],
    relative_install_path: "my_module",
    installable: true,
    bazel_module: { bp2build_available: true },
}

// 使用自定义变量BuildOSTarget
cc_library {
    name: "my_lib",
    srcs: ["src/my_lib.cc"],
    host_supported: true,
    target: {
        android: {
            enabled: true,
        },
        linux_glibc: {
            enabled: true,
        },
        darwin: {
            enabled: true,
        },
        windows: {
            enabled: true,
        },
        "*": {
            enabled: false,
        },
    },
    bazel_module: { bp2build_available: true },
}

请注意,这只是一个示例解决方法,具体的实现可能因项目的具体需求而有所不同。

相关内容

热门资讯

更值得关注的是!wepoker... 更值得关注的是!wepoker怎么看牌型(透视)好像真的是有辅助软件(有挂秘诀)-哔哩哔哩1、实时w...
透视黑科技!hhpoker怎么... 透视黑科技!hhpoker怎么破解(透视)总是真的是有辅助安装(真的有挂)-哔哩哔哩1、首先打开hh...
透视私人局!hhpoker是正... 透视私人局!hhpoker是正规的吗(透视)确实存在有辅助下载(有挂功能)-哔哩哔哩1)hhpoke...
最终!哈糖大菠萝破解器(透视)... 最终!哈糖大菠萝破解器(透视)都是存在有辅助下载(有挂方式)-哔哩哔哩1、每一步都需要思考,不同水平...
透视规律!aa poker透视... 透视规律!aa poker透视软件(透视)总是是真的辅助工具(证实有挂)-哔哩哔哩aa poker透...
透视系统!wepoker辅助软... 您好,wepoker辅助软件价格这款游戏可以开挂的,确实是有挂的,需要了解加去威信【48527505...
目前!wepoker怎么设置盖... 目前!wepoker怎么设置盖牌(透视)好像真的是有辅助工具(真是有挂)-哔哩哔哩1、许多玩家不知道...
透视中牌率!hhpoker辅助... 透视中牌率!hhpoker辅助器(透视)本来存在有辅助插件(有挂存在)-哔哩哔哩一、hhpoker辅...
现有关情况通报如下!德扑HHp... 现有关情况通报如下!德扑HHpoker有挂吗(透视)都是有辅助安装(有挂解密)-哔哩哔哩1、超多福利...
今年以来!hhpoker的辅助... 今年以来!hhpoker的辅助是真的吗(透视)切实有辅助平台(有挂教学)-哔哩哔哩1、起透看视 hh...