OK, this one is still kicking my butt. Not sure how to handle it.
Another case of making hard things easy but easy things hard.
Conceptually my file spec is simple:
every rpm file under the parent project directory.
First of all I can’t specify something like project.parent.projectDir in a copy spec because the closure refuses to evaluate it and I get an error like this:
Could not find method parentDir() for arguments [com.att.voicetone.gradle.plugins.BundlerTask$_applyBundleDefinition_closure1$_closure4@3484f140] on task ':bundle:bundle'.
So that doesn’t work, or at least I don’t know the groovy trick to make it work.
I’ve also tried
def tarSpec = project.copySpec {
include "../**/*.rpm"
}
into '/'
with tarSpec
This does not produce errors but the task is in an UP-TO-DATE state that cannot be changed even with outputs.upToDateWhen { false }
Yup, they both work and I include them both again for completeness.
def rpmTree = project.fileTree("..").matching {
include "**/*.rpm"
}
from rpmTree
into "/"
def spec = copySpec {
from ".."
include "**/*.rpm"
}
with spec
into "/"
What was leading me astray was something very similar that I tried and failed with.
def spec = copySpec {
from "../"
include "**/*.rpm"
}
with spec
into "/
For some reason I thought I needed a slash after the dot dot. No good. It brings the following less than intuitive error message:
A problem occurred configuring project ‘:bundle’.
Could not find method copySpec() for arguments [com.att.voicetone.gradle.plugins.BundlerTask$_applyBundleDefinition_closure2@4350ef1b] on task ‘:bundle:bundle’.
and if I wanted the output flattened, that is, all the rpms at the root level of the tar, not replicating their locations in the input tree? Is there a simple flattening transformer for copySpecs? I didn’t find one immediately obvious.