license-gradle-plugin icon indicating copy to clipboard operation
license-gradle-plugin copied to clipboard

Multiple Dependency Configurations for downloadLicenses

Open merando opened this issue 10 years ago • 1 comments

My project contains different dependency configurations. Nevertheless I want to analyse the dependencies and the licenses. I would suggest an enhancement to the 'downloadLicenses" method. With a syntax like:

downloadLicenses { dependencyConfiguration = ['providedCompile','testRuntime'] }

merando avatar Jun 19 '14 12:06 merando

That would be very useful!

In the meantime, you can use this:

task downloadLicenses(type: nl.javadude.gradle.plugins.license.DownloadLicenses, overwrite: true) {
    String configurationName = "multipleConfigurations"
    doFirst {
        configurations.create(configurationName).extendsFrom(
                // put the configurations you want to include here
                configurations.compile,
                configurations.androidTestCompile)
    }
    getOutputs().upToDateWhen { false }
    dependencyConfiguration configurationName

    // task configuration
    includeProjectDependencies true
}

Or if you want to include all configurations:

task downloadLicenses(type: nl.javadude.gradle.plugins.license.DownloadLicenses, overwrite: true) {
    String configurationName = "allConfigurations"
    doFirst {
        Configuration[] _configurations = configurations as Configuration[]
        configurations.create(configurationName).extendsFrom(_configurations)
    }
    getOutputs().upToDateWhen { false }
    dependencyConfiguration configurationName

    // task configuration
    includeProjectDependencies true
}

Takhion avatar Oct 16 '14 12:10 Takhion