-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support icons in folders #1258
Merged
Merged
Support icons in folders #1258
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
41a0759
Enable configuration for icons in folders
strangelookingnerd 03b93b7
Add example configuration
strangelookingnerd fa3dc37
Fix IDE formatting
strangelookingnerd 567898e
Merge branch 'jenkinsci:master' into master
strangelookingnerd 243a543
Merge branch 'jenkinsci:master' into master
strangelookingnerd c240415
Fix missing import
strangelookingnerd b90adee
Fix tests
strangelookingnerd ed1e1fc
Fix IDE formatting
strangelookingnerd 802bf8a
Merge branch 'master' into master
basil b4b0a50
Update `@since` version
basil b4987b1
Add tests for custom folder icons
strangelookingnerd 8e1827f
Merge branch 'master' into master
basil 783a899
Merge branch 'master' into master
strangelookingnerd 05bdb39
Add test for EmojiFolderIcon
strangelookingnerd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// use the stock icon | ||
folder('stock') | ||
|
||
// use https://github.com/jenkinsci/custom-folder-icon-plugin for custom icons | ||
userContent('customFolderIcons/custom.png', streamFileFromWorkspace('custom.png')) | ||
folder('custom') { | ||
icon { | ||
customFolderIcon { | ||
foldericon('custom.png') | ||
} | ||
} | ||
} | ||
|
||
// use https://github.com/jenkinsci/custom-folder-icon-plugin for ionicons | ||
folder('ionicon') { | ||
icon { | ||
ioniconFolderIcon { | ||
ionicon('jenkins') | ||
} | ||
} | ||
} | ||
|
||
// use https://github.com/jenkinsci/custom-folder-icon-plugin for build status icon | ||
folder('build-status') { | ||
icon { | ||
buildStatusFolderIcon() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package javaposse.jobdsl.dsl.helpers.icon | ||
|
||
import javaposse.jobdsl.dsl.AbstractExtensibleContext | ||
import javaposse.jobdsl.dsl.ContextType | ||
import javaposse.jobdsl.dsl.Item | ||
import javaposse.jobdsl.dsl.JobManagement | ||
|
||
@ContextType('com.cloudbees.hudson.plugins.folder.FolderIcon') | ||
class FolderIconContext extends AbstractExtensibleContext { | ||
Node icon | ||
|
||
FolderIconContext(JobManagement jobManagement, Item item) { | ||
super(jobManagement, item) | ||
} | ||
|
||
@Override | ||
protected void addExtensionNode(Node node) { | ||
icon = ContextHelper.toNamedNode('icon', node) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strangelookingnerd Should we also have a test for new emoji type icons ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
job-dsl-plugin
requires Jenkins2.361.4
whereascustom-folder-icon-plugin
2.5
(which includes the emoji icons) requires2.387.1
- so I guess this won't be possible right now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can probably get a release out next week. Once that's done I would have no problem with revving the minimum Jenkins core to 2.387.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@basil That would be great! On a side-note I found that the tests in
javaposse.jobdsl.dsl.doc.ExampleValidationSpec
do not seem to be run during the build anymore or are at least not reporting any failing tests. Running them manually however shows that the test for myicon.groovy
example still fails. Before the switch to Maven the behavior was different. Any idea why that is?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it has something to do with the use of@Unroll
withfile << findAllExamples()
, where the right-hand side is a function call rather than a static set of values. Seems that JUnit isn't able to invoke the function call correctly. Are you interested in opening a PR that removes the use of@Unroll
in favor of a simplefor
loop inside of the test?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1279