This message was deleted.
# community-support
s
This message was deleted.
v
Copy it there or actually create it there right-away? Shouldn't need more than
buildDir = rootProject.file("${rootBuildDir}/${name}")
. Besides that it of course will confuse anyone new to the project. šŸ˜„
r
Thanks - am I right that your solution will flatten the structure? (Which might not be the end of the world.) An existing plugin to copy them there is what I'm looking for, yes. I'd rather not mess with the conventions if I can avoid it.
v
Flatten in what sense? It would instead of
my-project/subproject1/build/foo/bar
right away create
my-project/build/subproject1/foo/bar
r
I think it would produce
Copy code
my-project/
└── build/
    ā”œā”€ā”€ subproject1/
    ā”œā”€ā”€ subproject2/
    └── subproject3/
rather than
Copy code
my-project/
└── build/
    ā”œā”€ā”€ subproject1/
    └── project-collection/
        ā”œā”€ā”€ subproject2/
        └── subproject3/
v
Ah, yes, that's right. But that should easily be adaptable. Something like
buildDir = rootProject.file("${rootBuildDir}/${path.replace(":", "/")}")
or similar. But as you want a copy it is anyway not what you want.
r
Thanks, this has given me a good enough approximation:
Copy code
val rootBuildDir = buildDir

subprojects {

  val relativeProjectPath = rootProject.projectDir.toPath().relativize(this.projectDir.toPath())
  buildDir = rootProject.file("${rootBuildDir}/$relativeProjectPath")
}