mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-06 00:25:58 +00:00
added hyperlinking to plugin details.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2934 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
e477d65c26
commit
09c6316e75
2 files changed
+47
No files matched your search
@@ -9,6 +9,7 @@ import hudson.model.Items;
|
||||
import hudson.model.JobPropertyDescriptor;
|
||||
import hudson.model.Job;
|
||||
import hudson.model.Action;
|
||||
import hudson.maven.ExecutedMojo;
|
||||
import org.kohsuke.stapler.Ancestor;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
@@ -375,4 +376,8 @@ public class Functions {
|
||||
if(o==null) return 0;
|
||||
return ASTSizeFunction.sizeOf(o);
|
||||
}
|
||||
|
||||
public static ExecutedMojo.Cache createExecutedMojoCache() {
|
||||
return new ExecutedMojo.Cache();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
package hudson.maven;
|
||||
|
||||
import hudson.Util;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.remoting.Which;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Persisted record of mojo execution.
|
||||
@@ -80,4 +84,42 @@ public final class ExecutedMojo implements Serializable {
|
||||
if(executionId==null) return "-";
|
||||
else return executionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hyperlink for the plugin name if there's one.
|
||||
* Otherwise null.
|
||||
*/
|
||||
public String getPluginLink(Cache c) {
|
||||
MavenModule m = c.get(this);
|
||||
if(m!=null)
|
||||
return Stapler.getCurrentRequest().getContextPath()+m.getUrl();
|
||||
if(groupId.equals("org.apache.maven.plugins"))
|
||||
return "http://maven.apache.org/plugins/"+artifactId+'/';
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getGoalLink(Cache c) {
|
||||
if(groupId.equals("org.apache.maven.plugins"))
|
||||
return "http://maven.apache.org/plugins/"+artifactId+'/'+goal+"-mojo.html";
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used during the HTML rendering to cache the index.
|
||||
*/
|
||||
public static final class Cache {
|
||||
/**
|
||||
* All maven modules in this Hudson by their names.
|
||||
*/
|
||||
public final Map<ModuleName,MavenModule> modules = new HashMap<ModuleName,MavenModule>();
|
||||
|
||||
public Cache() {
|
||||
for( MavenModule m : Hudson.getInstance().getAllItems(MavenModule.class))
|
||||
modules.put(m.getModuleName(),m);
|
||||
}
|
||||
|
||||
public MavenModule get(ExecutedMojo mojo) {
|
||||
return modules.get(new ModuleName(mojo.groupId,mojo.artifactId));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user