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