You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README 2.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Ant's current CVS version contains an <input> task that gathers user
  2. input by reading from System.in - this is not too nice for people
  3. embedding Ant in IDEs. 8-)
  4. <input> also supports an undocumented testinput attribute that is used
  5. by Ant's test cases to allow them to run without user interaction, but
  6. could also be used to provide predefined answers to unattended builds.
  7. This proposal tries to define a very basic input framework for Ant
  8. that would allow Ant to be easily embedded into IDEs via
  9. implementations of the org.apache.tools.ant.input.InputHandler
  10. interface. At the same time an implementation of the interface is
  11. provided that allows the input to be specified via an external
  12. property file.
  13. There are three implementations of the InputHandler interface,
  14. DefaultInputHandler which reads form System.in just like the <input>
  15. task originally did, PropertyFileInputHandler for non-interactive
  16. builds and SwingInputHandler which is nothing more than a proof of
  17. concept.
  18. Input requests get encapsulated in instances of the
  19. org.apache.tools.ant.input.InputRequest class - or subclasses thereof
  20. - which provide a method to also validate the input, moving this
  21. responsibility from the <input> task to the InputRequest itself.
  22. There are two types of InputRequests ATM, InputRequest encapsulates a
  23. request for a simple unrestricted text input,
  24. MultipleChoiceInputRequest is a request where valid inputs are
  25. restricted to a given set of values.
  26. If you run ant on the build file in this directory, a version of
  27. ant.jar will be created in the build subdirectory that is identical to
  28. the main trunk of Ant except for the input task itself and two minor
  29. changes to Project and Main, that allow InputHandlers to be plugged in
  30. programmatically or via a commandline switch -inputhandler.
  31. With this version of Ant, run the build file in proposals/testcases,
  32. Ant should behave the same way the input task for the main branch does
  33. - except that it won't allow you to enter invalid input in the multi
  34. target.
  35. If you invoke Ant like this:
  36. ant -f proposal/sandbox/input/src/testcases/input.xml -inputhandler org.apache.tools.ant.input.SwingInputHandler
  37. You'll get the ugliest dialog you've ever seen, but it works ;-)
  38. Use
  39. ANT_OPTS=-Dant.input.properties=proposal/sandbox/input/src/testcases/works.properties\
  40. ant -f proposal/sandbox/input/src/testcases/input.xml -inputhandler org.apache.tools.ant.input.PropertyFileInputHandler
  41. to see the non-interactive build process in action. fails.properties
  42. provides a sample of possible input failures.
  43. The original testcase for <input> has been ported to the new framework
  44. as well, run it via
  45. ant run-test
  46. in this directory.