首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >此构建脚本是openlazlo 4.9编译的有效构建脚本吗

此构建脚本是openlazlo 4.9编译的有效构建脚本吗
EN

Stack Overflow用户
提问于 2012-08-21 22:48:42
回答 1查看 126关注 0票数 1

这是Open laszlo 4.9的有效ant构建脚本吗?我不能用这个文件构建它。

代码语言:javascript
复制
<project name="test" default="TestClient" basedir=".">
    <property name="src"   value="${basedir}/src"/>
    <property name="webappDir" value="../webapp"/>

    <property environment="env"/>
    <property name="lzbin" value="${env.LPS_HOME}/WEB-INF/lps/server/bin"/>

    <!-- use the correct compiler script based on platform -->
    <condition property="lzc" value="${lzbin}/lzc">
        <os family="unix"/>
    </condition>

    <condition property="lzc" value="${lzbin}/lzc.bat">
        <os family="windows"/>
    </condition>

    <property name="TestClient.lzx" value="${basedir}/src/TestClient.lzx"/>
    <property name="TestClient.swf" value="${basedir}/src/TestClient.swf"/>
    <property name="TestClient.lzx.swf" value="${TestClient.lzx}.swf"/>
    <property name="modules" value="${basedir}/src/modules"/>



    <target name="TestClient" description="compile TestClient.lzx">
        <echo message="${lzc}"/>
        <exec executable="${lzc}" failonerror="true">
            <arg value="${TestClient.lzx}"/>
            <arg value='"--runtime=swf10"'/>
        </exec>
        <copy file="${TestClient.lzx.swf}" todir="${webappDir}"/>
        <delete file="${TestClient.swf}"/>
        <delete file="${TestClient.lzx.swf}"/>
    </target>

    <target name="Debug" description="update files on webapp folder from tdc/src">
        <unzip src="${basedir}/../openlaszlo-4.9.0-servlet.war" dest="${webappDir}">            
            <patternset>
                <exclude name="**/WEB-INF/web.xml"/>
                <exclude name="**/META-INF/MANIFEST.MF"/>
                <exclude name="**/my-apps/copy-of-hello.lzx"/>
            </patternset>
        </unzip>
        <copy file="${TestClient.lzx}" todir="${webappDir}" overwrite="false"/>
        <copy file="${basedir}/../etc/proxy.properties" todir="${webappDir}/WEB-INF/classes" overwrite="false"/>

        <copy file="${basedir}/../webLZDebug.xml" tofile="${webappDir}/WEB-INF/web.xml" overwrite="true" />
        <copy file="${webappDir}/tutorial.html" tofile="${webappDir}/debug.html" overwrite="true" />
        <replace file="${webappDir}/debug.html">
            <replacetoken><![CDATA[lzEmbed({url: 'TestClient.lzx.swf?lzt=swf&folder=calif&servletUrl=http://127.0.0.1:12345/servlet/fixed&eliminatorResource=resources/eliminator.swf&__lzhistconn='+top.connuid+'&__lzhisturl=' + escape('includes/h.html?h='), bgcolor: '#6691B4"',  width: '100%', height: '100%'});]]></replacetoken>
            <replacevalue><![CDATA[lzEmbed({url: 'TestClient.lzx?debug=true&lzt=swf&folder=calif&servletUrl=http://127.0.0.1:12345/servlet/fixed&eliminatorResource=resources/eliminator.swf&__lzhistconn='+top.connuid+'&__lzhisturl=' + escape('includes/h.html?h='), bgcolor: '#6691B4"',  width: '100%', height: '100%'});]]></replacevalue>
        </replace>

        <copy todir="${webappDir}/modules" overwrite="true">
            <fileset dir="${ctbmodules}"></fileset>
        </copy>


    </target>

    <target name="help" description="describes usage">
        <echo>

        </echo>
    </target>
</project>

我已经看过这个stackoverflow帖子了。

How to build an OpenLaszlo DHTML application using Apache Ant和我将准备一个这样的脚本

但是,我只想确认之前的构建脚本是否有任何问题。

EN

回答 1

Stack Overflow用户

发布于 2012-08-24 00:50:30

在第28行,您必须删除运行时参数周围的多余引号。而不是

代码语言:javascript
复制
<arg value='"--runtime=swf10"'/>

它应该是

代码语言:javascript
复制
<arg value="--runtime=swf10"/>

然后,lzc命令有一个输出或-o选项,您可以在其中定义输出文件。默认情况下,lzc命令会生成两个SWF文件,例如

代码语言:javascript
复制
lzc TestClient.lzx  --runtime=swf10

生成TestClient.lzx.swf10.swf和TestClient.swf10.swf。使用-o选项,您可以直接指定文件名:

代码语言:javascript
复制
lzc --runtime=swf10 -o TestClient.swf TestClient.lzx 
Compiling: TestClient.lzx to TestClient.swf

以下是修改后的build.xml部分:

代码语言:javascript
复制
<property name="TestClient.lzx" value="${basedir}/src/TestClient.lzx"/>
<property name="TestClient.swf" value="TestClient.swf"/>
<property name="modules" value="${basedir}/src/modules"/>

<target name="TestClient" description="compile TestClient.lzx">
    <echo message="${lzc}"/>
    <exec executable="${lzc}" failonerror="true">
        <arg value="${TestClient.lzx}"/>
        <arg value="--runtime=swf10"/>
        <arg value="-o" />
        <arg value="${TestClient.swf}" />
    </exec>
    <move file="src/${TestClient.swf}" todir="${webappDir}"/>
</target>

不要向${TestClient.swf}属性添加路径,否则lzc命令将创建文件名前面的文件夹结构。而不是在复制后删除生成的SWF文件,我只是移动它。以下是Ant的输出:

代码语言:javascript
复制
raju@T500:~/flex4.6/build-test$ ant
Buildfile: /home/raju/flex4.6/build-test/build.xml

TestClient:
     [echo] /home/raju/src/svn/openlaszlo/trunk/WEB-INF/lps/server/bin/lzc
     [exec] Compiling: /home/raju/flex4.6/build-test/src/TestClient.lzx to TestClient.swf
     [move] Moving 1 file to /home/raju/flex4.6/webapp

BUILD SUCCESSFUL

以及所得到的目录结构。

代码语言:javascript
复制
├── build-test/
│   ├── build.xml
│   └── src
│       └── TestClient.lzx
└── webapp/
    └── TestClient.swf
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12057508

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档