ibuild

ibuild 是一个 iOS 库的构建系统,这些库的构建未使用 CMake 或 Make 等构建系统。

安装

要安装 ibuild,请使用 Homebrew

brew install IMcD23/brew/ibuild

使用

使用 ibuild 的典型工作流程如下:

  1. 在你的代码库根目录中创建一个 build.plist 文件。
  2. 将要构建的依赖项列表添加到 build.plist 中。
  3. 在你的 Xcode 项目中添加一个“外部构建系统”目标,指向 ibuild 二进制文件。

现在,当你使用 Xcode 构建时,ibuild 将确保 build.plist 中的所有依赖项都被构建。

你可以依赖的包

如果一个包在其根目录中定义了 build.plist,则可以通过将其添加到你的 build.plist 中的 dependencies 数组来简单地依赖它。一些包包括:

如果要构建另一个没有 build.plist 的包,则必须为该项目创建一个。 请遵循以上项目的示例。你可以使用 git 依赖包,或者依赖本地路径上的包。

build.plist 文件

以下是 build.plist 文件的模式。问号代表一个可选属性。

{
    # Display name of the package
    name: String

    build?: {

        # The location of the source code to build
        location?: {
            # Type of the location.
            # Values: github / git / local
            type: String

            # Required for GitHub and Local types.
            # Should be either "username/repo" or "path/to/package", respectively
            path?: String

            # Required for GitHub or Git types.
            # The name of the branch to check out.
            branch?: String

            # Required for Git type.
            # URL to pass to git clone.
            url?: String
        }

        # The build sytem to use when building.
        # Values: none / cmake / make / xcode / custom
        buildSystem: String

        # Package-relative patch files to apply to the
        # library's source code after retrieving.
        patches?: [String]

        # Arguments to pass when configuring / building
        buildArgs?: [String]

        # Additional arguments to pass, that depend on
        # platform and architecture
        buildArchSpecificArgs?: {
            <platform>: {
                <arch>: [String]
            }
        }

        # When building a `make` project, this command will
        # replace the `install` in `make install`.
        # Has no effect with other build systems
        installCommand?: String

        # Names of the libraries that are generated by
        # the build of the `library` property
        outputs?: [String]

        # Paths of source files in this package to also copy to final output directory.
        auxiliaryFiles?: {
            "package/path": "install/path"
        }

        # When the build system is "custom", these properties determine which commands to run.
        customProperties?: {
            configure?: String
            make?: String
            install?: String
            env?: {
                "key": "value"
            }
        }
    }

    # Dependencies of this package
    dependencies?: [
        {
            # Type of the location.
            # Values: github / git / local
            type: String

            # Required for GitHub and Local types.
            # Should be either "username/repo" or "path/to/package", respectively
            path?: String

            # Required for GitHub or Git types.
            # The name of the branch to check out.
            branch?: String

            # Required for Git type.
            # URL to pass to git clone.
            url?: String
        }
    ]
}

llbuild 任务层次结构

PackageTask(location)
    DownloadPackageLocationTask(location)

    PackageDependenciesTask([location])
        PackageTask(location)

    BuildPackageTask(Package)
        DownloadPackageLocationTask(location) // build location
        BuildTask(Package)
            BuildArchitectureTask(Package, architecture)
        CopyHeadersAndMetadataTask(Package)
        LipoTask(Package)

文件夹层次结构

.ibuild
    build.db
    build
        Products
            lib
            include
            Framework.framework
        Intermediates
            uuid
                arch
                    build
                        lib
                        include
                        Framework.framework
                    configure
                        ...
    checkout
        uuid
            <repo>