Closed matecode closed 3 years ago
If someone is interested, at the moment i ended up with this (in android block). I'm not a gradle/groovy expert, hence i didn't get the change to kotlin for gradle yet. If anyone wants to suggest a better solution, feel free!
applicationVariants.all { variant ->
//Find publishApk task for variant
def publishApkVariantTaskName = "publish${variant.name.capitalize()}Apk"
def publishApkVariantTask = project.tasks.findByName(publishApkVariantTaskName)
if (publishApkVariantTask != null) {
//Create publishTasks to publish buildTypes for ci pipelines
def buildType = variant.buildType.name
def publishApkBuildTypeTaskName = "publish${buildType.capitalize()}Apk"
def publishApkBuildTypeTask = project.tasks.findByName(publishApkBuildTypeTaskName)
if (publishApkBuildTypeTask == null) {
publishApkBuildTypeTask = project.tasks.create(name: publishApkBuildTypeTaskName, group: "publishing")
}
publishApkBuildTypeTask.dependsOn(publishApkVariantTask)
}
}
I'll have to think about this a bit. Basically I'm worried about creating an insane amount of tasks.
Thank you for your reply @SUPERCILEX .
I just had the idea that maybe it could be an option on play block scope to activate the extra task, so everything stays for the normal use case as it is, but it is possible to "activate" the additional build type tasks
play {
enableBuildTypeTasks.set(true)
}
It looks like the Android plugin does this for their tasks, so we may as well.
Problem description
I have a whitelabel app running with one dimension flavours in combination with buildtypes. I want to publish a dedicated buildtype, e.g buidltypes given:
dev, staging, release
where i have 3 pipelines in my CI system, so i want to call
publishDevApk publishStagingApk publishReleaseApk
Potential solutions/workarounds
please priovde a task wich "summarize" all publish_FLAVOR_BUILDTYPE tasks
Additional context
For me it is not possible to achieve this with playConfig