def METHOD_NAME(target, ctx):
    java_info = target[JavaInfo]
    tags = getattr(ctx.rule.attr, "tags", [])
    deps = getattr(ctx.rule.attr, "deps", [])
    exports = getattr(ctx.rule.attr, "exports", [])
    rt_deps = getattr(ctx.rule.attr, "runtime_deps", [])
    all_deps = deps + exports + rt_deps
    if "maven:compile_only" in tags:
        return MavenInfo(
            coordinates = None,
            maven_deps = depset(),
            artifact_jars = depset(),
            source_jars = depset(),
            transitive_maven_deps = depset(),
            transitive_runtime_jars = depset(),
        )
    # Find all the deps that have coordinates
    all_infos = [dep[MavenInfo] for dep in all_deps if MavenInfo in dep]
    maven_deps = depset([], transitive = [info.transitive_maven_deps for info in all_infos])
    # Because of the way that maven works, if a rule has maven coordinates,
    # it's enough to set set the transitive deps to just be the rule for
    # anything that depends upon it. Otherwise, gather them up, and carry on
    # as if nothing really mattered.
    coordinate = read_coordinates(tags)
    if coordinate:
        transitive_maven_deps = depset([coordinate])
    else:
        transitive_maven_deps = depset(transitive = [info.transitive_maven_deps for info in all_infos])
    artifact_jars = depset(java_info.runtime_output_jars, transitive = [info.artifact_jars for info in all_infos if not info.coordinates])
    source_jars = depset(java_info.source_jars, transitive = [info.source_jars for info in all_infos if not info.coordinates])
    infos = []
    if JavaModuleInfo in target:
        info = MavenInfo(
            coordinates = coordinate,
            maven_deps = maven_deps,
            artifact_jars = depset(target[JavaInfo].runtime_output_jars),
            source_jars = depset(target[JavaInfo].source_jars),
            transitive_maven_deps = transitive_maven_deps,
            transitive_runtime_jars = depset(target[JavaInfo].transitive_runtime_jars.to_list(), transitive = [info.transitive_runtime_jars for info in all_infos]),
        )
    else:
        info = MavenInfo(
            coordinates = coordinate,
            maven_deps = maven_deps,
            artifact_jars = artifact_jars,
            source_jars = source_jars,
            transitive_maven_deps = transitive_maven_deps,
            transitive_runtime_jars = depset(target[JavaInfo].transitive_runtime_jars.to_list(), transitive = [info.transitive_runtime_jars for info in all_infos]),
        )
    infos.append(info)
    return infos