Permalink
Browse files

Add input & output directory parameters

Add help files for parameters
  • Loading branch information...
vtunka committed May 8, 2012
1 parent 6058188 commit 14debde9d1d7fe49df6249ce371f9a142a94e9d0
@@ -23,7 +23,7 @@
* {@link DescriptorImpl#newInstance(StaplerRequest)} is invoked
* and a new {@link TattletaleBuilder} is created. The created
* instance is persisted to the project configuration XML by using
- * XStream, so this allows you to use instance fields (like {@link #projectLocation})
+ * XStream, so this allows you to use instance fields (like {@link #inputDirectory})
* to remember the configuration.
*
* <p>
@@ -34,32 +34,43 @@
*/
public class TattletaleBuilder extends Builder {
- private final String projectLocation;
+ private final String inputDirectory;
+
+ private final String outputDirectory;
// Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
@DataBoundConstructor
- public TattletaleBuilder(String projectLocation) {
- this.projectLocation = projectLocation;
+ public TattletaleBuilder(String inputDirectory, String outputDirectory) {
+ this.inputDirectory = inputDirectory;
+ this.outputDirectory = outputDirectory;
}
/**
* We'll use this from the <tt>config.jelly</tt>.
*/
- public String getProjectLocation() {
- return projectLocation;
+ public String getInputDirectory() {
+ return inputDirectory;
}
- @Override
+ public String getOutputLocation() {
+ return outputDirectory;
+ }
+
+ @Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
// This is where you 'build' the project.
- listener.getLogger().println("Project "+projectLocation+"!");
+ listener.getLogger().println("Input directory: " + inputDirectory);
+
+ listener.getLogger().println("Output directory: " + outputDirectory);
// This also shows how you can consult the global configuration of the builder
if (getDescriptor().getOverrideConfig()) {
listener.getLogger().println("Default global config overriden.");
listener.getLogger().println("Tattletale jar location: \n"
+ getDescriptor().getTattletaleJarLocation());
+ listener.getLogger().println("Javassist jar location: \n"
+ + getDescriptor().getJavassistJarLocation());
listener.getLogger().println("Tattletale properties location: \n"
+ getDescriptor().getPropertiesLocation());
@@ -96,9 +107,11 @@ public DescriptorImpl getDescriptor() {
private boolean overrideConfig;
private String tattletaleJarLocation;
+
+ private String javassistJarLocation;
private String propertiesLocation;
-
+
/**
* Performs on-the-fly validation of the form field 'name'.
*
@@ -133,7 +146,8 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
// To persist global configuration information,
// set that to properties and call save().
overrideConfig = formData.getBoolean("overrideConfig");
- tattletaleJarLocation = formData.getString("jarLocation");
+ tattletaleJarLocation = formData.getString("tattletaleJarLocation");
+ javassistJarLocation = formData.getString("javassistJarLocation");
propertiesLocation = formData.getString("propertiesLocation");
// ^Can also use req.bindJSON(this, formData);
// (easier when there are many fields; need set* methods for this, like setUseFrench)
@@ -142,8 +156,7 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
}
/**
- * This method returns true if the global configuration says we should speak French.
- *
+ *
* The method name is bit awkward because global.jelly calls this method to determine
* the initial state of the checkbox by the naming convention.
*/
@@ -154,10 +167,15 @@ public boolean getOverrideConfig() {
public String getTattletaleJarLocation() {
return tattletaleJarLocation;
}
+
+ public String getJavassistJarLocation() {
+ return javassistJarLocation;
+ }
public String getPropertiesLocation() {
return propertiesLocation;
}
+
}
}
@@ -9,7 +9,15 @@
Creates a text field that shows the value of the "name" property.
When submitted, it will be passed to the corresponding constructor parameter.
-->
- <f:entry title="Project location" field="projectLocation">
- <f:textbox />
+ <f:entry title="Input directory"
+ field="inputDirectory"
+ help="/plugin/tattletale-plugin/help-inputDirectory.html">
+ <f:textbox default="." />
+ </f:entry>
+
+ <f:entry title="Report output directory"
+ field="outputDirectory"
+ help="/plugin/tattletale-plugin/help-outputDirectory.html">
+ <f:textbox default="tattletale-report" />
</f:entry>
</j:jelly>
@@ -28,7 +28,12 @@
</f:entry>
<f:entry title="Tattletale jar location"
- field="jarLocation">
+ field="tattletaleJarLocation">
+ <f:textbox />
+ </f:entry>
+
+ <f:entry title="Javassist jar location"
+ field="javassistJarLocation">
<f:textbox />
</f:entry>
@@ -1,6 +0,0 @@
-<div>
- Help file for fields are discovered through a file name convention. This file is
- help for the "name" field. You can have <i>arbitrary</i> HTML here. You can write
- this file as a Jelly script if you need a dynamic content (but if you do so, change
- the extension to <tt>.jelly</tt>).
-</div>
@@ -1,6 +0,0 @@
-<div>
- This HTML fragment will be injected into the configuration screen
- when the user clicks the 'help' icon. See global.jelly for how the
- form decides which page to load.
- You can have any <tt>HTML</tt> fragment here.
-</div>
@@ -0,0 +1,3 @@
+<div>
+ Input directory containing jars to be analyzed.
+</div>
@@ -0,0 +1,3 @@
+<div>
+ Tattletale reports will be generated into this directory.
+</div>

0 comments on commit 14debde

Please sign in to comment.