def METHOD_NAME(target, ctx):
    if JavaInfo not in target or not hasattr(ctx.rule.attr, "srcs"):
        return None
    javac_action = None
    for a in target.actions:
        if a.mnemonic == _mnemonic:
            javac_action = a
            break
    if not javac_action:
        return None
    owner = str(target.label)
    kzip = ctx.actions.declare_file(ctx.label.name + ".xa.java.kzip")
    info = target[JavaInfo]
    compilation = info.compilation_info
    annotations = info.annotation_processing
    source_files = []
    for src in ctx.rule.files.srcs:
        source_files.append(src.path)
    classpath = [j.path for j in compilation.compilation_classpath.to_list()]
    bootclasspath = [j.path for j in compilation.boot_classpath]
    processorpath = []
    processors = []
    if annotations and annotations.enabled:
        processorpath += [j.path for j in annotations.processor_classpath.to_list()]
        processors = annotations.processor_classnames
    output_jar = [jar.class_jar.path for jar in info.outputs.jars]
    if len(output_jar) > 1:
        print("WARNING: multiple outputs for " + owner + ": " + str(output_jar))
        output_jar = [output_jar[0]]
    xa = struct(**{
        "owner": owner,
        "mnemonic": _mnemonic,
        "[blaze.JavaCompileInfo.java_compile_info]": struct(
            outputjar = output_jar,
            classpath = classpath,
            source_file = source_files,
            javac_opt = compilation.javac_options,
            processor = processors,
            processorpath = processorpath,
            bootclasspath = bootclasspath,
        ),
    })
    text_xa = ctx.actions.declare_file(ctx.label.name + ".xa.textproto")
    ctx.actions.write(
        output = text_xa,
        content = xa.to_proto(),
    )
    xa = ctx.actions.declare_file(ctx.label.name + ".xa")
    xa_args = ctx.actions.args()
    xa_args.add_all([text_xa, xa])
    ctx.actions.run(
        outputs = [xa],
        inputs = [text_xa],
        arguments = [xa_args],
        executable = ctx.executable._write_extra_action,
        toolchain = None,
    )
    extract_args = ctx.actions.args()
    extract_args.add_all([xa, kzip, ctx.file._java_aspect_vnames_config])
    deps = [javac_action.inputs, annotations.processor_classpath]
    ctx.actions.run(
        outputs = [kzip],
        inputs = depset([xa, ctx.file._java_aspect_vnames_config], transitive = deps),
        executable = ctx.executable._java_bazel_extractor,
        arguments = [extract_args],
        tools = ctx.attr._java_runtime[java_common.JavaRuntimeInfo].files,
        toolchain = None,
    )
    return kzip