All that you need to change is to specify that you want to copy from a task or task outputs and not a directory - this will register an implicit dependency between your war task and whatever task that builds the swf file.
Said that it is necessary for the task that builds your swf file to specify its outputs. I had a quick look at GradleFx and unfortunately it looks like compileFlex task doesn't do it. So first you will need to specify the outputs for the task the following way:
compileFlex {
outputs.dir project.buildDir
}
and then modify your war task configuration:
war {
from project(":flex:FlexManager").compileFlex {
into ('flash')
}
}
You should probably also nag at the GradleFx devs to add outputs to their tasks. :)
EDIT:
From the discussion in the comments I've understood that instead of depending on a task you can depend on a project artifact. The cleanest way is to create a custom configuration, add the dependency to it and then use it in the from call when configuring the war task:
configuration {
flex
}
dependencies {
flex project(':flex:FlexManager')
}
war {
from configurations.flex {
into ('flash')
}
}
You could probably also use the archives or default configuration of :flex:FlexManager
directly:
war {
from project(':flex:FlexManager').configurations.archives {
into ('flash')
}
}