allprojects { repositories { google() mavenCentral() } } val newBuildDir: Directory = rootProject.layout.buildDirectory .dir("../../build") .get() rootProject.layout.buildDirectory.value(newBuildDir) subprojects { val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) project.layout.buildDirectory.value(newSubprojectBuildDir) } subprojects { project.evaluationDependsOn(":app") } // ── Compiling maplibre_gl against the JDK we actually have ── // // `maplibre_gl` is the map engine behind the delivery line's screens (the // ported Xpress-rider flow under lib/xpress). Version 0.26.2 declares // `sourceCompatibility = 21`, and javac refuses a source release newer than the // JDK running the build: // // Execution failed for task ':maplibre_gl:compileDebugJavaWithJavac' // > error: invalid source release: 21 // // Flutter here is configured against JDK 17, so every build fails at that task // — including builds of the parcel line, which never loads a MapLibre map. // // The plugin's own sources are Java 8-compatible; 21 is the level it asks for, // not one it needs. So the level is lowered to 17 for this one subproject. // // Deliberately scoped by name rather than applied to every subproject: a blanket // override would silently change the bytecode target of ~20 unrelated plugins // that build fine today, to fix one that does not. // // The real fix is a JDK 21 toolchain (`flutter config --jdk-dir=...`). When this // machine and CI both have one, delete this block and let the plugin have the // level it asked for. // Both halves must move together: Kotlin and Java have to agree on a JVM target // or the Kotlin plugin fails the build itself ("Inconsistent JVM-target // compatibility"). Setting only the JavaCompile tasks is not enough either — // AGP writes `compileOptions` from the library extension after this file is // evaluated, so the override has to happen in `afterEvaluate` to land last. subprojects { if (name == "maplibre_gl") { afterEvaluate { extensions.findByName("android")?.let { ext -> ext.withGroovyBuilder { "compileOptions" { setProperty("sourceCompatibility", JavaVersion.VERSION_17) setProperty("targetCompatibility", JavaVersion.VERSION_17) } } } tasks.withType().configureEach { sourceCompatibility = JavaVersion.VERSION_17.toString() targetCompatibility = JavaVersion.VERSION_17.toString() } tasks.withType() .configureEach { compilerOptions.jvmTarget.set( org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17, ) } } } } tasks.register("clean") { delete(rootProject.layout.buildDirectory) }