2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 import groovy
.text
.SimpleTemplateEngine
22 import groovy
.xml
.XmlParser
23 import groovy
.xml
.XmlUtil
29 println
"java/groovy -cp [...] " + getClass().getName() + " [-verbose] moduleSpecFile templateFile outputFile [doxygenoutputdir]";
40 if (it
== '-verbose' || it
== '--verbose' || it
== '-v')
46 if (newargs
.size() != 3 && newargs
.size() != 4)
49 // set the doxygen xml directory on the Helper assuming the output file will be placed
50 // in the same place the doxygen subdirectory is placed
51 if (newargs
.size() > 3)
52 Helper
.setDoxygenXmlDir(new File(newargs
[3]))
54 File moduleSpec
= new File(newargs
[0])
55 assert moduleSpec
.exists() && moduleSpec
.isFile(), 'Cannot locate the spec file "' + moduleSpec
.getCanonicalPath() + '."'
57 File templateFile
= new File(newargs
[1])
58 assert templateFile
.exists() && templateFile
.isFile(), 'Cannot locate the template file "' + templateFile
.getCanonicalPath() + '."'
60 spec
= [ 'module' : Helper
.transformSwigXml(new XmlParser().parse(moduleSpec
)), 'templateFile' : templateFile
]
63 println XmlUtil
.serialize(spec
['module'])
65 te
= new SimpleTemplateEngine()
66 println
'Processing "' + templateFile
+ '" using the module specification for module "' + moduleSpec
+ '"'
67 if (verbose
) te
.setVerbose(true)
68 template
= te
.createTemplate(templateFile
).make(spec
)
69 String output
= template
.toString()
70 if (verbose
) println output
73 new File(newargs
[2]).write output