pub fn emit() -> String {
r#"# Generated by alef. Do not edit by hand.
# Allow Gradle to auto-detect JDK installations on the build machine.
# The Foojay resolver plugin in settings.gradle.kts provides automatic
# JDK download capability when a requested version is not found locally.
org.gradle.java.installations.auto-detect=true
# Increase heap for large multi-project builds.
org.gradle.jvmargs=-Xmx4g
# Reuse task outputs across builds. This is what makes a repeated assembleDebug,
# the shape documentation snippet validation runs before every check, cheap
# instead of a full rebuild each time.
org.gradle.caching=true
# The configuration cache is not enabled by default: the generated
# buildAndroidJniLibs task reads gradle.taskGraph from onlyIf and writes to
# System.err, which the configuration cache rejects by failing the build. Enable
# it only after adapting that task.
# org.gradle.configuration-cache=true
"#
.to_string()
}
#[cfg(test)]
mod tests {
#[test]
fn the_build_cache_is_enabled_and_the_configuration_cache_is_left_opt_in() {
let properties = super::emit();
let settings: Vec<&str> = properties
.lines()
.map(str::trim)
.filter(|line| !line.is_empty() && !line.starts_with('#'))
.collect();
assert!(
settings.contains(&"org.gradle.caching=true"),
"the build cache must be enabled: {settings:?}"
);
assert!(
!settings
.iter()
.any(|line| line.starts_with("org.gradle.configuration-cache")),
"the configuration cache must not be an active setting: {settings:?}"
);
assert!(
properties.contains("# org.gradle.configuration-cache=true"),
"the configuration cache must still be documented as an opt-in"
);
}
#[test]
fn toolchain_auto_detection_and_the_heap_setting_survive() {
let properties = super::emit();
assert!(properties.contains("org.gradle.java.installations.auto-detect=true"));
assert!(properties.contains("org.gradle.jvmargs=-Xmx4g"));
}
}