提交 7423d30e 编写于 作者: J Jesse Glick

[FIXED JENKINS-23365] Noting merge of #1257.

上级 38e81a69
...@@ -61,6 +61,9 @@ Upcoming changes</a> ...@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class=rfe> <li class=rfe>
Support the range notation for pagination in API Support the range notation for pagination in API
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23228">issue 23228</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-23228">issue 23228</a>)
<li class=rfe>
API changes allowing new job types to use SCM plugins.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23365">issue 23365</a>)
<li class=rfe> <li class=rfe>
API changes allowing to create nested launchers (<code>DecoratedLauncher</code>) API changes allowing to create nested launchers (<code>DecoratedLauncher</code>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19454">issue 19454</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-19454">issue 19454</a>)
......
...@@ -71,7 +71,7 @@ public abstract class Cause { ...@@ -71,7 +71,7 @@ public abstract class Cause {
/** /**
* Called when the cause is registered. * Called when the cause is registered.
* @since TODO * @since 1.568
*/ */
public void onAddedTo(@Nonnull Run build) { public void onAddedTo(@Nonnull Run build) {
if (build instanceof AbstractBuild) { if (build instanceof AbstractBuild) {
...@@ -90,7 +90,7 @@ public abstract class Cause { ...@@ -90,7 +90,7 @@ public abstract class Cause {
* Called when a build is loaded from disk. * Called when a build is loaded from disk.
* Useful in case the cause needs to keep a build reference; * Useful in case the cause needs to keep a build reference;
* this ought to be {@code transient}. * this ought to be {@code transient}.
* @since TODO * @since 1.568
*/ */
public void onLoad(@Nonnull Run<?,?> build) { public void onLoad(@Nonnull Run<?,?> build) {
if (build instanceof AbstractBuild) { if (build instanceof AbstractBuild) {
......
...@@ -63,7 +63,7 @@ public abstract class SCMListener implements ExtensionPoint { ...@@ -63,7 +63,7 @@ public abstract class SCMListener implements ExtensionPoint {
* Should be called immediately after {@link SCM#checkout(Run, Launcher, FilePath, TaskListener, File)} is called. * Should be called immediately after {@link SCM#checkout(Run, Launcher, FilePath, TaskListener, File)} is called.
* @param pollingBaseline information about what actually was checked out, if that is available, and this checkout is intended to be included in the build’s polling (if it does any at all) * @param pollingBaseline information about what actually was checked out, if that is available, and this checkout is intended to be included in the build’s polling (if it does any at all)
* @throws Exception if the checkout should be considered failed * @throws Exception if the checkout should be considered failed
* @since TODO * @since 1.568
*/ */
public void onCheckout(Run<?,?> build, SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception {} public void onCheckout(Run<?,?> build, SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception {}
...@@ -106,6 +106,7 @@ public abstract class SCMListener implements ExtensionPoint { ...@@ -106,6 +106,7 @@ public abstract class SCMListener implements ExtensionPoint {
* @throws Exception * @throws Exception
* If any exception is thrown from this method, it will be recorded * If any exception is thrown from this method, it will be recorded
* and causes the build to fail. * and causes the build to fail.
* @since 1.568
*/ */
public void onChangeLogParsed(Run<?,?> build, SCM scm, TaskListener listener, ChangeLogSet<?> changelog) throws Exception { public void onChangeLogParsed(Run<?,?> build, SCM scm, TaskListener listener, ChangeLogSet<?> changelog) throws Exception {
if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCMListener.class, getClass(), "onChangeLogParsed", AbstractBuild.class, BuildListener.class, ChangeLogSet.class)) { if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCMListener.class, getClass(), "onChangeLogParsed", AbstractBuild.class, BuildListener.class, ChangeLogSet.class)) {
...@@ -118,6 +119,9 @@ public abstract class SCMListener implements ExtensionPoint { ...@@ -118,6 +119,9 @@ public abstract class SCMListener implements ExtensionPoint {
onChangeLogParsed((Run) build, build.getProject().getScm(), listener, changelog); onChangeLogParsed((Run) build, build.getProject().getScm(), listener, changelog);
} }
/**
* @since 1.568
*/
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static Collection<? extends SCMListener> all() { public static Collection<? extends SCMListener> all() {
Jenkins j = Jenkins.getInstance(); Jenkins j = Jenkins.getInstance();
......
...@@ -52,6 +52,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa ...@@ -52,6 +52,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa
@Deprecated @Deprecated
protected transient /*final*/ AbstractBuild build; protected transient /*final*/ AbstractBuild build;
/**
* @since 1.568
*/
protected AbstractScmTagAction(Run<?,?> run) { protected AbstractScmTagAction(Run<?,?> run) {
this.run = run; this.run = run;
this.build = run instanceof AbstractBuild ? (AbstractBuild) run : null; this.build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
...@@ -74,6 +77,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa ...@@ -74,6 +77,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa
return SCM.TAG; return SCM.TAG;
} }
/**
* @since 1.568
*/
public Run<?,?> getRun() { public Run<?,?> getRun() {
return run; return run;
} }
......
...@@ -76,6 +76,7 @@ public abstract class ChangeLogAnnotator implements ExtensionPoint { ...@@ -76,6 +76,7 @@ public abstract class ChangeLogAnnotator implements ExtensionPoint {
* are registered, the object may already contain some markups when this * are registered, the object may already contain some markups when this
* method is invoked. Never null. {@link MarkupText#getText()} on this instance * method is invoked. Never null. {@link MarkupText#getText()} on this instance
* will return the same string as {@link Entry#getMsgEscaped()}. * will return the same string as {@link Entry#getMsgEscaped()}.
* @since 1.568
*/ */
public void annotate(Run<?,?> build, Entry change, MarkupText text) { public void annotate(Run<?,?> build, Entry change, MarkupText text) {
if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogAnnotator.class, getClass(), "annotate", AbstractBuild.class, Entry.class, MarkupText.class)) { if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogAnnotator.class, getClass(), "annotate", AbstractBuild.class, Entry.class, MarkupText.class)) {
......
...@@ -41,6 +41,9 @@ import org.xml.sax.SAXException; ...@@ -41,6 +41,9 @@ import org.xml.sax.SAXException;
*/ */
public abstract class ChangeLogParser { public abstract class ChangeLogParser {
/**
* @since 1.568
*/
public ChangeLogSet<? extends Entry> parse(Run build, RepositoryBrowser<?> browser, File changelogFile) throws IOException, SAXException { public ChangeLogSet<? extends Entry> parse(Run build, RepositoryBrowser<?> browser, File changelogFile) throws IOException, SAXException {
if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, File.class)) { if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, File.class)) {
return parse((AbstractBuild) build, changelogFile); return parse((AbstractBuild) build, changelogFile);
......
...@@ -62,6 +62,9 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter ...@@ -62,6 +62,9 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
public final AbstractBuild<?,?> build; public final AbstractBuild<?,?> build;
private final RepositoryBrowser</* ideally T */?> browser; private final RepositoryBrowser</* ideally T */?> browser;
/**
* @since 1.568
*/
protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) { protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) {
this.run = run; this.run = run;
build = run instanceof AbstractBuild ? (AbstractBuild) run : null; build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
...@@ -79,10 +82,16 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter ...@@ -79,10 +82,16 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
return build.getParent().getScm().getEffectiveBrowser(); return build.getParent().getScm().getEffectiveBrowser();
} }
/**
* @since 1.568
*/
public Run<?,?> getRun() { public Run<?,?> getRun() {
return run; return run;
} }
/**
* @since 1.568
*/
public RepositoryBrowser<?> getBrowser() { public RepositoryBrowser<?> getBrowser() {
return browser; return browser;
} }
...@@ -116,6 +125,7 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter ...@@ -116,6 +125,7 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
/** /**
* Constant instance that represents no changes. * Constant instance that represents no changes.
* @since 1.568
*/ */
public static ChangeLogSet<? extends ChangeLogSet.Entry> createEmpty(Run build) { public static ChangeLogSet<? extends ChangeLogSet.Entry> createEmpty(Run build) {
return new EmptyChangeLogSet(build); return new EmptyChangeLogSet(build);
......
...@@ -209,7 +209,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -209,7 +209,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
* true if {@link SCM} is OK to let Hudson proceed with deleting the workspace. * true if {@link SCM} is OK to let Hudson proceed with deleting the workspace.
* False to veto the workspace deletion. * False to veto the workspace deletion.
* *
* @since 1.246 * @since 1.568
*/ */
public boolean processWorkspaceBeforeDeletion(Job<?,?> project, FilePath workspace, Node node) throws IOException, InterruptedException { public boolean processWorkspaceBeforeDeletion(Job<?,?> project, FilePath workspace, Node node) throws IOException, InterruptedException {
if (project instanceof AbstractProject) { if (project instanceof AbstractProject) {
...@@ -308,6 +308,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -308,6 +308,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
* @throws InterruptedException * @throws InterruptedException
* interruption is usually caused by the user aborting the computation. * interruption is usually caused by the user aborting the computation.
* this exception should be simply propagated all the way up. * this exception should be simply propagated all the way up.
* @since 1.568
*/ */
public SCMRevisionState calcRevisionsFromBuild(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { public SCMRevisionState calcRevisionsFromBuild(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) { if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) {
...@@ -370,6 +371,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -370,6 +371,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
* @throws InterruptedException * @throws InterruptedException
* interruption is usually caused by the user aborting the computation. * interruption is usually caused by the user aborting the computation.
* this exception should be simply propagated all the way up. * this exception should be simply propagated all the way up.
* @since 1.568
*/ */
public PollingResult compareRemoteRevisionWith(Job<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException { public PollingResult compareRemoteRevisionWith(Job<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException {
if (project instanceof AbstractProject && Util.isOverridden(SCM.class, getClass(), "compareRemoteRevisionWith", AbstractProject.class, Launcher.class, FilePath.class, TaskListener.class, SCMRevisionState.class)) { if (project instanceof AbstractProject && Util.isOverridden(SCM.class, getClass(), "compareRemoteRevisionWith", AbstractProject.class, Launcher.class, FilePath.class, TaskListener.class, SCMRevisionState.class)) {
...@@ -445,6 +447,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -445,6 +447,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
* interruption is usually caused by the user aborting the build. * interruption is usually caused by the user aborting the build.
* this exception will cause the build to be aborted. * this exception will cause the build to be aborted.
* @throws AbortException in case of a routine failure * @throws AbortException in case of a routine failure
* @since 1.568
*/ */
public void checkout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile) throws IOException, InterruptedException { public void checkout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile) throws IOException, InterruptedException {
if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCM.class, getClass(), "checkout", AbstractBuild.class, Launcher.class, FilePath.class, BuildListener.class, File.class)) { if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCM.class, getClass(), "checkout", AbstractBuild.class, Launcher.class, FilePath.class, BuildListener.class, File.class)) {
...@@ -475,7 +478,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -475,7 +478,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
/** /**
* Get a chance to do operations after the workspace i checked out and the changelog is written. * Get a chance to do operations after the workspace i checked out and the changelog is written.
* @since 1.534, 1.532.1 * @since 1.568
*/ */
public void postCheckout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener) throws IOException, InterruptedException { public void postCheckout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener) throws IOException, InterruptedException {
if (build instanceof AbstractBuild && listener instanceof BuildListener) { if (build instanceof AbstractBuild && listener instanceof BuildListener) {
...@@ -653,6 +656,9 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -653,6 +656,9 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
} }
} }
/**
* @since 1.568
*/
protected final void createEmptyChangeLog(File changelogFile, TaskListener listener, String rootTag) throws IOException { protected final void createEmptyChangeLog(File changelogFile, TaskListener listener, String rootTag) throws IOException {
FileWriter w = null; FileWriter w = null;
try { try {
...@@ -686,6 +692,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -686,6 +692,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
/** /**
* Returns the list of {@link SCMDescriptor}s that are applicable to the given project. * Returns the list of {@link SCMDescriptor}s that are applicable to the given project.
* @since 1.568
*/ */
public static List<SCMDescriptor<?>> _for(final Job project) { public static List<SCMDescriptor<?>> _for(final Job project) {
if(project==null) return all(); if(project==null) return all();
...@@ -715,7 +722,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint { ...@@ -715,7 +722,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
* Try to guess how a repository browser should be configured, based on URLs and the like. * Try to guess how a repository browser should be configured, based on URLs and the like.
* Used when {@link #getBrowser} has not been explicitly configured. * Used when {@link #getBrowser} has not been explicitly configured.
* @return a reasonable default value for {@link #getEffectiveBrowser}, or null * @return a reasonable default value for {@link #getEffectiveBrowser}, or null
* @since TODO * @since 1.568
*/ */
public @CheckForNull RepositoryBrowser<?> guessBrowser() { public @CheckForNull RepositoryBrowser<?> guessBrowser() {
return null; return null;
......
...@@ -114,7 +114,7 @@ public abstract class SCMDescriptor<T extends SCM> extends Descriptor<SCM> { ...@@ -114,7 +114,7 @@ public abstract class SCMDescriptor<T extends SCM> extends Descriptor<SCM> {
* When this method returns false, this {@link SCM} will not appear in the configuration screen * When this method returns false, this {@link SCM} will not appear in the configuration screen
* for the given project. The default is true for {@link AbstractProject} but false for {@link Job}. * for the given project. The default is true for {@link AbstractProject} but false for {@link Job}.
* *
* @since 1.294 * @since 1.568
*/ */
public boolean isApplicable(Job project) { public boolean isApplicable(Job project) {
if (project instanceof AbstractProject) { if (project instanceof AbstractProject) {
......
...@@ -321,6 +321,9 @@ public class SCMTrigger extends Trigger<Item> { ...@@ -321,6 +321,9 @@ public class SCMTrigger extends Trigger<Item> {
@Deprecated @Deprecated
public transient /*final*/ AbstractBuild build; public transient /*final*/ AbstractBuild build;
/**
* @since 1.568
*/
public BuildAction(Run<?,?> run) { public BuildAction(Run<?,?> run) {
this.run = run; this.run = run;
build = run instanceof AbstractBuild ? (AbstractBuild) run : null; build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
...@@ -331,6 +334,9 @@ public class SCMTrigger extends Trigger<Item> { ...@@ -331,6 +334,9 @@ public class SCMTrigger extends Trigger<Item> {
this((Run) build); this((Run) build);
} }
/**
* @since 1.568
*/
public Run<?,?> getRun() { public Run<?,?> getRun() {
return run; return run;
} }
...@@ -399,6 +405,9 @@ public class SCMTrigger extends Trigger<Item> { ...@@ -399,6 +405,9 @@ public class SCMTrigger extends Trigger<Item> {
return item instanceof AbstractProject ? ((AbstractProject) item) : null; return item instanceof AbstractProject ? ((AbstractProject) item) : null;
} }
/**
* @since 1.568
*/
public Item getItem() { public Item getItem() {
return job().asItem(); return job().asItem();
} }
...@@ -467,6 +476,7 @@ public class SCMTrigger extends Trigger<Item> { ...@@ -467,6 +476,7 @@ public class SCMTrigger extends Trigger<Item> {
/** /**
* For which {@link Item} are we polling? * For which {@link Item} are we polling?
* @since 1.568
*/ */
public SCMTriggerItem getTarget() { public SCMTriggerItem getTarget() {
return job(); return job();
......
...@@ -43,7 +43,7 @@ import jenkins.model.ParameterizedJobMixIn; ...@@ -43,7 +43,7 @@ import jenkins.model.ParameterizedJobMixIn;
/** /**
* The item type accepted by {@link SCMTrigger}. * The item type accepted by {@link SCMTrigger}.
* @since TODO * @since 1.568
*/ */
public interface SCMTriggerItem { public interface SCMTriggerItem {
...@@ -86,7 +86,6 @@ public interface SCMTriggerItem { ...@@ -86,7 +86,6 @@ public interface SCMTriggerItem {
* See whether an item can be coerced to {@link SCMTriggerItem}. * See whether an item can be coerced to {@link SCMTriggerItem}.
* @param item any item * @param item any item
* @return itself, if a {@link SCMTriggerItem}, or an adapter, if an {@link hudson.model.SCMedItem}, else null * @return itself, if a {@link SCMTriggerItem}, or an adapter, if an {@link hudson.model.SCMedItem}, else null
* @since TODO
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static @CheckForNull SCMTriggerItem asSCMTriggerItem(Item item) { public static @CheckForNull SCMTriggerItem asSCMTriggerItem(Item item) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册