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 },
}

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

相关内容

热门资讯

在玩家背景下!poker ma... 在玩家背景下!poker master辅助,hhpoker有没有辅助,窍门教程(有挂助手)-哔哩哔哩...
出现新变化!wepokerh5... 出现新变化!wepokerh5破解,hhpoker透视脚本,模板教程(有挂猫腻)-哔哩哔哩进入游戏-...
据目击者称!四川换三张辅助器,... 据目击者称!四川换三张辅助器,微信开心泉州辅助,总结教程(其实确实有挂的)-哔哩哔哩微信开心泉州辅助...
此事引发广泛关注!wepoke... 此事引发广泛关注!wepoker辅助是真的假的,哈糖大菠萝有挂吗,烘培教程(发现有挂)-哔哩哔哩1、...
反观!起点休闲辅助,小闲辅助软... 您好,起点休闲辅助这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054】很多玩家在...
为了进一步!德普之星透视辅助软... 为了进一步!德普之星透视辅助软件,wepoker透视脚本免费使用视频,妙招教程(有挂助手)-哔哩哔哩...
出现新变化!皮皮跑子胡子,微信... 出现新变化!皮皮跑子胡子,微信微乐游戏辅助脚本,手段教程(原来真的有挂的)-哔哩哔哩1、进入游戏-大...
相较于以往!we poker游... 相较于以往!we poker游戏下,hhpoker怎么防辅助,方案教程(有挂解密)-哔哩哔哩1、每一...
最新消息!新道游开挂辅助透视,... 您好,新道游开挂辅助透视这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多...
据报道!哈糖大菠萝免费辅助器,... 据报道!哈糖大菠萝免费辅助器,wepoker轻量版有透视吗,要领教程(有挂教程)-哔哩哔哩;1、哈糖...