Looks like you will not be able to use regexp as simply as in ant (for the moment, please Gradle Devs correct me if I’m wrong)
Several things you can do though:
- Declare ‘conf’ in your ivy artifacts
artifact name=“kotlin-compiler-0.12.529” type=“zip” ext=“zip” conf=“myConf”
artifact name=“kotlin-compiler-for-maven” type=“jar” ext=“jar” conf=“myConf”
This can then be used to retrieve only the artifacts you want
i.e.
dependencies {
compile group:‘org’ module:‘bt390’ version:‘501655:id’ conf:‘myConf’
}
This supposes you can modify the ivy.xml descriptor file of your bt390 module.
- Explicitly tell which artifacts you want on the dependency (using this method)
dependencies {
compile ‘org:bt390:501655’ {
artifact {
name = ‘kotlin-compiler-0.12.529’
}
artifact {
name = ‘kotlin-compiler-for-maven’
}
…
}
}
- Create a configuration, and call an ArtifactQuery on it ?
I’m not an expert on this, but you might create a ‘fake’ configuration and execute a ArtifactResolutionQuery on it, to filter only your wanted artifacts.
Sth like
configurations {
kotlincompiler
}
dependencies {
kotlincompiler ‘org:bt390:501655’
}
def componentIds = configurations.kotlincompiler.incoming.resolutionResult.allDependencies.collect { it.selected.id }
def result = dependencies.createArtifactResolutionQuery()
.forComponents(componentIds)
.withArtifacts(not sure what to put here)
.execute()
def filteredFiles = result.resolvedComponents.getArtifacts(not sure what to put here).findAll{it instanceof ResolvedArtifactResult && it.file.name.contains(your regexp)}.collect{it.file}
dependencies {
compile filteredFiles
}