muzzle-velocity/android/build.gradle

45 lines
1.5 KiB
Groovy
Raw Normal View History

2025-02-20 22:40:41 +02:00
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
afterEvaluate { project ->
if (project.hasProperty("android")) {
project.android {
compileSdkVersion 36
}
}
}
2025-02-20 22:40:41 +02:00
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
plugins.withId('com.android.library') {
extensions.configure(com.android.build.gradle.LibraryExtension) { android ->
def manifestFile = android.sourceSets.main.manifest.srcFile
def packageName = null
if (manifestFile.exists()) {
def manifestContent = new XmlParser().parse(file(manifestFile))
packageName = manifestContent.@package
}
if (!android.hasProperty("namespace") || android.namespace == null || android.namespace.isEmpty()) {
if (packageName) {
println ">> Derived Namespace for: '${project.name}' to '${packageName}'"
android.namespace = packageName
} else {
def defaultNamespace = "com.example.${project.name}"
println "?? Made up Namespace for: '${project.name}' to '${defaultNamespace}'"
android.namespace = defaultNamespace
}
}
}
}
2025-02-20 22:40:41 +02:00
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}