From 3673c455cbc8e5f8552d58e270e7d06f2ebd51e5 Mon Sep 17 00:00:00 2001 From: Bs Mahi Date: Fri, 15 Mar 2024 21:22:54 +0530 Subject: [PATCH] Removed lombok dependency in the gradle modules --- .../pom.xml | 15 - .../plugin/model/GradleProjectDataImpl.java | 228 ++++++- .../model/GradleToolingApiProjectBuilder.java | 573 +++++++++++++++++- .../GradleToolingApiSettingsBuilder.java | 101 ++- .../plugin/model/JavaSourceSetDataImpl.java | 97 ++- .../plugin/model/JavaVersionDataImpl.java | 62 +- .../plugin/model/KotlinSourceSetDataImpl.java | 61 +- 7 files changed, 1016 insertions(+), 121 deletions(-) diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/pom.xml b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/pom.xml index fdddd5f..b8f056d 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/pom.xml +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/pom.xml @@ -25,12 +25,6 @@ spring-rewrite-commons-rewrite-gradle-model ${project.version} - - org.projectlombok - lombok - ${lombok.version} - provided - dev.gradleplugins gradle-api @@ -51,15 +45,6 @@ org.apache.maven.plugins maven-compiler-plugin 3.11.0 - - - - org.projectlombok - lombok - ${lombok.version} - - - diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleProjectDataImpl.java b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleProjectDataImpl.java index 6a5e7a2..a6ae7da 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleProjectDataImpl.java +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleProjectDataImpl.java @@ -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 plugins; + private final List plugins; - List mavenRepositories; + private final List mavenRepositories; - List mavenPluginRepositories; + private final List mavenPluginRepositories; - Map nameToConfiguration; + private final Map 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 subprojects; + private final Collection subprojects; - File projectDir; + private final File projectDir; - File buildDir; + private final File buildDir; - File buildscriptFile; + private final File buildscriptFile; - Map properties; + private final Map properties; - List javaSourceSets; + private final List javaSourceSets; - boolean multiPlatformKotlinProject; + private final boolean multiPlatformKotlinProject; - List kotlinSourceSets; + private final List kotlinSourceSets; - Collection buildscriptClasspath; + private final Collection buildscriptClasspath; - Collection settingsClasspath; + private final Collection settingsClasspath; + + public GradleProjectDataImpl(String name, String path, String group, String version, + List plugins, List mavenRepositories, + List mavenPluginRepositories, + Map nameToConfiguration, GradleSettings gradleSettings, + String gradleVersion, boolean rootProject, File rootProjectDir, Collection subprojects, + File projectDir, File buildDir, File buildscriptFile, Map properties, + List javaSourceSets, boolean multiPlatformKotlinProject, + List kotlinSourceSets, Collection buildscriptClasspath, + Collection 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 subprojects(Collection subprojects) { - List sub = new ArrayList(subprojects.size()); + List 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 sourceSetData = new ArrayList(javaConvention.getSourceSets().size()); + List 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 = new ArrayList(sourceSetNames.size()); + List 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 getPlugins() { + return this.plugins; + } + + public List getMavenRepositories() { + return this.mavenRepositories; + } + + public List getMavenPluginRepositories() { + return this.mavenPluginRepositories; + } + + public Map 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 getSubprojects() { + return this.subprojects; + } + + public File getProjectDir() { + return this.projectDir; + } + + public File getBuildDir() { + return this.buildDir; + } + + public File getBuildscriptFile() { + return this.buildscriptFile; + } + + public Map getProperties() { + return this.properties; + } + + public List getJavaSourceSets() { + return this.javaSourceSets; + } + + public boolean isMultiPlatformKotlinProject() { + return this.multiPlatformKotlinProject; + } + + public List getKotlinSourceSets() { + return this.kotlinSourceSets; + } + + public Collection getBuildscriptClasspath() { + return this.buildscriptClasspath; + } + + public Collection 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() + ")"; + } + } diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiProjectBuilder.java b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiProjectBuilder.java index e80ebe2..ba466ac 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiProjectBuilder.java +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiProjectBuilder.java @@ -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 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 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 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 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 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 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 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 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 resolved; + public GradleDependencyConfigurationImpl(String name, String description, boolean transitive, + boolean canBeConsumed, boolean canBeResolved, List extendsFrom, + List requested, List 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 getExtendsFrom() { + return extendsFrom; + } + + @Override + public List getRequested() { + return requested; + } + + @Override + public List getResolved() { + return resolved; + } + } - @AllArgsConstructor - @Getter static class GradleProjectImpl implements GradleProject, Serializable { String name; @@ -193,6 +673,41 @@ public class GradleToolingApiProjectBuilder { Map nameToConfiguration; + public GradleProjectImpl(String name, String path, List plugins, + List mavenRepositories, List mavenPluginRepositories, + Map 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 getPlugins() { + return this.plugins; + } + + public List getMavenRepositories() { + return this.mavenRepositories; + } + + public List getMavenPluginRepositories() { + return this.mavenPluginRepositories; + } + + public Map getNameToConfiguration() { + return this.nameToConfiguration; + } + } static MavenRepositoryImpl GRADLE_PLUGIN_PORTAL = MavenRepositoryImpl.builder() diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiSettingsBuilder.java b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiSettingsBuilder.java index 286737e..1071b85 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiSettingsBuilder.java +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/GradleToolingApiSettingsBuilder.java @@ -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 pluginRepositories; + private final List pluginRepositories; - List plugins; + private final List plugins; - Map featurePreviews; + private final Map featurePreviews; + + public GradleSettingsImpl(List pluginRepositories, List plugins, + Map featurePreviews) { + this.pluginRepositories = pluginRepositories; + this.plugins = plugins; + this.featurePreviews = featurePreviews; + } + + public List getPluginRepositories() { + return this.pluginRepositories; + } + + public List getPlugins() { + return this.plugins; + } + + public Map 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() + ")"; + } } diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaSourceSetDataImpl.java b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaSourceSetDataImpl.java index 97bbc10..7c52dbd 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaSourceSetDataImpl.java +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaSourceSetDataImpl.java @@ -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 sources; + private final Collection sources; - Collection sourceDirectories; + private final Collection sourceDirectories; - Collection java; + private final Collection java; - Collection classesDirs; + private final Collection classesDirs; - Collection compileClasspath; + private final Collection compileClasspath; - Collection implementationClasspath; + private final Collection implementationClasspath; - JavaVersionDataImpl javaVersionData; + private final JavaVersionDataImpl javaVersionData; + + public JavaSourceSetDataImpl(String name, Collection sources, Collection sourceDirectories, + Collection java, Collection classesDirs, Collection compileClasspath, + Collection 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 getSources() { + return this.sources; + } + + public Collection getSourceDirectories() { + return this.sourceDirectories; + } + + public Collection getJava() { + return this.java; + } + + public Collection getClassesDirs() { + return this.classesDirs; + } + + public Collection getCompileClasspath() { + return this.compileClasspath; + } + + public Collection 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() + ")"; + } } diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaVersionDataImpl.java b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaVersionDataImpl.java index f642ea4..bd47709 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaVersionDataImpl.java +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/JavaVersionDataImpl.java @@ -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() + ")"; + } } \ No newline at end of file diff --git a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/KotlinSourceSetDataImpl.java b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/KotlinSourceSetDataImpl.java index 1ff42ae..1155eec 100644 --- a/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/KotlinSourceSetDataImpl.java +++ b/spring-rewrite-commons-gradle/spring-rewrite-commons-rewrite-gradle-plugin/src/main/java/org/springframework/rewrite/gradle/plugin/model/KotlinSourceSetDataImpl.java @@ -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 kotlin; + private final Collection kotlin; - Collection compileClasspath; + private final Collection compileClasspath; - Collection implementationClasspath; + private final Collection implementationClasspath; + + public KotlinSourceSetDataImpl(String name, Collection kotlin, Collection compileClasspath, + Collection implementationClasspath) { + this.name = name; + this.kotlin = kotlin; + this.compileClasspath = compileClasspath; + this.implementationClasspath = implementationClasspath; + } + + public String getName() { + return this.name; + } + + public Collection getKotlin() { + return this.kotlin; + } + + public Collection getCompileClasspath() { + return this.compileClasspath; + } + + public Collection 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() + ")"; + } } \ No newline at end of file