Hi,
I am moving from groovy to kotlin for my build files, but I am a little bit lost for this transformation:
groovy one which works:
...
def modelTree = fileTree(projectDir)
modelTree.include("**/*.json")
modelTree.exclude("package.json")
modelTree.exclude("package-lock.json")
modelTree.exclude("node_modules")
artifacts {
modelConfig(modelTree.getFiles())
}
...
With Kotlin:
...
val modelTree = fileTree(projectDir)
modelTree.include("**/*.json")
modelTree.exclude("package.json")
modelTree.exclude("package-lock.json")
modelTree.exclude("node_modules")
artifacts.add("modelConfig", modelTree.files)
...
But this will generate:
Cannot convert the provided notation to an object of type ConfigurablePublishArtifact: [List-of-Files]
The following types/formats are supported:
- Instances of ConfigurablePublishArtifact.
- Instances of PublishArtifact.
- Instances of AbstractArchiveTask, for example jar.
- Instances of Provider<RegularFile>.
- Instances of Provider<Directory>.
- Instances of Provider<File>.
- Instances of RegularFile.
- Instances of Directory.
- Instances of File.
- Maps with 'file' key
Wrapping it with providers.provider {modelTree.files}
does not help either.
I am sure this is an easy task to do, but I could need a hint in the right direction, thanks.