Skip to content

Commit

Permalink
Added new configuration name parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvasilkov committed Apr 19, 2018
1 parent aa44846 commit eeb5018
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class VcsSettingsPlugin implements Plugin<Settings> {
settings.gradle.afterProject { Project project ->
dependencies.get(project.name).each { VcsDependency dep ->
if (dep.includeProject && dep.addDependency) {
project.dependencies.add('compile', project.project(projectName(dep)))
project.dependencies.add(dep.configName, project.project(projectName(dep)))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ abstract class VcsDependency {

private static final String DEFAULT_DIR = 'libraries'
private static final String DEFAULT_AUTH_GROUP = 'VCS'
private static final String DEFAULT_CONFIG_NAME = 'implementation'

final String name
final String url
Expand All @@ -21,6 +22,7 @@ abstract class VcsDependency {
final boolean includeProject
final boolean addDependency
final boolean keepUpdated
final String configName

final File repoDir

Expand All @@ -40,8 +42,9 @@ abstract class VcsDependency {
includeProject = map.includeProject instanceof Boolean ? map.includeProject : true
addDependency = map.addDependency instanceof Boolean ? map.addDependency : true
keepUpdated = map.keepUpdated instanceof Boolean ? map.keepUpdated : true
configName = map.configName ? map.configName : DEFAULT_CONFIG_NAME

repoDir = new File(dir, name);
repoDir = new File(dir, name)
}

void check() {
Expand All @@ -53,6 +56,9 @@ abstract class VcsDependency {
if (!authGroup) {
throw new GradleException("Vcs 'authGroup' cannot be empty for ${name}")
}
if (!configName) {
throw new GradleException("Vcs 'authGroup' cannot be empty for ${name}")
}
if (!username) {
throw new GradleException("Vcs 'username' is not specified for '${name}'\n" +
"${CredentialsHelper.usernameHelp(name, authGroup)}")
Expand All @@ -69,8 +75,8 @@ abstract class VcsDependency {

void checkEquals(VcsDependency d) {
if (d.name != name) {
throw new RuntimeException("Method checkEquals should be called only for dependencies" +
" with same name")
throw new RuntimeException(
"Method checkEquals should be called only for dependencies with same name")
}
if (d.url != url) throwEqualCheckFail('url', url, d.url)
if (!Objects.equals(d.dir, dir)) throwEqualCheckFail('dir', dir.path, d.dir.path)
Expand Down

0 comments on commit eeb5018

Please sign in to comment.