我正在尝试使用yuidoc生成JavaScript文档,下面是我的ANT脚本。
<?xml version="1.0"?>
<project default="javascriptdoc">
<property name="doc_dir" location="docs/javascript" />
<property name="src" location="assests/Siminov" />
<property name="projectname" value="Siminov Hybrid JavaScript Document Generator" />
<property name="version" value="1.0" />
<property name="project_url" value="http://developer.yahoo.com/yui/yuidoc" />
<property name="yuidoc_home" location="yuidoc.assets" />
<property name="yuidoc_exec" location="${yuidoc_home}/bin/yuidoc.py" />
<property name="tmp_dir" location="docstmp" />
<property name="parser_in" location="${src}" />
<echo>Making sure build dir is there</echo>
<mkdir dir="${doc_dir}" />
<target name="javascriptdoc">
<property name="parser_out" location="${doc_dir}/parsertmp" />
<property name="generator_out" location="${doc_dir}" />
<property name="template" location="template" />
<property name="yuiversion" location="3.0.0" />
<echo>generating documentation</echo>
<exec executable="${yuidoc_exec}">
<arg value="${parser_in}"/>
<arg value="-p"/>
<arg value="${parser_out}"/>
<arg value="-o" />
<arg value="${generator_out}" />
<arg value="-t" />
<arg value="${template}" />
<arg value="-m" />
<arg value="${projectname}" />
<arg value="-Y" />
<arg value="${yuiversion}" />
<arg value="-v" />
<arg value="${version}" />
<arg value="-u" />
<arg value="$project_url" />
</exec>
</target>
我的项目看起来像是
在运行ANT脚本时,它给了我错误:
Buildfile: H:\Siminov Workspace\SIMINOV-HYBRID\yuidoc.xml
[echo] Making sure build dir is there
javascriptdoc:
[echo] generating documentation
BUILD FAILED
H:\Workspace\projectname\yuidoc.xml:25: Execute failed: java.io.IOException: Cannot run program "H:\Workspace\projectname\yuidoc.assets\bin\yuidoc.py": CreateProcess error=193, %1 is not a valid Win32 application
Total time: 415 milliseconds
答案 0 :(得分:1)
<exec>
需要指向Python可执行文件,而不是指向包含Python源代码的文件:
<exec executable="C:\Python26\python.exe">
<arg file="${yuidoc_exec}" />
<arg value="${parser_in}"/>
<!-- the rest of the task as before... -->
</exec>