71 lines
2.7 KiB
Kotlin
71 lines
2.7 KiB
Kotlin
|
|
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)
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------------------
|
||
|
|
// Escape hatch for abandoned pub plugins. Commented out on purpose -- turn it on only
|
||
|
|
// when a build actually fails, never speculatively.
|
||
|
|
//
|
||
|
|
// Symptom it fixes:
|
||
|
|
//
|
||
|
|
// Dependency 'androidx.something:1.2.3' requires libraries and applications that
|
||
|
|
// depend on it to compile against version 34 or later of the Android APIs.
|
||
|
|
// :some_plugin is currently compiled against android-31.
|
||
|
|
//
|
||
|
|
// A pub plugin that has not been republished in a couple of years still declares an old
|
||
|
|
// compileSdk, while the AndroidX artifacts it resolves to have moved on and now refuse to
|
||
|
|
// be consumed by it. You cannot fix that in the plugin: it lives in ~/.pub-cache, which is
|
||
|
|
// shared between users on this box, unversioned, invisible to git, and rewritten by the
|
||
|
|
// next `pub get`. Editing it there poisons every build on the machine and silently
|
||
|
|
// disappears. Force the value from here instead, where it is committed and reviewable.
|
||
|
|
//
|
||
|
|
// Reflection is used because AGP's types are not on the root build script classpath.
|
||
|
|
//
|
||
|
|
// NOTE: this block must be registered BEFORE evaluationDependsOn(":app") below, which
|
||
|
|
// evaluates subprojects eagerly -- registered after it, afterEvaluate throws
|
||
|
|
// "Cannot run Project.afterEvaluate(Action) when the project is already evaluated."
|
||
|
|
//
|
||
|
|
// The real fix is dropping or replacing the unmaintained plugin. This is a holding action.
|
||
|
|
//
|
||
|
|
// subprojects {
|
||
|
|
// afterEvaluate {
|
||
|
|
// val androidExt = extensions.findByName("android") ?: return@afterEvaluate
|
||
|
|
// runCatching {
|
||
|
|
// androidExt.javaClass
|
||
|
|
// .getMethod("setCompileSdkVersion", Int::class.javaPrimitiveType)
|
||
|
|
// .invoke(androidExt, 36)
|
||
|
|
// }
|
||
|
|
// runCatching {
|
||
|
|
// val defaultConfig = androidExt.javaClass
|
||
|
|
// .getMethod("getDefaultConfig")
|
||
|
|
// .invoke(androidExt)
|
||
|
|
// defaultConfig.javaClass
|
||
|
|
// .getMethod("setMinSdkVersion", Int::class.javaPrimitiveType)
|
||
|
|
// .invoke(defaultConfig, 24)
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// ---------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
subprojects {
|
||
|
|
project.evaluationDependsOn(":app")
|
||
|
|
}
|
||
|
|
|
||
|
|
tasks.register<Delete>("clean") {
|
||
|
|
delete(rootProject.layout.buildDirectory)
|
||
|
|
}
|