Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix JENKINS-21672 - Add classpath for presend script
- Loading branch information
Jeff MAURY
committed
Aug 6, 2014
1 parent
58f0a1e
commit 9c57b9d
Showing
10 changed files
with
236 additions
and
6 deletions.
There are no files selected for viewing
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
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
58 changes: 58 additions & 0 deletions
58
src/main/java/hudson/plugins/emailext/GroovyScriptPath.java
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,58 @@ | ||
package hudson.plugins.emailext; | ||
|
||
import java.io.File; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import hudson.Extension; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
|
||
/** | ||
* Model a classpath entry for Groovy pre script execution. | ||
* The syntax can be an URL, and if the syntax is invalid, defaults to a | ||
* file path. | ||
* This has been inspired by the Jenkins Postbuild plugin. | ||
* | ||
* @see <a href="https://github.com/jenkinsci/groovy-postbuild-plugin">https://github.com/jenkinsci/groovy-postbuild-plugin</a> | ||
* @see <a href="https://github.com/jenkinsci/groovy-postbuild-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorder.java">https://github.com/jenkinsci/groovy-postbuild-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorder.java</a> | ||
* | ||
*/ | ||
public class GroovyScriptPath extends AbstractDescribableImpl<GroovyScriptPath> { | ||
|
||
private String path; | ||
|
||
@DataBoundConstructor | ||
public GroovyScriptPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public URL asURL() { | ||
URL url = null; | ||
|
||
try { | ||
url = new URL(path); | ||
} | ||
catch (MalformedURLException e) { | ||
try { | ||
url = new File(path).toURI().toURL(); | ||
} catch (MalformedURLException e1) { | ||
} | ||
} | ||
return url; | ||
} | ||
|
||
@Extension | ||
public static class GroovyScriptPathDescriptor extends Descriptor<GroovyScriptPath> { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jeffmaury
Member
|
||
@Override | ||
public String getDisplayName() { | ||
return ""; | ||
} | ||
} | ||
} |
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
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
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,7 @@ | ||
<div> | ||
These pathes allow to extend the Groovy classpath when the | ||
presend script is run. The syntax of the path is either a | ||
full url or a simple file path (may be relative). | ||
These pathes are common to all projects when configured at | ||
the global scope. | ||
</div> |
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,7 @@ | ||
<div> | ||
These pathes allow to extend the Groovy classpath when the | ||
presend script is run. The syntax of the path is either a | ||
full url or a simple file path (may be relative). | ||
These pathes are specific to this project and will be added | ||
to those of the global scope. | ||
</div> |
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
Oops, something went wrong.
Debug code?