提交 7d46b225 编写于 作者: O Olivier Lamy

[JENKINS-7535] Rebuilding dependency graph slow on large installations

Submitted by evernat.
上级 39f1944b
......@@ -392,8 +392,9 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
for (MavenModule m : Hudson.getInstance().getAllItems(MavenModule.class)) {
if(m.isDisabled()) continue;
modules.put(m.asDependency(),m);
modules.put(m.asDependency().withUnknownVersion(),m);
ModuleDependency moduleDependency = m.asDependency();
modules.put(moduleDependency,m);
modules.put(moduleDependency.withUnknownVersion(),m);
}
// in case two modules with the same name is defined, modules in the same MavenModuleSet
......@@ -401,8 +402,9 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
for (MavenModule m : getParent().getModules()) {
if(m.isDisabled()) continue;
modules.put(m.asDependency(),m);
modules.put(m.asDependency().withUnknownVersion(),m);
ModuleDependency moduleDependency = m.asDependency();
modules.put(moduleDependency,m);
modules.put(moduleDependency.withUnknownVersion(),m);
}
// if the build style is the aggregator build, define dependencies against project,
......
......@@ -51,8 +51,10 @@ public final class ModuleDependency implements Serializable {
public ModuleDependency(String groupId, String artifactId, String version) {
this.groupId = groupId.intern();
this.artifactId = artifactId.intern();
if(version==null) version=UNKNOWN;
this.version = version.intern();
if(version==null)
this.version = UNKNOWN;
else
this.version = version.intern();
}
public ModuleDependency(ModuleName name, String version) {
......@@ -81,6 +83,15 @@ public final class ModuleDependency implements Serializable {
this(ext.getGroupId(),ext.getArtifactId(),ext.getVersion());
}
private ModuleDependency(String groupId, String artifactId) {
// to be used only by the withUnknownVersion() method
// where we know that groupId and artifactId are already interned
// and where we want an UNKNOWN version
this.groupId = groupId;
this.artifactId = artifactId;
this.version = UNKNOWN;
}
public ModuleName getName() {
return new ModuleName(groupId,artifactId);
}
......@@ -89,7 +100,10 @@ public final class ModuleDependency implements Serializable {
* Returns groupId+artifactId plus unknown version.
*/
public ModuleDependency withUnknownVersion() {
return new ModuleDependency(groupId,artifactId,UNKNOWN);
if (UNKNOWN.equals(version))
return this;
else
return new ModuleDependency(groupId,artifactId);
}
public boolean equals(Object o) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册