unity-ads-android/fatAar.gradle

39 строки
1.4 KiB
Groovy

def copyJarTask(String buildType) {
return tasks.create("copyJars${buildType}", Copy.class) {
from(tasks.getByName("bundleLibCompileToJar${buildType}"))
into("../unity-ads/libs/${buildType}/")
include('classes.jar')
rename('classes.jar', "${project.name}.jar")
}
}
static def tasksDependentOnScar(String buildType) {
return [
"copy${buildType}JniLibsProjectAndLocalJars",
"compile${buildType}Kotlin",
"merge${buildType}JavaResource",
"sync${buildType}LibJars",
"extract${buildType}Annotations",
"desugar${buildType}FileDependencies",
"dokkaJavadoc"
]
}
project.tasks.whenTaskAdded { Task theTask ->
{
["Release", "Debug"].each { buildType ->
{
if (theTask.name == "bundleLibCompileToJar${buildType}") {
if (project.name != "unity-ads") {
theTask.finalizedBy(copyJarTask("${buildType}"))
}
}
if (tasksDependentOnScar("${buildType}").any { theTask.name == it }) {
theTask.dependsOn(":unity-scaradapter-common:copyJars${buildType}")
theTask.dependsOn(":unity-scaradapter-2000:copyJars${buildType}")
theTask.dependsOn(":unity-scaradapter-2100:copyJars${buildType}")
}
}
}
}
}