Skip to content

Commit

Permalink
Address PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shardulm94 committed Apr 9, 2019
1 parent 89923c2 commit c6a16b8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
package com.linkedin.transport.plugin;

public enum DependencyConfigurationType {
public enum ConfigurationType {
ANNOTATION_PROCESSOR,
COMPILE_ONLY,
IMPLEMENTATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.List;
import java.util.Properties;

import static com.linkedin.transport.plugin.DependencyConfigurationType.*;
import static com.linkedin.transport.plugin.ConfigurationType.*;


/**
Expand Down Expand Up @@ -94,7 +94,7 @@ private static Properties loadDefaultVersions() {
)
);

private static DependencyConfiguration getDependencyConfiguration(DependencyConfigurationType configurationType,
private static DependencyConfiguration getDependencyConfiguration(ConfigurationType configurationType,
String module, String platform) {
return new DependencyConfiguration(configurationType,
module + ":" + DEFAULT_VERSIONS.getProperty(platform + "-version"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
* In the future can expand to incorporate exclude rules, dependency substitutions, etc.
*/
public class DependencyConfiguration {
private DependencyConfigurationType _configurationType;
private ConfigurationType _configurationType;
private String _dependencyString;

public DependencyConfiguration(DependencyConfigurationType configurationType, String dependencyString) {
public DependencyConfiguration(ConfigurationType configurationType, String dependencyString) {
_configurationType = configurationType;
_dependencyString = dependencyString;
}

public DependencyConfigurationType getConfigurationType() {
public ConfigurationType getConfigurationType() {
return _configurationType;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ static SourceDirectorySet getSourceDirectorySet(SourceSet sourceSet, Language la
}

static Configuration getConfigurationForSourceSet(Project project, SourceSet sourceSet,
DependencyConfigurationType configurationType) {
ConfigurationType configurationType) {
return project.getConfigurations().getByName(getConfigurationNameForSourceSet(sourceSet, configurationType));
}

private static String getConfigurationNameForSourceSet(SourceSet sourceSet,
DependencyConfigurationType configurationType) {
private static String getConfigurationNameForSourceSet(SourceSet sourceSet, ConfigurationType configurationType) {
final String configName;
switch (configurationType) {
case ANNOTATION_PROCESSOR:
Expand Down Expand Up @@ -76,17 +75,19 @@ static void addDependencyToConfiguration(Project project, Configuration configur
/**
* Adds the provided dependency to the appropriate configurations of the given {@link SourceSet}
*/
static void addDependencyToSourceSet(Project project, SourceSet sourceSet, DependencyConfiguration dependency) {
static void addDependencyToSourceSet(Project project, SourceSet sourceSet,
DependencyConfiguration dependencyConfiguration) {
addDependencyToConfiguration(project,
SourceSetUtils.getConfigurationForSourceSet(project, sourceSet, dependency.getConfigurationType()),
dependency.getDependencyString());
SourceSetUtils.getConfigurationForSourceSet(project, sourceSet, dependencyConfiguration.getConfigurationType()),
dependencyConfiguration.getDependencyString());
}

/**
* Adds the provided dependencies to the appropriate configurations of the given {@link SourceSet}
*/
static void addDependenciesToSourceSet(Project project, SourceSet sourceSet,
Collection<DependencyConfiguration> dependencies) {
dependencies.forEach(dependency -> addDependencyToSourceSet(project, sourceSet, dependency));
Collection<DependencyConfiguration> dependencyConfigurations) {
dependencyConfigurations.forEach(
dependencyConfiguration -> addDependencyToSourceSet(project, sourceSet, dependencyConfiguration));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.gradle.api.tasks.testing.Test;
import org.gradle.language.base.plugins.LifecycleBasePlugin;

import static com.linkedin.transport.plugin.DependencyConfigurationType.*;
import static com.linkedin.transport.plugin.ConfigurationType.*;


/**
Expand Down

0 comments on commit c6a16b8

Please sign in to comment.