alef 0.24.1

Opinionated polyglot binding generator for Rust libraries
Documentation
//! ProGuard rule emitters — consumer-facing keep rules plus an empty
//! module-internal rules file users can extend if they later add R8.

use crate::core::config::ResolvedCrateConfig;

use crate::backends::kotlin_android::naming::kotlin_package;

/// `consumer-rules.pro` — applied to every consumer of the published AAR.
/// We keep the generated wrapper classes wholesale so R8 doesn't strip the
/// public surface the bindings rely on.
pub fn emit_consumer(config: &ResolvedCrateConfig) -> String {
    let package = kotlin_package(config);
    format!(
        "# Generated by alef. Do not edit by hand.\n# Keep generated public API for consumers using R8/ProGuard.\n-keep class {package}.** {{ *; }}\n"
    )
}

/// `proguard-rules.pro` — empty module-internal rules. Consumers may opt in
/// to additional shrinking inside the library module itself.
pub fn emit_module() -> String {
    "# Generated by alef. Do not edit by hand.\n# Add project-specific ProGuard rules for this AAR module here.\n"
        .to_string()
}