Added one more ant pattern to gradle and maven plugins
The bug is related to the fact that initially, we were supporting slash-separated paths to projects. E.g. if the group id was `a.b.c` then we did checked for `a/b/c` folder. At certain point we've started building stubs with the `groupid` folder as such e.g. `a.b.c/artifact-id`. This is where the bug comes in. For Maven and Gradle we're using ant patterns for copying files. We're only providing the slash-separated ant pattern. With this fix, we're backward compatible (we're leaving the slash-separated one) and we're adding support for dot-delimited group id. fixes gh-555
This commit is contained in:
@@ -23,16 +23,21 @@ class ContractsCopyTask extends ConventionTask {
|
||||
ContractVerifierConfigProperties props = ExtensionToProperties.fromExtension(getExtension())
|
||||
File file = getDownloader().downloadAndUnpackContractsIfRequired(getExtension(), props)
|
||||
String antPattern = "${props.includedRootFolderAntPattern}*.*"
|
||||
String slashSeparatedGroupId = project.group.toString().replace(".", File.separator)
|
||||
String slashSeparatedAntPattern = antPattern.replace(slashSeparatedGroupId, project.group.toString())
|
||||
String root = OutputFolderBuilder.buildRootPath(project)
|
||||
ext.contractVerifierConfigProperties = props
|
||||
File outputContractsFolder = getExtension().stubsOutputDir != null ?
|
||||
project.file("${getExtension().stubsOutputDir}/${root}/contracts") :
|
||||
project.file("${project.buildDir}/stubs/${root}/contracts")
|
||||
ext.contractsDslDir = outputContractsFolder
|
||||
project.logger.info("Downloading and unpacking files from [$file] to [$outputContractsFolder]. The inclusion ant pattern is [$antPattern]")
|
||||
project.logger.info("Downloading and unpacking files from [$file] to [$outputContractsFolder]. The inclusion ant patterns are [${antPattern}] and [${slashSeparatedAntPattern}]")
|
||||
project.copy {
|
||||
from(file)
|
||||
// by default group id is slash separated...
|
||||
include(antPattern)
|
||||
// ...we also want to allow dot separation
|
||||
include(slashSeparatedAntPattern)
|
||||
if (props.isExcludeBuildFolders()) {
|
||||
exclude "**/target/**", "**/build/**"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user