The destination directory of the installApp task is set by the ApplicationPlugin using ‘into { … }’ instead of using convention mapping. This implies that destination directory set by build script may be overridden.
For instance, in a mutli-project if the root build script sets the destination directory of installApp tasks of sub-projects using:
allprojects {
tasks.matching({it.name == "installApp"}).all {
into "${rootProject.projectDir}/apps/${project.name}"
}
}
Then, the ‘all’ closure is executed when the application plugin adds the installApp task but before it sets the destination directory. So the destination directory sets by build script is overridden by ApplicationPlugin.
The ApplicationPlugin could be modified to replace line 91 from
installTask.into { project.file("${project.buildDir}/install/${pluginConvention.applicationName}") }
by
installTask.conventionMapping.destinationDir =
{ project.file("${project.buildDir}/install/${pluginConvention.applicationName}") }
I think this should solve the issue.
The workaround I use currently is to add evaluation dependencies from root project to its children.