Skip to content
Permalink
Browse files
[JENKINS-31162] First commit after merge with Gus's work
  • Loading branch information
recena committed Mar 14, 2016
2 parents 0b0b21d + 3658e1e commit c1a06493e4fd01b4a53a43bcf43e3c417f5f2c51
Showing 54 changed files with 2,280 additions and 143 deletions.
@@ -54,12 +54,16 @@

<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
</ul>
</div><!--=TRUNK-END=-->
<h3><a name=v2.0-alpha-3>What's new in 2.0-alpha-3</a> (2016/03/10)</h3>
<ul class=image>
<li class="bug">
Under some conditions Jenkins startup could fail because of incorrectly linked extensions; now recovering more gracefully.
(<a href-"https://issues.jenkins-ci.org/browse/JENKINS-25440">issue 25440</a>)
</ul>
</div><!--=TRUNK-END=-->
<h3><a name=v1.651>What's new in 1.651</a> (2016/02/28)</h3>
<ul class=image>
<li class="rfe">
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>2.0-alpha-3-SNAPSHOT</version>
<version>2.0-alpha-4-SNAPSHOT</version>
</parent>

<artifactId>cli</artifactId>
@@ -29,7 +29,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>2.0-alpha-3-SNAPSHOT</version>
<version>2.0-alpha-4-SNAPSHOT</version>
</parent>

<artifactId>jenkins-core</artifactId>
@@ -41,7 +41,7 @@ THE SOFTWARE.
<staplerFork>true</staplerFork>
<stapler.version>1.240</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>1.8.9</groovy.version>
<groovy.version>2.4.6</groovy.version>
</properties>

<dependencies>
@@ -411,13 +411,13 @@ THE SOFTWARE.
<dependency><!-- groovy shell uses this but uses an optional dependency -->
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>1.0</version>
<version>2.12</version>
<scope>compile</scope>
</dependency>
<dependency><!-- groovy shell uses this but it doesn't declare this dependency -->
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.9</version>
<version>1.11</version>
</dependency>
<dependency>
<!--
@@ -41,7 +41,7 @@
import java.util.ArrayList;

import jline.UnsupportedTerminal;
import jline.Terminal;
import jline.TerminalFactory;
import org.kohsuke.args4j.Argument;

/**
@@ -65,10 +65,18 @@ protected int run() {

// this being remote means no jline capability is available
System.setProperty("jline.terminal", UnsupportedTerminal.class.getName());
Terminal.resetTerminal();
TerminalFactory.reset();

StringBuilder commandLine = new StringBuilder();
for (String arg : args) {
if (commandLine.length() > 0) {
commandLine.append(" ");
}
commandLine.append(arg);
}

Groovysh shell = createShell(stdin, stdout, stderr);
return shell.run(args.toArray(new String[args.size()]));
return shell.run(commandLine.toString());
}

@SuppressWarnings({"unchecked","rawtypes"})
@@ -101,7 +109,7 @@ public Object doCall(Object[] args) {
}
};
Groovysh shell = new Groovysh(cl, binding, io, registrar);
shell.getImports().add("import hudson.model.*");
shell.getImports().add("hudson.model.*");

// defaultErrorHook doesn't re-throw IOException, so ShellRunner in
// Groovysh will keep looping forever if we don't terminate when the
@@ -39,6 +39,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -132,7 +133,7 @@ public void parse(InputStream script, Binding binding) {
cc.setScriptBaseClass(ClosureScript.class.getName());
GroovyShell shell = new GroovyShell(classLoader,binding,cc);

ClosureScript s = (ClosureScript)shell.parse(script);
ClosureScript s = (ClosureScript)shell.parse(new InputStreamReader(script));
s.setDelegate(this);
s.run();
}
@@ -336,7 +337,7 @@ public Object call(Object... args) {

GroovyShell shell = classLoader != null ? new GroovyShell(classLoader,b) : new GroovyShell(b);
for (Resource resource : resources) {
shell.evaluate(resource.getInputStream());
shell.evaluate(new InputStreamReader(resource.getInputStream()));
}
}

@@ -0,0 +1,37 @@
package jenkins.model.ItemCategory;

import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.export.Flavor;

import javax.servlet.ServletException;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* It is a logic representation of a set of {$Category}.
*/
@ExportedBean
public class Categories implements HttpResponse, Serializable {

private List<Category> items;

public Categories() {
items = new ArrayList<Category>();
}

@Exported(name = "categories")
public List<Category> getItems() {
return items;
}

@Override
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
rsp.serveExposedBean(req, this, Flavor.JSON);
}
}
@@ -0,0 +1,68 @@
package jenkins.model.ItemCategory;

import hudson.model.TopLevelItem;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
* Represents an {$link ItemCategory} and its {@link TopLevelItem}s.
*/
@ExportedBean
public class Category implements Serializable {

private String id;

private String name;

private String description;

private String iconClassName;

private int weight;

private List<Map<String, Object>> items;

public Category(String id, String name, String description, String iconClassName, int weight, List<Map<String, Object>> items) {
this.id= id;
this.name = name;
this.description = description;
this.iconClassName = iconClassName;
this.weight = weight;
this.items = items;
}

@Exported
public String getId() {
return id;
}

@Exported
public String getName() {
return name;
}

@Exported
public String getDescription() {
return description;
}

@Exported
public String getIconClassName() {
return iconClassName;
}

@Exported
public int getWeight() {
return weight;
}

@Exported
public List<Map<String, Object>> getItems() {
return items;
}

}
@@ -0,0 +1,74 @@
package jenkins.model.ItemCategory;

import hudson.Extension;
import hudson.ExtensionPoint;
import hudson.model.ModelObject;
import jenkins.model.Messages;

/**
* A category for {@link hudson.model.Item}s.
*/
public abstract class ItemCategory implements ModelObject, ExtensionPoint {

/**
* Identifier, e.g. "category-id-default", etc.
*
* @return the identifier
*/
public abstract String getId();

/**
* The icon class specification e.g. 'category-icon-folder', 'category-icon-default', etc.
*
* @return the icon class specification
*/
public abstract String getIconClassName();

/**
* The description in plain text
*
* @return the description
*/
public abstract String getDescription();

/**
* Helpful to set the order.
*
* @return the weight
*/
public abstract int getWeight();

/**
* The default category, if an item doesn't belong anywhere else, this is where it goes by default.
*/
@Extension
public static final class Default extends ItemCategory {

@Override
public String getId() {
return "category-id-default";
}

@Override
public String getIconClassName() {
return "category-icon-default";
}

@Override
public String getDescription() {
return Messages.ItemCategory_BasicProjects_Description();
}

@Override
public String getDisplayName() {
return Messages.ItemCategory_BasicProjects_DisplayName();
}

@Override
public int getWeight() {
return Integer.MIN_VALUE;
}

}

}

0 comments on commit c1a0649

Please sign in to comment.