You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2013/01/10 21:45:14 UTC
svn commit: r1431672 - in /incubator/easyant/core/trunk/src:
documentation/ref/ProjectMancommand.html
main/java/org/apache/easyant/core/EasyAntMain.java
main/java/org/apache/easyant/man/ListParameters.java
Author: jlboudart
Date: Thu Jan 10 21:45:13 2013
New Revision: 1431672
URL: http://svn.apache.org/viewvc?rev=1431672&view=rev
Log:
Introducse ListParameters man command
Added:
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListParameters.java
Modified:
incubator/easyant/core/trunk/src/documentation/ref/ProjectMancommand.html
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
Modified: incubator/easyant/core/trunk/src/documentation/ref/ProjectMancommand.html
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/documentation/ref/ProjectMancommand.html?rev=1431672&r1=1431671&r2=1431672&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/documentation/ref/ProjectMancommand.html (original)
+++ incubator/easyant/core/trunk/src/documentation/ref/ProjectMancommand.html Thu Jan 10 21:45:13 2013
@@ -32,6 +32,7 @@ EasyAnt cames with a few new switches us
<li>listExtensionPoints : Lists all extension-points available</li>
<li>listPugins : Lists all plugins imported in the current project</li>
<li>listProps [plugin] : Lists all properties available in the specified plugin</li>
+ <li>listParameters [plugin] : Lists all parameters available in the specified plugin</li>
<li>describe [arg] : Describes an extension-point / target / property specified by argument</li>
</ul>
@@ -183,6 +184,27 @@ For more information on a Property, run:
--- End Of (Properties Listing) ---
</code>
+
+<h2>listParameters [plugin]</h2>
+Lists all parameters available in the specified plugin:
+<code type="shell">
+> easyant -listParameters junit
+</code>
+Should print :
+<code type="shell">
+--- Available parameters for current project: easyant-core ---
+
+--- Filtering parameters declared in the following plugin: abstract-test ---
+
+ Parameter (type=PATH): run.test.classpath
+
+For more information on a parameter, run:
+ easyant -describe <parameter name>
+
+--- End Of (Parameter Listing) ---
+</code>
+
+
<h2>describe [arg]</h2>
Describes an extension-point / target / property specified by argument:
<h3>Example with a property</h3>
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java?rev=1431672&r1=1431671&r2=1431672&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java Thu Jan 10 21:45:13 2013
@@ -45,6 +45,7 @@ import org.apache.easyant.core.factory.E
import org.apache.easyant.man.Describe;
import org.apache.easyant.man.EasyantOption;
import org.apache.easyant.man.ListExtensionPoints;
+import org.apache.easyant.man.ListParameters;
import org.apache.easyant.man.ListPlugins;
import org.apache.easyant.man.ListProps;
import org.apache.easyant.man.ListTargets;
@@ -678,6 +679,7 @@ public class EasyAntMain implements AntM
options.addOption(new ListExtensionPoints());
options.addOption(new ListTargets());
options.addOption(new ListProps());
+ options.addOption(new ListParameters());
options.addOption(new ListPlugins());
}
Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListParameters.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListParameters.java?rev=1431672&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListParameters.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListParameters.java Thu Jan 10 21:45:13 2013
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.easyant.man;
+
+import java.util.List;
+
+import org.apache.easyant.core.report.ImportedModuleReport;
+import org.apache.easyant.core.report.ParameterReport;
+
+/**
+ * Lists all parameters (deep search - includes all imported modules) available in the specified build module.
+ */
+public class ListParameters extends EasyantOption {
+
+ private static final long serialVersionUID = 1L;
+
+ public ListParameters() throws IllegalArgumentException {
+ super("listParameters", true, "List all parameters available or specified in a given plugin as argument");
+ setOptionalArg(true);
+ setStopBuild(true);
+ }
+
+ public void execute() {
+ getProject().log(
+ LINE_SEP + "--- Available parameters for current project: " + getProject().getName() + " ---"
+ + LINE_SEP);
+ /*
+ * the plugin specified to this class through the addParam method needs to be searched for all parmeters, and
+ * those parameters will be displayed by this class.
+ */
+ String plugin = getValue();
+ if (plugin == null || plugin.trim().length() == 0) {
+
+ getProject().log(LINE_SEP + "No plugin specified. Listing all parameters available in the project.");
+ List<ParameterReport> parameterReports = getEareport().getParameterReports();
+ if (parameterReports.size() > 0) {
+ printParameters(parameterReports);
+
+ } else {
+ getProject().log(LINE_SEP + "No parameter found in current project");
+ }
+
+ } else {
+ getProject().log(
+ LINE_SEP + "--- Filtering parameters declared in the following plugin: " + plugin + " ---"
+ + LINE_SEP);
+ ImportedModuleReport moduleRep = getEareport().getImportedModuleReport(plugin);
+ if (moduleRep == null) {
+ getProject().log("\tNo Module / Plugin found by given name: " + plugin);
+ } else {
+ List<ParameterReport> parameterReports = moduleRep.getEasyantReport().getParameterReports();
+ if (parameterReports.size() > 0) {
+ printParameters(parameterReports);
+
+ getProject().log(
+ LINE_SEP + LINE_SEP + "For more information on a parameter, run:" + LINE_SEP
+ + "\t easyant -describe <parameter name>");
+ } else {
+ getProject().log(LINE_SEP + "No parameter found in the plugin: " + plugin);
+ }
+ }
+ }
+ getProject().log(LINE_SEP + "--- End Of (Parameter Listing) ---");
+ }
+
+ private void printParameters(List<ParameterReport> parameters) {
+ for (ParameterReport parameterReport : parameters) {
+ getProject().log("\tParameter (type=" + parameterReport.getType() + "): " + parameterReport.getName());
+ }
+ }
+}
\ No newline at end of file