[Gradle|Sync] cleanup: removed unused copy constructors for Gradle project models

GitOrigin-RevId: d75720727f3bfe808850b59cb057f49db1885fd2
This commit is contained in:
Sergei Vorobyov
2024-06-11 19:02:53 +02:00
committed by intellij-monorepo-bot
parent 0faeb4ccb6
commit aea3307a18
4 changed files with 0 additions and 109 deletions

View File

@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.model.DefaultExternalSourceSet;
import org.jetbrains.plugins.gradle.model.ExternalSourceSet;
import org.jetbrains.plugins.gradle.model.GradleSourceSetModel;
import java.io.File;
@@ -31,18 +30,6 @@ public final class DefaultGradleSourceSetModel implements GradleSourceSetModel {
additionalArtifacts = new ArrayList<>(0);
}
public DefaultGradleSourceSetModel(@NotNull GradleSourceSetModel sourceSetModel) {
sourceCompatibility = sourceSetModel.getSourceCompatibility();
targetCompatibility = sourceSetModel.getTargetCompatibility();
taskArtifacts = sourceSetModel.getTaskArtifacts();
configurationArtifacts = sourceSetModel.getConfigurationArtifacts();
sourceSets = new LinkedHashMap<>();
for (Map.Entry<String, ? extends ExternalSourceSet> entry : sourceSetModel.getSourceSets().entrySet()) {
sourceSets.put(entry.getKey(), new DefaultExternalSourceSet(entry.getValue()));
}
additionalArtifacts = new ArrayList<>(sourceSetModel.getAdditionalArtifacts());
}
@Override
public @Nullable String getSourceCompatibility() {
return sourceCompatibility;

View File

@@ -52,35 +52,6 @@ public final class DefaultExternalProject implements ExternalProject, ExternalPr
sourceSetModel = new DefaultGradleSourceSetModel();
}
public DefaultExternalProject(@NotNull ExternalProject externalProject) {
id = externalProject.getId();
path = externalProject.getPath();
identityPath = externalProject.getIdentityPath();
name = externalProject.getName();
qName = externalProject.getQName();
version = externalProject.getVersion();
group = externalProject.getGroup();
description = externalProject.getDescription();
projectDir = externalProject.getProjectDir();
buildDir = externalProject.getBuildDir();
buildFile = externalProject.getBuildFile();
externalSystemId = externalProject.getExternalSystemId();
Map<String, ? extends ExternalProject> externalProjectChildProjects = externalProject.getChildProjects();
childProjects = new TreeMap<>();
for (Map.Entry<String, ? extends ExternalProject> entry : externalProjectChildProjects.entrySet()) {
childProjects.put(entry.getKey(), new DefaultExternalProject(entry.getValue()));
}
Map<String, ? extends ExternalTask> externalProjectTasks = externalProject.getTasks();
tasks = new HashMap<>(externalProjectTasks.size());
for (Map.Entry<String, ? extends ExternalTask> entry : externalProjectTasks.entrySet()) {
this.tasks.put(entry.getKey(), new DefaultExternalTask(entry.getValue()));
}
sourceSetModel = new DefaultGradleSourceSetModel(externalProject.getSourceSetModel());
}
@NotNull
@Override
public String getExternalSystemId() {
@@ -177,20 +148,12 @@ public final class DefaultExternalProject implements ExternalProject, ExternalPr
return sourceSetModel.getSourceCompatibility();
}
public void setSourceCompatibility(@Nullable String sourceCompatibility) {
sourceSetModel.setSourceCompatibility(sourceCompatibility);
}
@Override
@Nullable
public String getTargetCompatibility() {
return sourceSetModel.getTargetCompatibility();
}
public void setTargetCompatibility(@Nullable String targetCompatibility) {
sourceSetModel.setTargetCompatibility(targetCompatibility);
}
@NotNull
@Override
public Map<String, DefaultExternalProject> getChildProjects() {
@@ -275,14 +238,6 @@ public final class DefaultExternalProject implements ExternalProject, ExternalPr
return sourceSetModel.getTaskArtifacts();
}
public void setArtifacts(@NotNull List<File> artifacts) {
sourceSetModel.setTaskArtifacts(artifacts);
}
public void setArtifactsByConfiguration(@NotNull Map<String, Set<File>> artifactsByConfiguration) {
sourceSetModel.setConfigurationArtifacts(artifactsByConfiguration);
}
@NotNull
@Override
public Map<String, Set<File>> getArtifactsByConfiguration() {

View File

@@ -28,22 +28,6 @@ public final class DefaultExternalSourceDirectorySet implements ExternalSourceDi
patterns = new FilePatternSetImpl();
}
public DefaultExternalSourceDirectorySet(ExternalSourceDirectorySet sourceDirectorySet) {
name = sourceDirectorySet.getName();
srcDirs = new HashSet<>(sourceDirectorySet.getSrcDirs());
outputDir = sourceDirectorySet.getOutputDir();
gradleOutputDirs = new ArrayList<>(sourceDirectorySet.getGradleOutputDirs());
patterns = new FilePatternSetImpl(sourceDirectorySet.getIncludes(),
sourceDirectorySet.getExcludes());
filters = new ArrayList<>(sourceDirectorySet.getFilters().size());
for (ExternalFilter filter : sourceDirectorySet.getFilters()) {
filters.add(new DefaultExternalFilter(filter));
}
inheritedCompilerOutput = sourceDirectorySet.isCompilerOutputPathInherited();
}
@NotNull
@Override
public String getName() {

View File

@@ -2,7 +2,6 @@
package org.jetbrains.plugins.gradle.model;
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType;
import com.intellij.openapi.externalSystem.model.project.IExternalSystemSourceType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -34,17 +33,6 @@ public final class DefaultExternalSourceSet implements ExternalSourceSet {
artifacts = new ArrayList<>(0);
}
public DefaultExternalSourceSet(ExternalSourceSet sourceSet) {
name = sourceSet.getName();
isPreview = sourceSet.isPreview();
javaToolchainHome = sourceSet.getJavaToolchainHome();
sourceCompatibility = sourceSet.getSourceCompatibility();
targetCompatibility = sourceSet.getTargetCompatibility();
artifacts = copyArtifacts(sourceSet.getArtifacts());
dependencies = ModelFactory.createCopy(sourceSet.getDependencies());
sources = copySources(sourceSet.getSources());
}
@Override
public @NotNull String getName() {
return name;
@@ -131,27 +119,4 @@ public final class DefaultExternalSourceSet implements ExternalSourceSet {
return "sourceSet '" + name + '\'' ;
}
private static @NotNull Map<ExternalSystemSourceType, DefaultExternalSourceDirectorySet> copySources(
@Nullable Map<? extends IExternalSystemSourceType, ? extends ExternalSourceDirectorySet> sources
) {
if (sources == null) {
// Collection can be modified outside by mutation methods
return new LinkedHashMap<>(0);
}
Map<ExternalSystemSourceType, DefaultExternalSourceDirectorySet> result = new LinkedHashMap<>(sources.size());
for (Map.Entry<? extends IExternalSystemSourceType, ? extends ExternalSourceDirectorySet> entry : sources.entrySet()) {
ExternalSystemSourceType sourceType = ExternalSystemSourceType.from(entry.getKey());
DefaultExternalSourceDirectorySet directorySet = new DefaultExternalSourceDirectorySet(entry.getValue());
result.put(sourceType, directorySet);
}
return result;
}
private static @NotNull Collection<File> copyArtifacts(@Nullable Collection<File> artifacts) {
if (artifacts == null) {
// Collection can be modified outside by mutation methods
return new ArrayList<>(0);
}
return new ArrayList<>(artifacts);
}
}