Removed lombok dependency in the gradle modules

This commit is contained in:
Bs Mahi
2024-03-15 21:22:54 +05:30
committed by GitHub
parent 53fe6999bf
commit 3673c455cb
7 changed files with 1016 additions and 121 deletions

View File

@@ -25,12 +25,6 @@
<artifactId>spring-rewrite-commons-rewrite-gradle-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.gradleplugins</groupId>
<artifactId>gradle-api</artifactId>
@@ -51,15 +45,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.rewrite.gradle.plugin.model;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
@@ -41,58 +39,89 @@ import java.util.stream.Collectors;
import static java.util.Collections.emptyList;
@Value
@AllArgsConstructor
class GradleProjectDataImpl implements GradleProjectData, Serializable {
final class GradleProjectDataImpl implements GradleProjectData, Serializable {
private static final Logger logger = Logging.getLogger(GradleProjectDataImpl.class);
private static Class<?>[] SUPPORTED_GRADLE_PROPERTY_VALUE_TYPES = new Class<?>[] { Number.class, Boolean.class,
String.class, Character.class };
private static final Class<?>[] SUPPORTED_GRADLE_PROPERTY_VALUE_TYPES = new Class<?>[] { Number.class,
Boolean.class, String.class, Character.class };
String name;
private final String name;
String path;
private final String path;
String group;
private final String group;
String version;
private final String version;
List<GradlePluginDescriptor> plugins;
private final List<GradlePluginDescriptor> plugins;
List<MavenRepository> mavenRepositories;
private final List<MavenRepository> mavenRepositories;
List<MavenRepository> mavenPluginRepositories;
private final List<MavenRepository> mavenPluginRepositories;
Map<String, GradleDependencyConfiguration> nameToConfiguration;
private final Map<String, GradleDependencyConfiguration> nameToConfiguration;
GradleSettings gradleSettings;
private final GradleSettings gradleSettings;
String gradleVersion;
private final String gradleVersion;
boolean rootProject;
private final boolean rootProject;
File rootProjectDir;
private final File rootProjectDir;
Collection<GradleProjectData> subprojects;
private final Collection<GradleProjectData> subprojects;
File projectDir;
private final File projectDir;
File buildDir;
private final File buildDir;
File buildscriptFile;
private final File buildscriptFile;
Map<String, ?> properties;
private final Map<String, ?> properties;
List<JavaSourceSetData> javaSourceSets;
private final List<JavaSourceSetData> javaSourceSets;
boolean multiPlatformKotlinProject;
private final boolean multiPlatformKotlinProject;
List<KotlinSourceSetData> kotlinSourceSets;
private final List<KotlinSourceSetData> kotlinSourceSets;
Collection<File> buildscriptClasspath;
private final Collection<File> buildscriptClasspath;
Collection<File> settingsClasspath;
private final Collection<File> settingsClasspath;
public GradleProjectDataImpl(String name, String path, String group, String version,
List<GradlePluginDescriptor> plugins, List<MavenRepository> mavenRepositories,
List<MavenRepository> mavenPluginRepositories,
Map<String, GradleDependencyConfiguration> nameToConfiguration, GradleSettings gradleSettings,
String gradleVersion, boolean rootProject, File rootProjectDir, Collection<GradleProjectData> subprojects,
File projectDir, File buildDir, File buildscriptFile, Map<String, ?> properties,
List<JavaSourceSetData> javaSourceSets, boolean multiPlatformKotlinProject,
List<KotlinSourceSetData> kotlinSourceSets, Collection<File> buildscriptClasspath,
Collection<File> settingsClasspath) {
this.name = name;
this.path = path;
this.group = group;
this.version = version;
this.plugins = plugins;
this.mavenRepositories = mavenRepositories;
this.mavenPluginRepositories = mavenPluginRepositories;
this.nameToConfiguration = nameToConfiguration;
this.gradleSettings = gradleSettings;
this.gradleVersion = gradleVersion;
this.rootProject = rootProject;
this.rootProjectDir = rootProjectDir;
this.subprojects = subprojects;
this.projectDir = projectDir;
this.buildDir = buildDir;
this.buildscriptFile = buildscriptFile;
this.properties = properties;
this.javaSourceSets = javaSourceSets;
this.multiPlatformKotlinProject = multiPlatformKotlinProject;
this.kotlinSourceSets = kotlinSourceSets;
this.buildscriptClasspath = buildscriptClasspath;
this.settingsClasspath = settingsClasspath;
}
static GradleProjectDataImpl from(Project project) {
GradleProject toolingRewriiteGradleProject = GradleToolingApiProjectBuilder.gradleProject(project);
@@ -114,7 +143,7 @@ class GradleProjectDataImpl implements GradleProjectData, Serializable {
}
private static Collection<GradleProjectData> subprojects(Collection<Project> subprojects) {
List<GradleProjectData> sub = new ArrayList(subprojects.size());
List<GradleProjectData> sub = new ArrayList<>(subprojects.size());
for (Project s : subprojects) {
sub.add(from(s));
}
@@ -135,7 +164,7 @@ class GradleProjectDataImpl implements GradleProjectData, Serializable {
return Collections.emptyList();
}
else {
List<JavaSourceSetData> sourceSetData = new ArrayList(javaConvention.getSourceSets().size());
List<JavaSourceSetData> sourceSetData = new ArrayList<>(javaConvention.getSourceSets().size());
for (SourceSet sourceSet : javaConvention.getSourceSets()) {
sourceSetData.add(new JavaSourceSetDataImpl(sourceSet.getName(), sourceSet.getAllSource().getFiles(),
sourceSet.getResources().getSourceDirectories().getFiles(), sourceSet.getAllJava().getFiles(),
@@ -210,7 +239,7 @@ class GradleProjectDataImpl implements GradleProjectData, Serializable {
return Collections.emptyList();
}
List<KotlinSourceSetData> kotlinSourceSetData = new ArrayList(sourceSetNames.size());
List<KotlinSourceSetData> kotlinSourceSetData = new ArrayList<>(sourceSetNames.size());
for (String sourceSetName : sourceSetNames) {
try {
@@ -269,4 +298,139 @@ class GradleProjectDataImpl implements GradleProjectData, Serializable {
return emptyList();
}
public String getName() {
return this.name;
}
public String getPath() {
return this.path;
}
public String getGroup() {
return this.group;
}
public String getVersion() {
return this.version;
}
public List<GradlePluginDescriptor> getPlugins() {
return this.plugins;
}
public List<MavenRepository> getMavenRepositories() {
return this.mavenRepositories;
}
public List<MavenRepository> getMavenPluginRepositories() {
return this.mavenPluginRepositories;
}
public Map<String, GradleDependencyConfiguration> getNameToConfiguration() {
return this.nameToConfiguration;
}
public GradleSettings getGradleSettings() {
return this.gradleSettings;
}
public String getGradleVersion() {
return this.gradleVersion;
}
public boolean isRootProject() {
return this.rootProject;
}
public File getRootProjectDir() {
return this.rootProjectDir;
}
public Collection<GradleProjectData> getSubprojects() {
return this.subprojects;
}
public File getProjectDir() {
return this.projectDir;
}
public File getBuildDir() {
return this.buildDir;
}
public File getBuildscriptFile() {
return this.buildscriptFile;
}
public Map<String, ?> getProperties() {
return this.properties;
}
public List<JavaSourceSetData> getJavaSourceSets() {
return this.javaSourceSets;
}
public boolean isMultiPlatformKotlinProject() {
return this.multiPlatformKotlinProject;
}
public List<KotlinSourceSetData> getKotlinSourceSets() {
return this.kotlinSourceSets;
}
public Collection<File> getBuildscriptClasspath() {
return this.buildscriptClasspath;
}
public Collection<File> getSettingsClasspath() {
return this.settingsClasspath;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GradleProjectDataImpl that = (GradleProjectDataImpl) o;
return rootProject == that.rootProject && multiPlatformKotlinProject == that.multiPlatformKotlinProject
&& Objects.equals(name, that.name) && Objects.equals(path, that.path)
&& Objects.equals(group, that.group) && Objects.equals(version, that.version)
&& Objects.equals(plugins, that.plugins) && Objects.equals(mavenRepositories, that.mavenRepositories)
&& Objects.equals(mavenPluginRepositories, that.mavenPluginRepositories)
&& Objects.equals(nameToConfiguration, that.nameToConfiguration)
&& Objects.equals(gradleSettings, that.gradleSettings)
&& Objects.equals(gradleVersion, that.gradleVersion)
&& Objects.equals(rootProjectDir, that.rootProjectDir) && Objects.equals(subprojects, that.subprojects)
&& Objects.equals(projectDir, that.projectDir) && Objects.equals(buildDir, that.buildDir)
&& Objects.equals(buildscriptFile, that.buildscriptFile) && Objects.equals(properties, that.properties)
&& Objects.equals(javaSourceSets, that.javaSourceSets)
&& Objects.equals(kotlinSourceSets, that.kotlinSourceSets)
&& Objects.equals(buildscriptClasspath, that.buildscriptClasspath)
&& Objects.equals(settingsClasspath, that.settingsClasspath);
}
@Override
public int hashCode() {
return Objects.hash(name, path, group, version, plugins, mavenRepositories, mavenPluginRepositories,
nameToConfiguration, gradleSettings, gradleVersion, rootProject, rootProjectDir, subprojects,
projectDir, buildDir, buildscriptFile, properties, javaSourceSets, multiPlatformKotlinProject,
kotlinSourceSets, buildscriptClasspath, settingsClasspath);
}
public String toString() {
return "GradleProjectDataImpl(name=" + this.getName() + ", path=" + this.getPath() + ", group="
+ this.getGroup() + ", version=" + this.getVersion() + ", plugins=" + this.getPlugins()
+ ", mavenRepositories=" + this.getMavenRepositories() + ", mavenPluginRepositories="
+ this.getMavenPluginRepositories() + ", nameToConfiguration=" + this.getNameToConfiguration()
+ ", gradleSettings=" + this.getGradleSettings() + ", gradleVersion=" + this.getGradleVersion()
+ ", rootProject=" + this.isRootProject() + ", rootProjectDir=" + this.getRootProjectDir()
+ ", subprojects=" + this.getSubprojects() + ", projectDir=" + this.getProjectDir() + ", buildDir="
+ this.getBuildDir() + ", buildscriptFile=" + this.getBuildscriptFile() + ", properties="
+ this.getProperties() + ", javaSourceSets=" + this.getJavaSourceSets()
+ ", multiPlatformKotlinProject=" + this.isMultiPlatformKotlinProject() + ", kotlinSourceSets="
+ this.getKotlinSourceSets() + ", buildscriptClasspath=" + this.getBuildscriptClasspath()
+ ", settingsClasspath=" + this.getSettingsClasspath() + ")";
}
}

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.rewrite.gradle.plugin.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ConfigurationContainer;
@@ -46,8 +42,6 @@ import static java.util.stream.Collectors.toList;
public class GradleToolingApiProjectBuilder {
@Builder
@Getter
static class MavenRepositoryImpl implements MavenRepository, Serializable {
String id;
@@ -66,21 +60,152 @@ public class GradleToolingApiProjectBuilder {
Boolean DeriveMetadataIfMissing;
MavenRepositoryImpl(String id, String uri, String releases, String snapshots, boolean knownToExist,
String username, String password, Boolean DeriveMetadataIfMissing) {
this.id = id;
this.uri = uri;
this.releases = releases;
this.snapshots = snapshots;
this.knownToExist = knownToExist;
this.username = username;
this.password = password;
this.DeriveMetadataIfMissing = DeriveMetadataIfMissing;
}
public static MavenRepositoryImplBuilder builder() {
return new MavenRepositoryImplBuilder();
}
public String getId() {
return this.id;
}
public String getUri() {
return this.uri;
}
public String getReleases() {
return this.releases;
}
public String getSnapshots() {
return this.snapshots;
}
public boolean isKnownToExist() {
return this.knownToExist;
}
public String getUsername() {
return this.username;
}
public String getPassword() {
return this.password;
}
public Boolean getDeriveMetadataIfMissing() {
return this.DeriveMetadataIfMissing;
}
public static class MavenRepositoryImplBuilder {
private String id;
private String uri;
private String releases;
private String snapshots;
private boolean knownToExist;
private String username;
private String password;
private Boolean DeriveMetadataIfMissing;
MavenRepositoryImplBuilder() {
}
public MavenRepositoryImplBuilder id(String id) {
this.id = id;
return this;
}
public MavenRepositoryImplBuilder uri(String uri) {
this.uri = uri;
return this;
}
public MavenRepositoryImplBuilder releases(String releases) {
this.releases = releases;
return this;
}
public MavenRepositoryImplBuilder snapshots(String snapshots) {
this.snapshots = snapshots;
return this;
}
public MavenRepositoryImplBuilder knownToExist(boolean knownToExist) {
this.knownToExist = knownToExist;
return this;
}
public MavenRepositoryImplBuilder username(String username) {
this.username = username;
return this;
}
public MavenRepositoryImplBuilder password(String password) {
this.password = password;
return this;
}
public MavenRepositoryImplBuilder DeriveMetadataIfMissing(Boolean DeriveMetadataIfMissing) {
this.DeriveMetadataIfMissing = DeriveMetadataIfMissing;
return this;
}
public MavenRepositoryImpl build() {
return new MavenRepositoryImpl(this.id, this.uri, this.releases, this.snapshots, this.knownToExist,
this.username, this.password, this.DeriveMetadataIfMissing);
}
public String toString() {
return "GradleToolingApiProjectBuilder.MavenRepositoryImpl.MavenRepositoryImplBuilder(id=" + this.id
+ ", uri=" + this.uri + ", releases=" + this.releases + ", snapshots=" + this.snapshots
+ ", knownToExist=" + this.knownToExist + ", username=" + this.username + ", password="
+ this.password + ", DeriveMetadataIfMissing=" + this.DeriveMetadataIfMissing + ")";
}
}
}
@AllArgsConstructor
@Getter
static class GradlePluginDescriptorImpl implements GradlePluginDescriptor, Serializable {
String fullyQualifiedClassName;
String id;
public GradlePluginDescriptorImpl(String fullyQualifiedClassName, String id) {
this.fullyQualifiedClassName = fullyQualifiedClassName;
this.id = id;
}
public String getFullyQualifiedClassName() {
return this.fullyQualifiedClassName;
}
public String getId() {
return this.id;
}
}
@AllArgsConstructor
@Getter
@EqualsAndHashCode
static class GroupArtifactVersionImpl implements GroupArtifactVersion, Serializable {
String groupId;
@@ -89,23 +214,78 @@ public class GradleToolingApiProjectBuilder {
String version;
public GroupArtifactVersionImpl(String groupId, String artifactId, String version) {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
}
public String getGroupId() {
return this.groupId;
}
public String getArtifactId() {
return this.artifactId;
}
public String getVersion() {
return this.version;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GroupArtifactVersionImpl that = (GroupArtifactVersionImpl) o;
return Objects.equals(groupId, that.groupId) && Objects.equals(artifactId, that.artifactId)
&& Objects.equals(version, that.version);
}
@Override
public int hashCode() {
return Objects.hash(groupId, artifactId, version);
}
}
@AllArgsConstructor
@Getter
@EqualsAndHashCode
static class GroupArtifactImpl implements GroupArtifact, Serializable {
String groupId;
String artifactId;
public GroupArtifactImpl(String groupId, String artifactId) {
this.groupId = groupId;
this.artifactId = artifactId;
}
public String getGroupId() {
return this.groupId;
}
public String getArtifactId() {
return this.artifactId;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GroupArtifactImpl that = (GroupArtifactImpl) o;
return Objects.equals(groupId, that.groupId) && Objects.equals(artifactId, that.artifactId);
}
@Override
public int hashCode() {
return Objects.hash(groupId, artifactId);
}
}
@AllArgsConstructor
@Getter
@Builder
@EqualsAndHashCode
static class DependencyImpl implements Dependency, Serializable {
GroupArtifactVersion gav;
@@ -120,11 +300,123 @@ public class GradleToolingApiProjectBuilder {
String optional;
public DependencyImpl(GroupArtifactVersion gav, String classifier, String type, String scope,
List<GroupArtifact> exclusions, String optional) {
this.gav = gav;
this.classifier = classifier;
this.type = type;
this.scope = scope;
this.exclusions = exclusions;
this.optional = optional;
}
public static DependencyImplBuilder builder() {
return new DependencyImplBuilder();
}
public GroupArtifactVersion getGav() {
return this.gav;
}
public String getClassifier() {
return this.classifier;
}
public String getType() {
return this.type;
}
public String getScope() {
return this.scope;
}
public List<GroupArtifact> getExclusions() {
return this.exclusions;
}
public String getOptional() {
return this.optional;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
DependencyImpl that = (DependencyImpl) o;
return Objects.equals(gav, that.gav) && Objects.equals(classifier, that.classifier)
&& Objects.equals(type, that.type) && Objects.equals(scope, that.scope)
&& Objects.equals(exclusions, that.exclusions) && Objects.equals(optional, that.optional);
}
@Override
public int hashCode() {
return Objects.hash(gav, classifier, type, scope, exclusions, optional);
}
public static class DependencyImplBuilder {
private GroupArtifactVersion gav;
private String classifier;
private String type;
private String scope;
private List<GroupArtifact> exclusions;
private String optional;
DependencyImplBuilder() {
}
public DependencyImplBuilder gav(GroupArtifactVersion gav) {
this.gav = gav;
return this;
}
public DependencyImplBuilder classifier(String classifier) {
this.classifier = classifier;
return this;
}
public DependencyImplBuilder type(String type) {
this.type = type;
return this;
}
public DependencyImplBuilder scope(String scope) {
this.scope = scope;
return this;
}
public DependencyImplBuilder exclusions(List<GroupArtifact> exclusions) {
this.exclusions = exclusions;
return this;
}
public DependencyImplBuilder optional(String optional) {
this.optional = optional;
return this;
}
public DependencyImpl build() {
return new DependencyImpl(this.gav, this.classifier, this.type, this.scope, this.exclusions,
this.optional);
}
public String toString() {
return "GradleToolingApiProjectBuilder.DependencyImpl.DependencyImplBuilder(gav=" + this.gav
+ ", classifier=" + this.classifier + ", type=" + this.type + ", scope=" + this.scope
+ ", exclusions=" + this.exclusions + ", optional=" + this.optional + ")";
}
}
}
@AllArgsConstructor
@Getter
@EqualsAndHashCode
static class ResolvedGroupArtifactVersionImpl implements ResolvedGroupArtifactVersion, Serializable {
String artifactId;
@@ -135,12 +427,49 @@ public class GradleToolingApiProjectBuilder {
String datedSnapshotVersion;
public ResolvedGroupArtifactVersionImpl(String artifactId, String groupId, String version,
String datedSnapshotVersion) {
this.artifactId = artifactId;
this.groupId = groupId;
this.version = version;
this.datedSnapshotVersion = datedSnapshotVersion;
}
public String getArtifactId() {
return this.artifactId;
}
public String getGroupId() {
return this.groupId;
}
public String getVersion() {
return this.version;
}
public String getDatedSnapshotVersion() {
return this.datedSnapshotVersion;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ResolvedGroupArtifactVersionImpl that = (ResolvedGroupArtifactVersionImpl) o;
return Objects.equals(artifactId, that.artifactId) && Objects.equals(groupId, that.groupId)
&& Objects.equals(version, that.version)
&& Objects.equals(datedSnapshotVersion, that.datedSnapshotVersion);
}
@Override
public int hashCode() {
return Objects.hash(artifactId, groupId, version, datedSnapshotVersion);
}
}
@AllArgsConstructor
@Builder
@Getter
@EqualsAndHashCode
static class ResolvedDependencyImpl implements ResolvedDependency, Serializable {
MavenRepositoryImpl repository;
@@ -153,10 +482,110 @@ public class GradleToolingApiProjectBuilder {
int depth;
public ResolvedDependencyImpl(MavenRepositoryImpl repository, ResolvedGroupArtifactVersionImpl gav,
DependencyImpl requested, List<ResolvedDependency> dependencies, int depth) {
this.repository = repository;
this.gav = gav;
this.requested = requested;
this.dependencies = dependencies;
this.depth = depth;
}
public static ResolvedDependencyImplBuilder builder() {
return new ResolvedDependencyImplBuilder();
}
public MavenRepositoryImpl getRepository() {
return this.repository;
}
public ResolvedGroupArtifactVersionImpl getGav() {
return this.gav;
}
public DependencyImpl getRequested() {
return this.requested;
}
public List<ResolvedDependency> getDependencies() {
return this.dependencies;
}
public int getDepth() {
return this.depth;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ResolvedDependencyImpl that = (ResolvedDependencyImpl) o;
return depth == that.depth && Objects.equals(repository, that.repository) && Objects.equals(gav, that.gav)
&& Objects.equals(requested, that.requested) && Objects.equals(dependencies, that.dependencies);
}
@Override
public int hashCode() {
return Objects.hash(repository, gav, requested, dependencies, depth);
}
public static class ResolvedDependencyImplBuilder {
private MavenRepositoryImpl repository;
private ResolvedGroupArtifactVersionImpl gav;
private DependencyImpl requested;
private List<ResolvedDependency> dependencies;
private int depth;
ResolvedDependencyImplBuilder() {
}
public ResolvedDependencyImplBuilder repository(MavenRepositoryImpl repository) {
this.repository = repository;
return this;
}
public ResolvedDependencyImplBuilder gav(ResolvedGroupArtifactVersionImpl gav) {
this.gav = gav;
return this;
}
public ResolvedDependencyImplBuilder requested(DependencyImpl requested) {
this.requested = requested;
return this;
}
public ResolvedDependencyImplBuilder dependencies(List<ResolvedDependency> dependencies) {
this.dependencies = dependencies;
return this;
}
public ResolvedDependencyImplBuilder depth(int depth) {
this.depth = depth;
return this;
}
public ResolvedDependencyImpl build() {
return new ResolvedDependencyImpl(this.repository, this.gav, this.requested, this.dependencies,
this.depth);
}
public String toString() {
return "GradleToolingApiProjectBuilder.ResolvedDependencyImpl.ResolvedDependencyImplBuilder(repository="
+ this.repository + ", gav=" + this.gav + ", requested=" + this.requested + ", dependencies="
+ this.dependencies + ", depth=" + this.depth + ")";
}
}
}
@AllArgsConstructor
@Getter
static class GradleDependencyConfigurationImpl implements GradleDependencyConfiguration, Serializable {
String name;
@@ -175,10 +604,61 @@ public class GradleToolingApiProjectBuilder {
List<ResolvedDependency> resolved;
public GradleDependencyConfigurationImpl(String name, String description, boolean transitive,
boolean canBeConsumed, boolean canBeResolved, List<GradleDependencyConfiguration> extendsFrom,
List<Dependency> requested, List<ResolvedDependency> resolved) {
this.name = name;
this.description = description;
this.transitive = transitive;
this.canBeConsumed = canBeConsumed;
this.canBeResolved = canBeResolved;
this.extendsFrom = extendsFrom;
this.requested = requested;
this.resolved = resolved;
}
@Override
public String getName() {
return name;
}
@Override
public String getDescription() {
return description;
}
@Override
public boolean isTransitive() {
return transitive;
}
@Override
public boolean isCanBeConsumed() {
return canBeConsumed;
}
@Override
public boolean isCanBeResolved() {
return canBeResolved;
}
@Override
public List<GradleDependencyConfiguration> getExtendsFrom() {
return extendsFrom;
}
@Override
public List<Dependency> getRequested() {
return requested;
}
@Override
public List<ResolvedDependency> getResolved() {
return resolved;
}
}
@AllArgsConstructor
@Getter
static class GradleProjectImpl implements GradleProject, Serializable {
String name;
@@ -193,6 +673,41 @@ public class GradleToolingApiProjectBuilder {
Map<String, GradleDependencyConfiguration> nameToConfiguration;
public GradleProjectImpl(String name, String path, List<GradlePluginDescriptor> plugins,
List<MavenRepository> mavenRepositories, List<MavenRepository> mavenPluginRepositories,
Map<String, GradleDependencyConfiguration> nameToConfiguration) {
this.name = name;
this.path = path;
this.plugins = plugins;
this.mavenRepositories = mavenRepositories;
this.mavenPluginRepositories = mavenPluginRepositories;
this.nameToConfiguration = nameToConfiguration;
}
public String getName() {
return this.name;
}
public String getPath() {
return this.path;
}
public List<GradlePluginDescriptor> getPlugins() {
return this.plugins;
}
public List<MavenRepository> getMavenRepositories() {
return this.mavenRepositories;
}
public List<MavenRepository> getMavenPluginRepositories() {
return this.mavenPluginRepositories;
}
public Map<String, GradleDependencyConfiguration> getNameToConfiguration() {
return this.nameToConfiguration;
}
}
static MavenRepositoryImpl GRADLE_PLUGIN_PORTAL = MavenRepositoryImpl.builder()

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.rewrite.gradle.plugin.model;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.gradle.api.initialization.Settings;
import org.gradle.api.internal.FeaturePreviews;
import org.gradle.initialization.DefaultSettings;
@@ -35,27 +33,102 @@ import java.util.*;
public class GradleToolingApiSettingsBuilder {
@AllArgsConstructor
@Value
static class FeaturePreviewImpl implements FeaturePreview, Serializable {
static final class FeaturePreviewImpl implements FeaturePreview, Serializable {
String name;
private final String name;
boolean active;
private final boolean active;
boolean enabled;
private final boolean enabled;
public FeaturePreviewImpl(String name, boolean active, boolean enabled) {
this.name = name;
this.active = active;
this.enabled = enabled;
}
public String getName() {
return this.name;
}
public boolean isActive() {
return this.active;
}
public boolean isEnabled() {
return this.enabled;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
FeaturePreviewImpl that = (FeaturePreviewImpl) o;
return active == that.active && enabled == that.enabled && Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(name, active, enabled);
}
public String toString() {
return "GradleToolingApiSettingsBuilder.FeaturePreviewImpl(name=" + this.getName() + ", active="
+ this.isActive() + ", enabled=" + this.isEnabled() + ")";
}
}
@AllArgsConstructor
@Value
static class GradleSettingsImpl implements GradleSettings, Serializable {
static final class GradleSettingsImpl implements GradleSettings, Serializable {
List<MavenRepository> pluginRepositories;
private final List<MavenRepository> pluginRepositories;
List<GradlePluginDescriptor> plugins;
private final List<GradlePluginDescriptor> plugins;
Map<String, FeaturePreview> featurePreviews;
private final Map<String, FeaturePreview> featurePreviews;
public GradleSettingsImpl(List<MavenRepository> pluginRepositories, List<GradlePluginDescriptor> plugins,
Map<String, FeaturePreview> featurePreviews) {
this.pluginRepositories = pluginRepositories;
this.plugins = plugins;
this.featurePreviews = featurePreviews;
}
public List<MavenRepository> getPluginRepositories() {
return this.pluginRepositories;
}
public List<GradlePluginDescriptor> getPlugins() {
return this.plugins;
}
public Map<String, FeaturePreview> getFeaturePreviews() {
return this.featurePreviews;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GradleSettingsImpl that = (GradleSettingsImpl) o;
return Objects.equals(pluginRepositories, that.pluginRepositories) && Objects.equals(plugins, that.plugins)
&& Objects.equals(featurePreviews, that.featurePreviews);
}
@Override
public int hashCode() {
return Objects.hash(pluginRepositories, plugins, featurePreviews);
}
public String toString() {
return "GradleToolingApiSettingsBuilder.GradleSettingsImpl(pluginRepositories="
+ this.getPluginRepositories() + ", plugins=" + this.getPlugins() + ", featurePreviews="
+ this.getFeaturePreviews() + ")";
}
}

View File

@@ -15,32 +15,103 @@
*/
package org.springframework.rewrite.gradle.plugin.model;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.springframework.rewrite.gradle.model.JavaSourceSetData;
import java.io.File;
import java.io.Serializable;
import java.util.Collection;
import java.util.Objects;
@AllArgsConstructor
@Value
class JavaSourceSetDataImpl implements JavaSourceSetData, Serializable {
final class JavaSourceSetDataImpl implements JavaSourceSetData, Serializable {
String name;
private final String name;
Collection<File> sources;
private final Collection<File> sources;
Collection<File> sourceDirectories;
private final Collection<File> sourceDirectories;
Collection<File> java;
private final Collection<File> java;
Collection<File> classesDirs;
private final Collection<File> classesDirs;
Collection<File> compileClasspath;
private final Collection<File> compileClasspath;
Collection<File> implementationClasspath;
private final Collection<File> implementationClasspath;
JavaVersionDataImpl javaVersionData;
private final JavaVersionDataImpl javaVersionData;
public JavaSourceSetDataImpl(String name, Collection<File> sources, Collection<File> sourceDirectories,
Collection<File> java, Collection<File> classesDirs, Collection<File> compileClasspath,
Collection<File> implementationClasspath, JavaVersionDataImpl javaVersionData) {
this.name = name;
this.sources = sources;
this.sourceDirectories = sourceDirectories;
this.java = java;
this.classesDirs = classesDirs;
this.compileClasspath = compileClasspath;
this.implementationClasspath = implementationClasspath;
this.javaVersionData = javaVersionData;
}
public String getName() {
return this.name;
}
public Collection<File> getSources() {
return this.sources;
}
public Collection<File> getSourceDirectories() {
return this.sourceDirectories;
}
public Collection<File> getJava() {
return this.java;
}
public Collection<File> getClassesDirs() {
return this.classesDirs;
}
public Collection<File> getCompileClasspath() {
return this.compileClasspath;
}
public Collection<File> getImplementationClasspath() {
return this.implementationClasspath;
}
public JavaVersionDataImpl getJavaVersionData() {
return this.javaVersionData;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
JavaSourceSetDataImpl that = (JavaSourceSetDataImpl) o;
return Objects.equals(name, that.name) && Objects.equals(sources, that.sources)
&& Objects.equals(sourceDirectories, that.sourceDirectories) && Objects.equals(java, that.java)
&& Objects.equals(classesDirs, that.classesDirs)
&& Objects.equals(compileClasspath, that.compileClasspath)
&& Objects.equals(implementationClasspath, that.implementationClasspath)
&& Objects.equals(javaVersionData, that.javaVersionData);
}
@Override
public int hashCode() {
return Objects.hash(name, sources, sourceDirectories, java, classesDirs, compileClasspath,
implementationClasspath, javaVersionData);
}
public String toString() {
return "JavaSourceSetDataImpl(name=" + this.getName() + ", sources=" + this.getSources()
+ ", sourceDirectories=" + this.getSourceDirectories() + ", java=" + this.getJava() + ", classesDirs="
+ this.getClassesDirs() + ", compileClasspath=" + this.getCompileClasspath()
+ ", implementationClasspath=" + this.getImplementationClasspath() + ", javaVersionData="
+ this.getJavaVersionData() + ")";
}
}

View File

@@ -15,22 +15,66 @@
*/
package org.springframework.rewrite.gradle.plugin.model;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.springframework.rewrite.gradle.model.JavaVersionData;
import java.io.Serializable;
import java.util.Objects;
@AllArgsConstructor
@Value
class JavaVersionDataImpl implements JavaVersionData, Serializable {
final class JavaVersionDataImpl implements JavaVersionData, Serializable {
String createdBy;
private final String createdBy;
String vmVendor;
private final String vmVendor;
String sourceCompatibility;
private final String sourceCompatibility;
String targetCompatibility;
private final String targetCompatibility;
public JavaVersionDataImpl(String createdBy, String vmVendor, String sourceCompatibility,
String targetCompatibility) {
this.createdBy = createdBy;
this.vmVendor = vmVendor;
this.sourceCompatibility = sourceCompatibility;
this.targetCompatibility = targetCompatibility;
}
public String getCreatedBy() {
return this.createdBy;
}
public String getVmVendor() {
return this.vmVendor;
}
public String getSourceCompatibility() {
return this.sourceCompatibility;
}
public String getTargetCompatibility() {
return this.targetCompatibility;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
JavaVersionDataImpl that = (JavaVersionDataImpl) o;
return Objects.equals(createdBy, that.createdBy) && Objects.equals(vmVendor, that.vmVendor)
&& Objects.equals(sourceCompatibility, that.sourceCompatibility)
&& Objects.equals(targetCompatibility, that.targetCompatibility);
}
@Override
public int hashCode() {
return Objects.hash(createdBy, vmVendor, sourceCompatibility, targetCompatibility);
}
public String toString() {
return "JavaVersionDataImpl(createdBy=" + this.getCreatedBy() + ", vmVendor=" + this.getVmVendor()
+ ", sourceCompatibility=" + this.getSourceCompatibility() + ", targetCompatibility="
+ this.getTargetCompatibility() + ")";
}
}

View File

@@ -15,24 +15,67 @@
*/
package org.springframework.rewrite.gradle.plugin.model;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.springframework.rewrite.gradle.model.KotlinSourceSetData;
import java.io.File;
import java.io.Serializable;
import java.util.Collection;
import java.util.Objects;
@AllArgsConstructor
@Value
class KotlinSourceSetDataImpl implements KotlinSourceSetData, Serializable {
final class KotlinSourceSetDataImpl implements KotlinSourceSetData, Serializable {
String name;
private final String name;
Collection<File> kotlin;
private final Collection<File> kotlin;
Collection<File> compileClasspath;
private final Collection<File> compileClasspath;
Collection<File> implementationClasspath;
private final Collection<File> implementationClasspath;
public KotlinSourceSetDataImpl(String name, Collection<File> kotlin, Collection<File> compileClasspath,
Collection<File> implementationClasspath) {
this.name = name;
this.kotlin = kotlin;
this.compileClasspath = compileClasspath;
this.implementationClasspath = implementationClasspath;
}
public String getName() {
return this.name;
}
public Collection<File> getKotlin() {
return this.kotlin;
}
public Collection<File> getCompileClasspath() {
return this.compileClasspath;
}
public Collection<File> getImplementationClasspath() {
return this.implementationClasspath;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
KotlinSourceSetDataImpl that = (KotlinSourceSetDataImpl) o;
return Objects.equals(name, that.name) && Objects.equals(kotlin, that.kotlin)
&& Objects.equals(compileClasspath, that.compileClasspath)
&& Objects.equals(implementationClasspath, that.implementationClasspath);
}
@Override
public int hashCode() {
return Objects.hash(name, kotlin, compileClasspath, implementationClasspath);
}
public String toString() {
return "KotlinSourceSetDataImpl(name=" + this.getName() + ", kotlin=" + this.getKotlin() + ", compileClasspath="
+ this.getCompileClasspath() + ", implementationClasspath=" + this.getImplementationClasspath() + ")";
}
}