Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-23365] Noting merge of #1257.
  • Loading branch information
jglick committed Jun 9, 2014
1 parent 38e81a6 commit 7423d30
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 9 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -61,6 +61,9 @@
<li class=rfe>
Support the range notation for pagination in API
(<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>
API changes allowing to create nested launchers (<code>DecoratedLauncher</code>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19454">issue 19454</a>)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/model/Cause.java
Expand Up @@ -71,7 +71,7 @@ public abstract class Cause {

/**
* Called when the cause is registered.
* @since TODO
* @since 1.568
*/
public void onAddedTo(@Nonnull Run build) {
if (build instanceof AbstractBuild) {
Expand All @@ -90,7 +90,7 @@ public void onAddedTo(AbstractBuild build) {
* Called when a build is loaded from disk.
* Useful in case the cause needs to keep a build reference;
* this ought to be {@code transient}.
* @since TODO
* @since 1.568
*/
public void onLoad(@Nonnull Run<?,?> build) {
if (build instanceof AbstractBuild) {
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/java/hudson/model/listeners/SCMListener.java
Expand Up @@ -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.
* @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
* @since TODO
* @since 1.568
*/
public void onCheckout(Run<?,?> build, SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception {}

Expand Down Expand Up @@ -106,6 +106,7 @@ public void onCheckout(Run<?,?> build, SCM scm, FilePath workspace, TaskListener
* @throws Exception
* If any exception is thrown from this method, it will be recorded
* and causes the build to fail.
* @since 1.568
*/
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)) {
Expand All @@ -118,6 +119,9 @@ public void onChangeLogParsed(AbstractBuild<?,?> build, BuildListener listener,
onChangeLogParsed((Run) build, build.getProject().getScm(), listener, changelog);
}

/**
* @since 1.568
*/
@SuppressWarnings("deprecation")
public static Collection<? extends SCMListener> all() {
Jenkins j = Jenkins.getInstance();
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/hudson/scm/AbstractScmTagAction.java
Expand Up @@ -52,6 +52,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa
@Deprecated
protected transient /*final*/ AbstractBuild build;

/**
* @since 1.568
*/
protected AbstractScmTagAction(Run<?,?> run) {
this.run = run;
this.build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
Expand All @@ -74,6 +77,9 @@ protected Permission getPermission() {
return SCM.TAG;
}

/**
* @since 1.568
*/
public Run<?,?> getRun() {
return run;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/scm/ChangeLogAnnotator.java
Expand Up @@ -76,6 +76,7 @@ public abstract class ChangeLogAnnotator implements ExtensionPoint {
* are registered, the object may already contain some markups when this
* method is invoked. Never null. {@link MarkupText#getText()} on this instance
* will return the same string as {@link Entry#getMsgEscaped()}.
* @since 1.568
*/
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)) {
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/hudson/scm/ChangeLogParser.java
Expand Up @@ -41,6 +41,9 @@
*/
public abstract class ChangeLogParser {

/**
* @since 1.568
*/
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)) {
return parse((AbstractBuild) build, changelogFile);
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/java/hudson/scm/ChangeLogSet.java
Expand Up @@ -62,6 +62,9 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
public final AbstractBuild<?,?> build;
private final RepositoryBrowser</* ideally T */?> browser;

/**
* @since 1.568
*/
protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) {
this.run = run;
build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
Expand All @@ -79,10 +82,16 @@ private static RepositoryBrowser<?> browserFromBuild(AbstractBuild<?,?> build) {
return build.getParent().getScm().getEffectiveBrowser();
}

/**
* @since 1.568
*/
public Run<?,?> getRun() {
return run;
}

/**
* @since 1.568
*/
public RepositoryBrowser<?> getBrowser() {
return browser;
}
Expand Down Expand Up @@ -116,6 +125,7 @@ public String getKind() {

/**
* Constant instance that represents no changes.
* @since 1.568
*/
public static ChangeLogSet<? extends ChangeLogSet.Entry> createEmpty(Run build) {
return new EmptyChangeLogSet(build);
Expand Down
13 changes: 10 additions & 3 deletions core/src/main/java/hudson/scm/SCM.java
Expand Up @@ -209,7 +209,7 @@ public boolean requiresWorkspaceForPolling() {
* true if {@link SCM} is OK to let Hudson proceed with deleting the workspace.
* False to veto the workspace deletion.
*
* @since 1.246
* @since 1.568
*/
public boolean processWorkspaceBeforeDeletion(Job<?,?> project, FilePath workspace, Node node) throws IOException, InterruptedException {
if (project instanceof AbstractProject) {
Expand Down Expand Up @@ -308,6 +308,7 @@ public boolean pollChanges(AbstractProject<?,?> project, Launcher launcher, File
* @throws InterruptedException
* interruption is usually caused by the user aborting the computation.
* 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 {
if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) {
Expand Down Expand Up @@ -370,6 +371,7 @@ public SCMRevisionState _calcRevisionsFromBuild(AbstractBuild<?, ?> build, Launc
* @throws InterruptedException
* interruption is usually caused by the user aborting the computation.
* 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 {
if (project instanceof AbstractProject && Util.isOverridden(SCM.class, getClass(), "compareRemoteRevisionWith", AbstractProject.class, Launcher.class, FilePath.class, TaskListener.class, SCMRevisionState.class)) {
Expand Down Expand Up @@ -445,6 +447,7 @@ private boolean is1_346OrLater() {
* interruption is usually caused by the user aborting the build.
* this exception will cause the build to be aborted.
* @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 {
if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCM.class, getClass(), "checkout", AbstractBuild.class, Launcher.class, FilePath.class, BuildListener.class, File.class)) {
Expand Down Expand Up @@ -475,7 +478,7 @@ public boolean checkout(AbstractBuild<?,?> build, Launcher launcher, FilePath wo

/**
* 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 {
if (build instanceof AbstractBuild && listener instanceof BuildListener) {
Expand Down Expand Up @@ -653,6 +656,9 @@ protected final boolean createEmptyChangeLog(File changelogFile, BuildListener l
}
}

/**
* @since 1.568
*/
protected final void createEmptyChangeLog(File changelogFile, TaskListener listener, String rootTag) throws IOException {
FileWriter w = null;
try {
Expand Down Expand Up @@ -686,6 +692,7 @@ public static DescriptorExtensionList<SCM,SCMDescriptor<?>> all() {

/**
* 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) {
if(project==null) return all();
Expand Down Expand Up @@ -715,7 +722,7 @@ public static List<SCMDescriptor<?>> _for(final AbstractProject project) {
* 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.
* @return a reasonable default value for {@link #getEffectiveBrowser}, or null
* @since TODO
* @since 1.568
*/
public @CheckForNull RepositoryBrowser<?> guessBrowser() {
return null;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/scm/SCMDescriptor.java
Expand Up @@ -114,7 +114,7 @@ public boolean isBrowserReusable(T x, T y) {
* 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}.
*
* @since 1.294
* @since 1.568
*/
public boolean isApplicable(Job project) {
if (project instanceof AbstractProject) {
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/java/hudson/triggers/SCMTrigger.java
Expand Up @@ -321,6 +321,9 @@ public static class BuildAction implements RunAction2 {
@Deprecated
public transient /*final*/ AbstractBuild build;

/**
* @since 1.568
*/
public BuildAction(Run<?,?> run) {
this.run = run;
build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
Expand All @@ -331,6 +334,9 @@ public BuildAction(AbstractBuild build) {
this((Run) build);
}

/**
* @since 1.568
*/
public Run<?,?> getRun() {
return run;
}
Expand Down Expand Up @@ -399,6 +405,9 @@ public AbstractProject<?,?> getOwner() {
return item instanceof AbstractProject ? ((AbstractProject) item) : null;
}

/**
* @since 1.568
*/
public Item getItem() {
return job().asItem();
}
Expand Down Expand Up @@ -467,6 +476,7 @@ public File getLogFile() {

/**
* For which {@link Item} are we polling?
* @since 1.568
*/
public SCMTriggerItem getTarget() {
return job();
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/jenkins/triggers/SCMTriggerItem.java
Expand Up @@ -43,7 +43,7 @@

/**
* The item type accepted by {@link SCMTrigger}.
* @since TODO
* @since 1.568
*/
public interface SCMTriggerItem {

Expand Down Expand Up @@ -86,7 +86,6 @@ class SCMTriggerItems {
* See whether an item can be coerced to {@link SCMTriggerItem}.
* @param item any item
* @return itself, if a {@link SCMTriggerItem}, or an adapter, if an {@link hudson.model.SCMedItem}, else null
* @since TODO
*/
@SuppressWarnings("deprecation")
public static @CheckForNull SCMTriggerItem asSCMTriggerItem(Item item) {
Expand Down

0 comments on commit 7423d30

Please sign in to comment.