Skip to content

Commit

Permalink
Disbale license tasks if license.enabled is false. Fixes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Oct 9, 2018
1 parent 20bd894 commit e5537df
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.kordamp.gradle.plugin.license

import com.hierynomus.gradle.license.LicenseReportingPlugin
import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat
import nl.javadude.gradle.plugins.license.DownloadLicenses
import nl.javadude.gradle.plugins.license.DownloadLicensesExtension
import nl.javadude.gradle.plugins.license.LicenseExtension
Expand Down Expand Up @@ -98,6 +100,12 @@ class LicensePlugin implements Plugin<Project> {
private void configureLicenseExtension(Project project) {
ProjectConfigurationExtension mergedConfiguration = project.ext.mergedConfiguration

if (!mergedConfiguration.license.enabled) {
project.tasks.withType(LicenseCheck).each { it.enabled = false }
project.tasks.withType(LicenseFormat).each { it.enabled = false }
return
}

License lic = mergedConfiguration.license.allLicenses()[0]
if (mergedConfiguration.license.allLicenses().size() > 1) {
lic = mergedConfiguration.license.allLicenses().find {
Expand Down

0 comments on commit e5537df

Please sign in to comment.