Skip to content

Commit 13f894c

Browse files
authored
WIP Symbols (#118)
* Draft symbols. * change * Update pom.xml
1 parent 025f82e commit 13f894c

43 files changed

Lines changed: 102 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

github-pullrequest-plugin/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@
225225
<optional>true</optional>
226226
</dependency>
227227

228+
<!-- https://wiki.jenkins-ci.org/display/JENKINS/Structs+plugin -->
229+
<dependency>
230+
<groupId>org.jenkins-ci.plugins</groupId>
231+
<artifactId>structs</artifactId>
232+
<version>1.14</version>
233+
<optional>true</optional>
234+
</dependency>
235+
228236
<!-- workflow for tests -->
229237
<dependency>
230238
<groupId>org.jenkins-ci.plugins</groupId>

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/GitHubBranchTrigger.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import hudson.Extension;
1212
import hudson.model.Job;
1313
import hudson.triggers.Trigger;
14+
import org.jenkinsci.Symbol;
1415
import org.jenkinsci.plugins.github.pullrequest.GitHubPRTriggerMode;
1516
import org.jenkinsci.plugins.github.pullrequest.restrictions.GitHubPRBranchRestriction;
1617
import org.jenkinsci.plugins.github.pullrequest.restrictions.GitHubPRUserRestriction;
@@ -327,6 +328,7 @@ private static boolean isSupportedTriggerMode(GitHubPRTriggerMode mode) {
327328
return mode != LIGHT_HOOKS;
328329
}
329330

331+
@Symbol("githubBranches")
330332
@Extension
331333
public static class DescriptorImpl extends GitHubTriggerDescriptor {
332334

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/events/impl/GitHubBranchCommitEvent.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import hudson.Extension;
1212
import hudson.model.TaskListener;
1313
import net.sf.json.JSONObject;
14+
import org.jenkinsci.Symbol;
1415
import org.kohsuke.accmod.Restricted;
1516
import org.kohsuke.accmod.restrictions.NoExternalUse;
1617
import org.kohsuke.github.GHBranch;
@@ -130,6 +131,7 @@ private GitHubBranchCause check(GHBranch remoteBranch, Function<GitHubBranchComm
130131
return cause;
131132
}
132133

134+
@Symbol("commit")
133135
@Extension
134136
public static class DescriptorImpl extends GitHubBranchEventDescriptor {
135137
@Override
@@ -140,6 +142,7 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
140142
return super.configure(req, formData);
141143
}
142144

145+
@Nonnull
143146
@Override
144147
public final String getDisplayName() {
145148
return DISPLAY_NAME;

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/events/impl/GitHubBranchCreatedEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.github.kostyasha.github.integration.generic.GitHubBranchDecisionContext;
88
import hudson.Extension;
99
import hudson.model.TaskListener;
10+
import org.jenkinsci.Symbol;
1011
import org.kohsuke.github.GHBranch;
1112
import org.kohsuke.stapler.DataBoundConstructor;
1213
import org.slf4j.Logger;
@@ -57,6 +58,7 @@ public GitHubBranchCause check(@Nonnull GitHubBranchDecisionContext context) thr
5758
return cause;
5859
}
5960

61+
@Symbol("branchCreated")
6062
@Extension
6163
public static class DescriptorImpl extends GitHubBranchEventDescriptor {
6264
@Nonnull

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/events/impl/GitHubBranchDeletedEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.github.kostyasha.github.integration.generic.GitHubBranchDecisionContext;
88
import hudson.Extension;
99
import hudson.model.TaskListener;
10+
import org.jenkinsci.Symbol;
1011
import org.kohsuke.github.GHBranch;
1112
import org.kohsuke.stapler.DataBoundConstructor;
1213
import org.slf4j.Logger;
@@ -48,6 +49,7 @@ public GitHubBranchCause check(@Nonnull GitHubBranchDecisionContext context) thr
4849
return cause;
4950
}
5051

52+
@Symbol("deleted")
5153
@Extension
5254
public static class DescriptorImpl extends GitHubBranchEventDescriptor {
5355
@Nonnull

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/events/impl/GitHubBranchHashChangedEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.github.kostyasha.github.integration.generic.GitHubBranchDecisionContext;
88
import hudson.Extension;
99
import hudson.model.TaskListener;
10+
import org.jenkinsci.Symbol;
1011
import org.kohsuke.github.GHBranch;
1112
import org.kohsuke.stapler.DataBoundConstructor;
1213
import org.slf4j.Logger;
@@ -53,6 +54,7 @@ public GitHubBranchCause check(@Nonnull GitHubBranchDecisionContext context) thr
5354
return cause;
5455
}
5556

57+
@Symbol("hashChanged")
5658
@Extension
5759
public static class DescriptorImpl extends GitHubBranchEventDescriptor {
5860
@Nonnull

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/events/impl/GitHubBranchRestrictionFilter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.github.kostyasha.github.integration.branch.events.GitHubBranchEventDescriptor;
77
import com.github.kostyasha.github.integration.generic.GitHubBranchDecisionContext;
88
import hudson.Extension;
9+
import org.jenkinsci.Symbol;
910
import org.kohsuke.github.GHBranch;
1011
import org.kohsuke.stapler.DataBoundConstructor;
1112
import org.kohsuke.stapler.DataBoundSetter;
@@ -123,8 +124,10 @@ private GitHubBranchCause toCause(@Nonnull GitHubBranchDecisionContext context,
123124
return context.newCause(String.format(message, args), skip);
124125
}
125126

127+
@Symbol("restriction")
126128
@Extension
127129
public static class Descriptor extends GitHubBranchEventDescriptor {
130+
@Nonnull
128131
@Override
129132
public String getDisplayName() {
130133
return DISPLAY_NAME;

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/events/impl/commitchecks/impl/GitHubBranchCommitMessageCheck.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.github.kostyasha.github.integration.branch.events.impl.commitchecks.GitHubBranchCommitCheckDescriptor;
77
import hudson.Extension;
88
import hudson.ExtensionPoint;
9+
import org.jenkinsci.Symbol;
910
import org.kohsuke.github.GHBranch;
1011
import org.kohsuke.github.GHCommit;
1112
import org.kohsuke.github.GHCompare.Commit;
@@ -132,6 +133,7 @@ private GitHubBranchCause toCause(GHBranch remoteBranch, GitHubBranchRepository
132133
return new GitHubBranchCause(remoteBranch, localRepo, String.format(message, args), skip);
133134
}
134135

136+
@Symbol("commitMessagePattern")
135137
@Extension
136138
public static class DescriptorImpl extends GitHubBranchCommitCheckDescriptor {
137139
@Nonnull

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/generic/repoprovider/GitHubPluginRepoProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.google.common.base.Optional;
88
import hudson.Extension;
99
import org.apache.commons.lang3.BooleanUtils;
10+
import org.jenkinsci.Symbol;
1011
import org.jenkinsci.plugins.github.GitHubPlugin;
1112
import org.jenkinsci.plugins.github.internal.GHPluginConfigException;
1213
import org.jenkinsci.plugins.github.util.misc.NullSafePredicate;
@@ -167,6 +168,7 @@ protected Object readResolve() {
167168
return this;
168169
}
169170

171+
@Symbol("githubPlugin")
170172
@Extension
171173
public static class DescriptorImpl extends GitHubRepoProviderDescriptor {
172174
@Nonnull

github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/multibranch/GitHubBranchBuildStrategy.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import jenkins.scm.api.SCMRevision;
99
import jenkins.scm.api.SCMSource;
1010
import jenkins.scm.api.SCMSourceDescriptor;
11+
import org.jenkinsci.Symbol;
1112
import org.kohsuke.stapler.DataBoundConstructor;
1213

1314
import javax.annotation.Nonnull;
@@ -35,6 +36,7 @@ public boolean isAutomaticBuild(SCMSource source, SCMHead head, SCMRevision revi
3536
return !gr.getCause().isSkip();
3637
}
3738

39+
@Symbol("gitHubEvents")
3840
@Extension
3941
public static class DescriptorImpl extends BranchBuildStrategyDescriptor {
4042
@Override

0 commit comments

Comments
 (0)