@@ -35,8 +35,31 @@ object Elem {
35
35
case _ : SpecialNode | _ : Group => None
36
36
case _ => Some ((n.prefix, n.label, n.attributes, n.scope, n.child))
37
37
}
38
+
39
+ import scala .sys .process ._
40
+ /** Implicitly convert a [[scala.xml.Elem ]] into a
41
+ * [[scala.sys.process.ProcessBuilder ]]. This is done by obtaining the text
42
+ * elements of the element, trimming spaces, and then converting the result
43
+ * from string to a process. Importantly, tags are completely ignored, so
44
+ * they cannot be used to separate parameters.
45
+ */
46
+ @ deprecated(" To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim)." , " 2.11.0" )
47
+ implicit def xmlToProcess (command : scala.xml.Elem ): ProcessBuilder = Process (command.text.trim)
48
+
49
+ @ deprecated(" To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim)." , " 2.11.0" )
50
+ implicit def processXml (p : Process .type ) = new {
51
+ /** Creates a [[scala.sys.process.ProcessBuilder ]] from a Scala XML Element.
52
+ * This can be used as a way to template strings.
53
+ *
54
+ * @example {{{
55
+ * apply(<x> {dxPath.absolutePath} --dex --output={classesDexPath.absolutePath} {classesMinJarPath.absolutePath}</x>)
56
+ * }}}
57
+ */
58
+ def apply (command : Elem ): ProcessBuilder = Process (command.text.trim)
59
+ }
38
60
}
39
61
62
+
40
63
/** The case class `Elem` extends the `Node` class,
41
64
* providing an immutable data object representing an XML element.
42
65
*
0 commit comments