美文网首页
Bazel-创建静态framework

Bazel-创建静态framework

作者: 西博尔 | 来源:发表于2021-04-13 17:28 被阅读0次
    Bazel 生成静态Framework , 并且打包一个Bundle资源文件

    BUILD文件

    load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework")
    load("@build_bazel_rules_apple//apple/internal/resource_rules:apple_resource_bundle.bzl", "apple_resource_bundle")
    
    ios_static_framework( #生成静态framework, 如果用ios_framework生成的是动态库
        name = "test_framework",
        families = [
            "iphone",
        ],
        minimum_os_version = "9.0",
        deps = [
            ":static_lib",
        ],
        bundle_name = "TestStatic",
        hdrs = ["universal/TestStaticFramework.h"]
    )
    
    objc_library(
        name = "static_lib",
        srcs = ["universal/TestStaticFramework.m"],
        hdrs = glob([
            "universal/TestStaticFramework.h"
            ]),
        data = [
            ":static_bundle",
        ],
    )
    
    
    #创建bundle资源文件, 资源文件包含一张图片
    apple_resource_bundle(
        name = "static_bundle",
        resources = [":222.jpg"],
    )
    
    

    编译

    bazel build //universal:test_framework

    最后结果

    image.png

    相关文章

      网友评论

          本文标题:Bazel-创建静态framework

          本文链接:https://www.haomeiwen.com/subject/kwyclltx.html