def _create_buildfile_content(root, frameworks_subpath):
    """Creates the content of the generated build file

    Args:
        root: The root path where the BUILD.bazel file will be created
        frameworks_subpath: The path from the root where the frameworks are to be found
    """

    buildfile_content = []

    binaries_path = root
    for element in frameworks_subpath.split("/"):
        binaries_path = binaries_path.get_child(element)

    if binaries_path.exists:
        frameworks = [path for path in binaries_path.readdir() if str(path).endswith(".framework")]
        for framework in frameworks:
            new_content = """\
filegroup(
    name = "%s", 
    srcs = glob(["%s/%s/**/*"]),
    visibility = ["//visibility:public"],
)\
            """ % (framework.basename.split(".framework")[0], frameworks_subpath, framework.basename)
            buildfile_content.append(new_content)

    return buildfile_content