Skip to content

Commit

Permalink
added support for including sub-project dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
stempler committed Apr 24, 2016
1 parent aac2af2 commit cfa5ec4
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,3 +1,7 @@
### 1.4.0

- Support for including sub-project dependencies

### 1.3.0

- Added tasks for security and license checks
Expand Down
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -131,6 +131,17 @@ versioneye {
```


##### Multi-project builds (since 1.4)

If you have a multi-build project that you want to handle as one single VersionEye project, you should apply the plugin only to the root project and configure the plugin to include dependencies from sub-projects as well:

```groovy
versioneye {
includeSubProjects = true
}
```


#### Unknown licenses

If you want the license check to fail when dependencies with unknown license are encountered, you need to enable it in the configuration like this:
Expand Down
Expand Up @@ -25,6 +25,7 @@
package org.standardout.gradle.plugin.versioneye

import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ExternalDependency
import org.gradle.api.artifacts.ResolvedArtifact
Expand Down Expand Up @@ -58,22 +59,37 @@ class PomTask extends DefaultTask {

// map of artifacts/dependencies to the respective configurations
Map dependencyMap = [:]

// determine projects for which to include dependencies
def depProjects
if (project.versioneye.includeSubProjects) {
// project and sub-projects
depProjects = project.allprojects
}
else {
// only the main project
depProjects = [project]
}

// project dependencies
project.configurations.names.collect { String name ->
// check if configuration should be included
if (project.versioneye.acceptConfiguration(name)) {
ResolvedConfiguration config = project.configurations.getByName(name).resolvedConfiguration
addDependenciesToMap(name, config, dependencyMap)
depProjects.each { Project depProject ->
depProject.configurations.names.collect { String name ->
// check if configuration should be included
if (project.versioneye.acceptConfiguration(name)) {
ResolvedConfiguration config = depProject.configurations.getByName(name).resolvedConfiguration
addDependenciesToMap(name, config, dependencyMap)
}
}
}

// project plugins
if (project.versioneye.includePlugins) {
project.buildscript.configurations.names.collect { String name ->
//XXX are there any build script configurations that should not be included?
ResolvedConfiguration config = project.buildscript.configurations.getByName(name).resolvedConfiguration
addDependenciesToMap(name, config, dependencyMap, 'plugin')
depProjects.each { Project depProject ->
depProject.buildscript.configurations.names.collect { String name ->
//XXX are there any build script configurations that should not be included?
ResolvedConfiguration config = depProject.buildscript.configurations.getByName(name).resolvedConfiguration
addDependenciesToMap(name, config, dependencyMap, 'plugin')
}
}
}

Expand Down
Expand Up @@ -67,6 +67,11 @@ class VersionEyeExtension {
* configurations.
*/
boolean includePlugins = true

/**
* If dependencies from sub-projects should be included.
*/
boolean includeSubProjects = false

/**
* Specify configurations to exclude.
Expand Down

0 comments on commit cfa5ec4

Please sign in to comment.