As part of our release process we have some SDKs that need to be put into a separate folder in our release package. Currently this is done with a special function that is implemented like this:
ext.copyReleasable = { targetDir, testRuntime = false ->
def configuration = configurations.runtime
if (testRuntime)
{
configuration = configurations.testRuntime
}
copy {
from "$project.buildDir/signed"
into targetDir
}
def sandboxDir = project.rootDir.getAbsolutePath();
def deps = configuration.files { true }
deps.each {
def dependencyPath = it.getAbsolutePath();
if (dependencyPath.startsWith(sandboxDir)) {
dependencyPath = "${it.getParentFile().getParentFile()}/signed"
}
println dependencyPath
def destination = it.name.startsWith("foo-") || it.name.startsWith("bar-") ? targetDir : "$targetDir/libs"
copy {
from dependencyPath
into destination
}
}
}
We would prefer to have a proper task for this, one with proper inputs and outputs. But I run into the issue of not knowing the dependencies before dependency resolution has run, so I have no way of declaring the inputs and outputs.
Also please note that dependencies from our own code should be put into the target folder directly, while third part dependencies should end up in the lib folder. This is implemented in a somewhat hackish way, but it was the best we could come up with.
Can anyone help with this?