func compile()

in Sources/XCRemoteCache/Commands/Prepare/CCWrapperBuilder.swift [61:88]


    func compile(to destination: URL, commitSha: String) throws {
        let compilationFile = fileManager.temporaryDirectory.appendingPathComponent("xccc.c")
        let compilationContent = buildWrapperSource(
            clangCommand: clangCommand,
            markerFilename: markerPath,
            commitSha: commitSha
        )
        fileManager.createFile(
            atPath: compilationFile.path,
            contents: compilationContent.data(using: .utf8),
            attributes: nil
        )
        infoLog("ClangWrapperBuilder compiles file at \(compilationFile).")
        // -O3: optimize for faster execution
        let args = [
            clangCommand,
            "-arch",
            "arm64",
            "-arch",
            "x86_64",
            "-O3",
            compilationFile.path,
            "-o",
            destination.path,
        ]
        let compilationOutput = try shell("xcrun", args, URL(fileURLWithPath: "").path, nil)
        infoLog("Clang compilation output: \(compilationOutput)")
    }