mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-118795 Gradle configuration with multiple artifacts not all reflected in IDEA module dependencies
This commit is contained in:
+4
-4
@@ -30,7 +30,7 @@ import org.jetbrains.plugins.gradle.model.ProjectDependenciesModel;
|
||||
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.*;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_11.internal.DependencyVersionId;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_11.internal.InternalDependencyVersionId;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ModelDependenciesBuilderImpl implements ModelBuilderService {
|
||||
public Object buildAll(final String modelName, final Project project) {
|
||||
final List<IdeaDependency> dependencies = new ArrayList<IdeaDependency>();
|
||||
|
||||
final Map<DependencyVersionId, Scopes> scopesMap = new LinkedHashMap<DependencyVersionId, Scopes>();
|
||||
final Map<InternalDependencyVersionId, Scopes> scopesMap = new LinkedHashMap<InternalDependencyVersionId, Scopes>();
|
||||
final IdeDependenciesExtractor dependenciesExtractor = new IdeDependenciesExtractor();
|
||||
|
||||
boolean offline = false;
|
||||
@@ -99,8 +99,8 @@ public class ModelDependenciesBuilderImpl implements ModelBuilderService {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<DependencyVersionId, Scopes> entry : scopesMap.entrySet()) {
|
||||
DependencyVersionId versionId = entry.getKey();
|
||||
for (Map.Entry<InternalDependencyVersionId, Scopes> entry : scopesMap.entrySet()) {
|
||||
InternalDependencyVersionId versionId = entry.getKey();
|
||||
for (GradleDependencyScope scope : entry.getValue().getScopes()) {
|
||||
if (versionId.getIdeDependency() instanceof IdeRepoFileDependency) {
|
||||
IdeRepoFileDependency repoFileDependency =
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.v1_11.internal;
|
||||
|
||||
import org.gradle.plugins.ide.internal.resolver.model.IdeDependency;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.DependencyVersionId;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/25/13
|
||||
*/
|
||||
public class InternalDependencyVersionId extends DependencyVersionId {
|
||||
private final IdeDependency myIdeDependency;
|
||||
|
||||
public InternalDependencyVersionId(IdeDependency dependency,
|
||||
String name,
|
||||
String artifactName,
|
||||
String group,
|
||||
String version,
|
||||
String classifier) {
|
||||
super(name, artifactName, group, version, classifier);
|
||||
myIdeDependency = dependency;
|
||||
}
|
||||
|
||||
public IdeDependency getIdeDependency() {
|
||||
return myIdeDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof InternalDependencyVersionId)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
InternalDependencyVersionId id = (InternalDependencyVersionId)o;
|
||||
if (myIdeDependency != null ? !myIdeDependency.equals(id.myIdeDependency) : id.myIdeDependency != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + (myIdeDependency != null ? myIdeDependency.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+15
-8
@@ -84,7 +84,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeProjectDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
@@ -95,8 +95,8 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
final String version = project.hasProperty(VERSION_PROPERTY) ? str(project.property(VERSION_PROPERTY)) : "";
|
||||
final String group = project.hasProperty(GROUP_PROPERTY) ? str(project.property(GROUP_PROPERTY)) : "";
|
||||
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, project.getName(), group, version, null);
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, project.getName(), null, group, version, null);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -110,7 +110,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return String.valueOf(o == null ? "" : o);
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeRepoFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
@@ -128,8 +128,14 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
}
|
||||
|
||||
String classifier = parseClassifier(dependencyId, dependency.getFile());
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, dependencyId.getName(), dependencyId.getGroup(), dependencyId.getVersion(), classifier);
|
||||
String dependencyFileName = null;
|
||||
if (dependency.getFile() != null) {
|
||||
dependencyFileName = dependency.getFile().getName();
|
||||
}
|
||||
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, dependencyId.getName(), dependencyFileName, dependencyId.getGroup(), dependencyId.getVersion(),
|
||||
classifier);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -146,7 +152,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return i != -1 ? dependencyFileName.substring(i, dependencyFileName.length()) : null;
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeLocalFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
|
||||
@@ -155,7 +161,8 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
if (scope == null) return;
|
||||
|
||||
String path = dependency.getFile().getPath();
|
||||
DependencyVersionId versionId = new DependencyVersionId(dependency, path, "", "", null);
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, path, dependency.getFile().getName(), "", "", null);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
|
||||
+4
-4
@@ -30,7 +30,7 @@ import org.jetbrains.plugins.gradle.model.ProjectDependenciesModel;
|
||||
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.*;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_12.internal.DependencyVersionId;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_12.internal.InternalDependencyVersionId;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ModelDependenciesBuilderImpl implements ModelBuilderService {
|
||||
public Object buildAll(final String modelName, final Project project) {
|
||||
final List<IdeaDependency> dependencies = new ArrayList<IdeaDependency>();
|
||||
|
||||
final Map<DependencyVersionId, Scopes> scopesMap = new LinkedHashMap<DependencyVersionId, Scopes>();
|
||||
final Map<InternalDependencyVersionId, Scopes> scopesMap = new LinkedHashMap<InternalDependencyVersionId, Scopes>();
|
||||
final IdeDependenciesExtractor dependenciesExtractor = new IdeDependenciesExtractor();
|
||||
|
||||
boolean offline = false;
|
||||
@@ -99,8 +99,8 @@ public class ModelDependenciesBuilderImpl implements ModelBuilderService {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<DependencyVersionId, Scopes> entry : scopesMap.entrySet()) {
|
||||
DependencyVersionId versionId = entry.getKey();
|
||||
for (Map.Entry<InternalDependencyVersionId, Scopes> entry : scopesMap.entrySet()) {
|
||||
InternalDependencyVersionId versionId = entry.getKey();
|
||||
for (GradleDependencyScope scope : entry.getValue().getScopes()) {
|
||||
if (versionId.getIdeDependency() instanceof IdeExtendedRepoFileDependency) {
|
||||
IdeExtendedRepoFileDependency repoFileDependency =
|
||||
|
||||
-96
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.v1_12.internal;
|
||||
|
||||
import org.gradle.plugins.ide.internal.resolver.model.IdeDependency;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/25/13
|
||||
*/
|
||||
public class DependencyVersionId {
|
||||
private final IdeDependency myIdeDependency;
|
||||
private final String myName;
|
||||
private final String myGroup;
|
||||
private final String myVersion;
|
||||
private final String myClassifier;
|
||||
|
||||
public DependencyVersionId(IdeDependency dependency,
|
||||
String name,
|
||||
String group,
|
||||
String version,
|
||||
String classifier) {
|
||||
myIdeDependency = dependency;
|
||||
myName = name;
|
||||
myGroup = group;
|
||||
myVersion = version;
|
||||
myClassifier = classifier;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return myGroup;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return myVersion;
|
||||
}
|
||||
|
||||
public String getClassifier() {
|
||||
return myClassifier;
|
||||
}
|
||||
|
||||
public IdeDependency getIdeDependency() {
|
||||
return myIdeDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof DependencyVersionId)) return false;
|
||||
|
||||
DependencyVersionId id = (DependencyVersionId)o;
|
||||
|
||||
if (myGroup != null ? !myGroup.equals(id.myGroup) : id.myGroup != null) return false;
|
||||
if (myName != null ? !myName.equals(id.myName) : id.myName != null) return false;
|
||||
if (myVersion != null ? !myVersion.equals(id.myVersion) : id.myVersion != null) return false;
|
||||
if (myClassifier != null ? !myClassifier.equals(id.myClassifier) : id.myClassifier != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = myName != null ? myName.hashCode() : 0;
|
||||
result = 31 * result + (myGroup != null ? myGroup.hashCode() : 0);
|
||||
result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
|
||||
result = 31 * result + (myClassifier != null ? myClassifier.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DependencyVersionId{" +
|
||||
"name='" + myName + '\'' +
|
||||
", group='" + myGroup + '\'' +
|
||||
", version='" + myVersion + '\'' +
|
||||
", classifier='" + myClassifier + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.v1_12.internal;
|
||||
|
||||
import org.gradle.plugins.ide.internal.resolver.model.IdeDependency;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.DependencyVersionId;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/25/13
|
||||
*/
|
||||
public class InternalDependencyVersionId extends DependencyVersionId {
|
||||
private final IdeDependency myIdeDependency;
|
||||
|
||||
public InternalDependencyVersionId(IdeDependency dependency,
|
||||
String name,
|
||||
String artifactName,
|
||||
String group,
|
||||
String version,
|
||||
String classifier) {
|
||||
super(name, artifactName, group, version, classifier);
|
||||
myIdeDependency = dependency;
|
||||
}
|
||||
|
||||
public IdeDependency getIdeDependency() {
|
||||
return myIdeDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof InternalDependencyVersionId)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
InternalDependencyVersionId id = (InternalDependencyVersionId)o;
|
||||
if (myIdeDependency != null ? !myIdeDependency.equals(id.myIdeDependency) : id.myIdeDependency != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + (myIdeDependency != null ? myIdeDependency.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+15
-8
@@ -81,7 +81,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeProjectDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
@@ -92,8 +92,8 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
final String version = project.hasProperty(VERSION_PROPERTY) ? str(project.property(VERSION_PROPERTY)) : "";
|
||||
final String group = project.hasProperty(GROUP_PROPERTY) ? str(project.property(GROUP_PROPERTY)) : "";
|
||||
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, project.getName(), group, version, null);
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, project.getName(), null, group, version, null);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -107,7 +107,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return String.valueOf(o == null ? "" : o);
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeExtendedRepoFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
@@ -125,8 +125,14 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
}
|
||||
|
||||
String classifier = parseClassifier(dependencyId, dependency.getFile());
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, dependencyId.getName(), dependencyId.getGroup(), dependencyId.getVersion(), classifier);
|
||||
String dependencyFileName = null;
|
||||
if (dependency.getFile() != null) {
|
||||
dependencyFileName = dependency.getFile().getName();
|
||||
}
|
||||
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, dependencyId.getName(), dependencyFileName, dependencyId.getGroup(), dependencyId.getVersion(),
|
||||
classifier);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -143,7 +149,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return i != -1 ? dependencyFileName.substring(i, dependencyFileName.length()) : null;
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeLocalFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
|
||||
@@ -152,7 +158,8 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
if (scope == null) return;
|
||||
|
||||
String path = dependency.getFile().getPath();
|
||||
DependencyVersionId versionId = new DependencyVersionId(dependency, path, "", "", null);
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, path, dependency.getFile().getName(), "", "", null);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
|
||||
+4
-4
@@ -27,7 +27,7 @@ import org.jetbrains.plugins.gradle.model.ProjectDependenciesModel;
|
||||
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.*;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_9.internal.DependencyVersionId;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_9.internal.InternalDependencyVersionId;
|
||||
import org.jetbrains.plugins.gradle.tooling.v1_9.internal.ModelDependenciesBuilderImplHelper;
|
||||
|
||||
import java.util.*;
|
||||
@@ -49,7 +49,7 @@ public class ModelDependenciesBuilderImpl implements ModelBuilderService {
|
||||
|
||||
final List<IdeaDependency> dependencies = new ArrayList<IdeaDependency>();
|
||||
|
||||
final Map<DependencyVersionId, Scopes> scopesMap = new LinkedHashMap<DependencyVersionId, Scopes>();
|
||||
final Map<InternalDependencyVersionId, Scopes> scopesMap = new LinkedHashMap<InternalDependencyVersionId, Scopes>();
|
||||
final IdeDependenciesExtractor dependenciesExtractor = new IdeDependenciesExtractor();
|
||||
|
||||
boolean offline = false;
|
||||
@@ -95,8 +95,8 @@ public class ModelDependenciesBuilderImpl implements ModelBuilderService {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<DependencyVersionId, Scopes> entry : scopesMap.entrySet()) {
|
||||
DependencyVersionId versionId = entry.getKey();
|
||||
for (Map.Entry<InternalDependencyVersionId, Scopes> entry : scopesMap.entrySet()) {
|
||||
InternalDependencyVersionId versionId = entry.getKey();
|
||||
for (GradleDependencyScope scope : entry.getValue().getScopes()) {
|
||||
if (versionId.getIdeDependency() instanceof IdeDependenciesExtractor.IdeRepoFileDependency) {
|
||||
IdeDependenciesExtractor.IdeRepoFileDependency repoFileDependency =
|
||||
|
||||
-96
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.v1_9.internal;
|
||||
|
||||
import org.gradle.plugins.ide.internal.IdeDependenciesExtractor;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/25/13
|
||||
*/
|
||||
public class DependencyVersionId {
|
||||
private final IdeDependenciesExtractor.IdeDependency myIdeDependency;
|
||||
private final String myName;
|
||||
private final String myGroup;
|
||||
private final String myVersion;
|
||||
private final String myClassifier;
|
||||
|
||||
public DependencyVersionId(IdeDependenciesExtractor.IdeDependency dependency,
|
||||
String name,
|
||||
String group,
|
||||
String version,
|
||||
String classifier) {
|
||||
myIdeDependency = dependency;
|
||||
myName = name;
|
||||
myGroup = group;
|
||||
myVersion = version;
|
||||
myClassifier = classifier;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return myGroup;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return myVersion;
|
||||
}
|
||||
|
||||
public String getClassifier() {
|
||||
return myClassifier;
|
||||
}
|
||||
|
||||
public IdeDependenciesExtractor.IdeDependency getIdeDependency() {
|
||||
return myIdeDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof DependencyVersionId)) return false;
|
||||
|
||||
DependencyVersionId id = (DependencyVersionId)o;
|
||||
|
||||
if (myGroup != null ? !myGroup.equals(id.myGroup) : id.myGroup != null) return false;
|
||||
if (myName != null ? !myName.equals(id.myName) : id.myName != null) return false;
|
||||
if (myVersion != null ? !myVersion.equals(id.myVersion) : id.myVersion != null) return false;
|
||||
if (myClassifier != null ? !myClassifier.equals(id.myClassifier) : id.myClassifier != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = myName != null ? myName.hashCode() : 0;
|
||||
result = 31 * result + (myGroup != null ? myGroup.hashCode() : 0);
|
||||
result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
|
||||
result = 31 * result + (myClassifier != null ? myClassifier.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DependencyVersionId{" +
|
||||
"name='" + myName + '\'' +
|
||||
", group='" + myGroup + '\'' +
|
||||
", version='" + myVersion + '\'' +
|
||||
", classifier='" + myClassifier + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.v1_9.internal;
|
||||
|
||||
import org.gradle.plugins.ide.internal.IdeDependenciesExtractor;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.DependencyVersionId;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/25/13
|
||||
*/
|
||||
public class InternalDependencyVersionId extends DependencyVersionId {
|
||||
private final IdeDependenciesExtractor.IdeDependency myIdeDependency;
|
||||
|
||||
public InternalDependencyVersionId(IdeDependenciesExtractor.IdeDependency dependency,
|
||||
String name,
|
||||
String artifactName,
|
||||
String group,
|
||||
String version,
|
||||
String classifier) {
|
||||
super(name, artifactName, group, version, classifier);
|
||||
myIdeDependency = dependency;
|
||||
}
|
||||
|
||||
public IdeDependenciesExtractor.IdeDependency getIdeDependency() {
|
||||
return myIdeDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof InternalDependencyVersionId)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
InternalDependencyVersionId id = (InternalDependencyVersionId)o;
|
||||
if (myIdeDependency != null ? !myIdeDependency.equals(id.myIdeDependency) : id.myIdeDependency != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + (myIdeDependency != null ? myIdeDependency.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+23
-17
@@ -44,7 +44,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
|
||||
|
||||
public static void attachGradleSdkSources(IdeaSingleEntryLibraryDependencyImpl libraryDependency,
|
||||
IdeDependenciesExtractor.IdeLocalFileDependency localFileDependency) {
|
||||
IdeDependenciesExtractor.IdeLocalFileDependency localFileDependency) {
|
||||
final String libName = localFileDependency.getFile().getName();
|
||||
if (localFileDependency.getFile() == null || !libName.startsWith("gradle-")) return;
|
||||
|
||||
@@ -81,9 +81,9 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
IdeDependenciesExtractor.IdeProjectDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeDependenciesExtractor.IdeProjectDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
final GradleDependencyScope scope = deduceScope(configurationName, userScopes);
|
||||
if (scope == null) return;
|
||||
@@ -92,8 +92,8 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
final String version = project.hasProperty(VERSION_PROPERTY) ? str(project.property(VERSION_PROPERTY)) : "";
|
||||
final String group = project.hasProperty(GROUP_PROPERTY) ? str(project.property(GROUP_PROPERTY)) : "";
|
||||
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, project.getName(), group, version, null);
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, project.getName(), null, group, version, null);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -107,9 +107,9 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return String.valueOf(o == null ? "" : o);
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
IdeDependenciesExtractor.IdeRepoFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeDependenciesExtractor.IdeRepoFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
final GradleDependencyScope scope = deduceScope(configurationName, userScopes);
|
||||
if (scope == null) return;
|
||||
@@ -125,8 +125,14 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
}
|
||||
|
||||
String classifier = parseClassifier(dependencyId, dependency.getFile());
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, dependencyId.getName(), dependencyId.getGroup(), dependencyId.getVersion(), classifier);
|
||||
String dependencyFileName = null;
|
||||
if (dependency.getFile() != null) {
|
||||
dependencyFileName = dependency.getFile().getName();
|
||||
}
|
||||
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, dependencyId.getName(), dependencyFileName, dependencyId.getGroup(), dependencyId.getVersion(),
|
||||
classifier);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -143,17 +149,17 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
return i != -1 ? dependencyFileName.substring(i, dependencyFileName.length()) : null;
|
||||
}
|
||||
|
||||
public static void merge(Map<DependencyVersionId, Scopes> map,
|
||||
IdeDependenciesExtractor.IdeLocalFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
public static void merge(Map<InternalDependencyVersionId, Scopes> map,
|
||||
IdeDependenciesExtractor.IdeLocalFileDependency dependency,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
|
||||
final String configurationName = dependency.getDeclaredConfiguration().getName();
|
||||
final GradleDependencyScope scope = deduceScope(configurationName, userScopes);
|
||||
if (scope == null) return;
|
||||
|
||||
String path = dependency.getFile().getPath();
|
||||
DependencyVersionId versionId =
|
||||
new DependencyVersionId(dependency, path, "", "", null);
|
||||
InternalDependencyVersionId versionId =
|
||||
new InternalDependencyVersionId(dependency, path, dependency.getFile().getName(), "", "", null);
|
||||
Scopes scopes = map.get(versionId);
|
||||
if (scopes == null) {
|
||||
map.put(versionId, new Scopes(scope));
|
||||
@@ -172,7 +178,7 @@ public class ModelDependenciesBuilderImplHelper {
|
||||
* @return deduced scope
|
||||
*/
|
||||
public static GradleDependencyScope deduceScope(String configurationName,
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
Map<String, Map<String, Collection<Configuration>>> userScopes) {
|
||||
GradleDependencyScope scope = GradleDependencyScope.fromName(configurationName);
|
||||
for (Map.Entry<String, Map<String, Collection<Configuration>>> entry : userScopes.entrySet()) {
|
||||
Collection<Configuration> plusConfigurations = entry.getValue().get("plus");
|
||||
|
||||
+12
-11
@@ -13,28 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.v1_11.internal;
|
||||
|
||||
import org.gradle.plugins.ide.internal.resolver.model.IdeDependency;
|
||||
package org.jetbrains.plugins.gradle.tooling.internal;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/25/13
|
||||
*/
|
||||
public class DependencyVersionId {
|
||||
private final IdeDependency myIdeDependency;
|
||||
private final String myName;
|
||||
private final String myArtifactName;
|
||||
private final String myGroup;
|
||||
private final String myVersion;
|
||||
private final String myClassifier;
|
||||
|
||||
public DependencyVersionId(IdeDependency dependency,
|
||||
String name,
|
||||
public DependencyVersionId(String name,
|
||||
String artifactName,
|
||||
String group,
|
||||
String version,
|
||||
String classifier) {
|
||||
myIdeDependency = dependency;
|
||||
myName = name;
|
||||
myArtifactName = artifactName;
|
||||
myGroup = group;
|
||||
myVersion = version;
|
||||
myClassifier = classifier;
|
||||
@@ -44,6 +42,10 @@ public class DependencyVersionId {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public String getArtifactName() {
|
||||
return myArtifactName;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return myGroup;
|
||||
}
|
||||
@@ -56,10 +58,6 @@ public class DependencyVersionId {
|
||||
return myClassifier;
|
||||
}
|
||||
|
||||
public IdeDependency getIdeDependency() {
|
||||
return myIdeDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
@@ -69,6 +67,7 @@ public class DependencyVersionId {
|
||||
|
||||
if (myGroup != null ? !myGroup.equals(id.myGroup) : id.myGroup != null) return false;
|
||||
if (myName != null ? !myName.equals(id.myName) : id.myName != null) return false;
|
||||
if (myArtifactName != null ? !myArtifactName.equals(id.myArtifactName) : id.myArtifactName != null) return false;
|
||||
if (myVersion != null ? !myVersion.equals(id.myVersion) : id.myVersion != null) return false;
|
||||
if (myClassifier != null ? !myClassifier.equals(id.myClassifier) : id.myClassifier != null) return false;
|
||||
|
||||
@@ -78,6 +77,7 @@ public class DependencyVersionId {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = myName != null ? myName.hashCode() : 0;
|
||||
result = 31 * result + (myArtifactName != null ? myArtifactName.hashCode() : 0);
|
||||
result = 31 * result + (myGroup != null ? myGroup.hashCode() : 0);
|
||||
result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
|
||||
result = 31 * result + (myClassifier != null ? myClassifier.hashCode() : 0);
|
||||
@@ -88,6 +88,7 @@ public class DependencyVersionId {
|
||||
public String toString() {
|
||||
return "DependencyVersionId{" +
|
||||
"name='" + myName + '\'' +
|
||||
", artifactName='" + myArtifactName + '\'' +
|
||||
", group='" + myGroup + '\'' +
|
||||
", version='" + myVersion + '\'' +
|
||||
", classifier='" + myClassifier + '\'' +
|
||||
Reference in New Issue
Block a user