- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我读过 OpenLaszlo 的 lzdeploy tool , 但似乎只有很少的文档可用。
应该可以使用 Apache Ant 构建 OpenLaszlo DHTML 应用程序(例如,作为自动构建过程的一部分)。如何在 Ant 之外使用 lzc 和 lzdeploy 工具为 DHTML 运行时生成 OpenLaszlo 应用程序的编译版本,包括包装页面?
最佳答案
这是一个完整的 Ant 构建脚本,您可以将其与 OpenLaszlo 5.0 一起使用(尚未在旧版本上测试过)。
<?xml version="1.0" encoding="UTF-8"?>
<project name="olApp" default="build" basedir=".">
<description>Ant Build Script for OpenLaszlo DHTML App</description>
<!-- OpenLaszlo canvas app filename -->
<property name="app.file" value="testapp.lzx" />
<!-- LPS home folder -->
<property name="lps.home" value="PLEASE SET YOUR LPS_HOME FOLDER HERE!!!" />
<!-- Build timestamp -->
<property name="build.timestamp" value="will be the set through script below" />
<script language="javascript">
var date = new Date();
var stamp = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss").format(date);
olApp.setProperty("build.timestamp", stamp);
</script>
<property name="project.folder" value="will be set through the script below" />
<script language="javascript">
var lpsHome = olApp.getProperty("lps.home"),
basedir = olApp.getProperty("basedir"),
fileSep = java.lang.System.getProperty("file.separator"),
projectFolder = "app";
olApp.setProperty("project.folder", projectFolder)
</script>
<!-- Default directories -->
<property name="lzx.dir" location="${basedir}/lzx" />
<property name="build.dir" location="${basedir}/build" />
<property name="temp.dir" location="${build.dir}/tmp" />
<property name="release.dir" location="${basedir}/release" />
<!-- CLASSPATH for Laszlo compiler lzc -->
<path id="laszlo.compiler.classpath">
<pathelement location="${lps.home}/WEB-INF/lps/server/build"/>
<pathelement location="${lps.home}/WEB-INF/classes"/>
<fileset dir="${lps.home}/WEB-INF/lib" includes="**/*.jar"/>
</path>
<target name="info"
description="Dump useful configuration information before build">
<echo message="Using LPS in ${lps.home}" />
<echo message="Editor appl path relative to $LPS_HOME is $LPS_HOME/${project.folder}" />
<echo message="Timestamp for this build is ${build.timestamp} "/>
</target>
<target name="clean" depends="info"
description="Delete all temporary and generated files and folders.">
<!-- If the application file has been compiled using the
browser developer console, remove all generate files. -->
<script language="javascript">
var file = olApp.getProperty("app.file");
olApp.setProperty("masterSpriteFile",
file.substr(0,file.indexOf(".lzx")) + ".sprite.png");
</script>
<delete>
<fileset dir="${lzx.dir}">
<include name="**/*.sprite.png"/>
<include name="**/*.swf10.swf"/>
<include name="**/*.lzx.js"/>
</fileset>
</delete>
<delete dir="${lzx.dir}/lps"/>
<delete file="${lzx.dir}/${app.file}.js" />
<delete file="${lzx.dir}/${app.file}.swf10.swf" />
<delete file="${lzx.dir}/${masterSpriteFile}" />
<echo message="Property app.file set to ${app.file}" />
<delete dir="${build.dir}" />
<delete dir="${release.dir}" />
</target>
<target name="init" depends="clean"
description="Create all directories for the build process.">
<mkdir dir="${temp.dir}" />
<mkdir dir="${temp.dir}/lzxcompile" />
<mkdir dir="${temp.dir}/lzdeploy" />
<mkdir dir="${build.dir}" />
<mkdir dir="${release.dir}" />
</target>
<target name="build" depends="init,compile-lzx"
description="Compile Java and LZX source (SWF10 and DHTML), and copy the versions into the release folder.">
</target>
<!-- Copy LZX, JSP and other text files into folder ${temp.dir}.
We don't want to pollute the source folder with files generated
during compilation. -->
<target name="copy-files-temp" depends="init">
<echo message="Copying files from ${lzx.dir} to ${temp.dir}/lzxcompile" />
<copy todir="${temp.dir}/lzxcompile">
<fileset dir="${lzx.dir}" casesensitive="no">
<!-- Include any file type here you want to package into the
deployed application. -->
<include name="**/*.lzx" />
<include name="**/*.xml" />
<include name="**/*.jsp" />
<include name="**/*.html" />
<include name="**/*.js" />
<include name="**/*.css" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
<include name="**/*.mp3" />
<include name="**/*.pdf" />
<include name="**/*.png" />
<include name="**/*.swf" />
<include name="**/*.ttf" />
</fileset>
</copy>
</target>
<!-- Compile the LZX code for both the DHTML and SWF10 runtime -->
<target name="compile-lzx" depends="init,copy-files-temp" >
<echo message="Compiling LZX app for SWF10 and DHTML runtime (SOLO)"/>
<script language="javascript">
var lzxFile = olApp.getProperty("app.file");
var timestamp = olApp.getProperty("build.timestamp");
var fileNoending = lzxFile.substr(0,lzxFile.indexOf(".lzx"));
olApp.setProperty("app.file.timestamp",
fileNoending + "." + timestamp + ".lzx");
</script>
<move file="${temp.dir}/lzxcompile/${app.file}"
tofile="${temp.dir}/lzxcompile/${app.file.timestamp}" />
<!-- SWF10 with Laszlo Debugger enabled -->
<antcall target="_solo-compile-file">
<param name="file" value="${temp.dir}/lzxcompile/${app.file.timestamp}" />
<param name="runtime" value="swf10" />
<param name="debug" value="--debug"/>
<param name="output" value="${temp.dir}/lzdeploy/swf10-debug.zip" />
</antcall>
<antcall target="_unzip-lzdeploy-package">
<param name="output" value="${temp.dir}/lzdeploy/swf10-debug.zip" />
<param name="targetFolder" value="${temp.dir}/lzdeploy/swf10-debug" />
</antcall>
<!-- FIX: lzdeploy bug workaround
The SWF10 file is currently not added to the ZIP file, need to
copy it over -->
<copy file="${temp.dir}/lzxcompile/${app.file.timestamp}.swf10.swf"
tofile="${temp.dir}/lzdeploy/swf10-debug/${app.file.timestamp}.swf10.swf" />
<!-- DHTML with Laszlo Debugger enabled -->
<antcall target="_solo-compile-file" >
<param name="file" value="${temp.dir}/lzxcompile/${app.file.timestamp}" />
<param name="runtime" value="dhtml" />
<param name="debug" value="--debug"/>
<param name="output" value="${temp.dir}/lzdeploy/dhtml-debug.zip" />
</antcall>
<antcall target="_unzip-lzdeploy-package">
<param name="output" value="${temp.dir}/lzdeploy/dhtml-debug.zip" />
<param name="targetFolder" value="${temp.dir}/lzdeploy/dhtml-debug" />
</antcall>
<!-- DHTML without Laszlo Debugger -->
<antcall target="_solo-compile-file" >
<param name="file" value="${temp.dir}/lzxcompile/${app.file.timestamp}" />
<param name="runtime" value="dhtml" />
<param name="output" value="${temp.dir}/lzdeploy/dhtml.zip" />
</antcall>
<antcall target="_unzip-lzdeploy-package">
<param name="output" value="${temp.dir}/lzdeploy/dhtml.zip" />
<param name="targetFolder" value="${temp.dir}/lzdeploy/dhtml" />
</antcall>
<!-- Copy the files for each app version - including dependencies -
into the release folder. -->
<copy todir="${release.dir}/swf10-debug">
<fileset dir="${temp.dir}/lzdeploy/swf10-debug/">
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="${release.dir}/dhtml">
<fileset dir="${temp.dir}/lzdeploy/dhtml/">
<exclude name="${app.file.timestamp}.swf10.swf" />
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="${release.dir}/dhtml-debug">
<fileset dir="${temp.dir}/lzdeploy/dhtml-debug/">
<exclude name="${app.file.timestamp}.swf10.swf" />
<include name="**/*.*" />
</fileset>
</copy>
</target>
<!-- Compile the file and create the ZIP package with resources -->
<target name="_solo-compile-file">
<echo message="Creating application package for ${file}"/>
<echo message="Using LPS_HOME: ${lps.home}"/>
<echo message="args: --runtime=${runtime} ${debug} --output ${output}"/>
<java classpathref="laszlo.compiler.classpath"
classname="org.openlaszlo.utils.DeployMain"
fork="yes"
failonerror="true">
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-DLPS_HOME=${lps.home}"/>
<arg line="--runtime=${runtime} --output ${output} ${debug} ${file}"/>
</java>
</target>
<!-- Unzip the OpenLaszlo deployment ZIP file -->
<target name="_unzip-lzdeploy-package">
<echo message="Unzipping lzdeploy package ${output}" />
<!--unzip src="${zip.target.file}" dest="${temp.zip.extracted}"-->
<unzip src="${output}" dest="${targetFolder}">
<patternset>
<exclude name="widget-icon.png" />
<exclude name="config.xml" />
<!-- exclude name="index.html" /-->
<exclude name="**/*.lzx" />
<exclude name="**/*.css" />
</patternset>
</unzip>
</target>
</project>
将构建脚本放入名为 testapp 的 $LPS_HOME(OpenLaszlo 服务器主目录)的子文件夹中。创建一个子目录 LZX,其中包含名为 testapp.lzx 的 OpenLaszlo Canvas 应用程序。我在子文件夹资源中添加了一个图像资源,以测试资源是否正确打包到 SOLO 编译的应用程序文件夹中。
$LPS_HOME
└── testapp
├── build.xml
└── lzx
├── resources
│ └── Winnie-the-Pooh.jpg
└── testapp.lzx
进入$LPS_HOME,运行“ant build”。构建过程应该运行,你应该有生成的文件夹结构:
testapp
├── build
│ └── tmp
│ ├── lzdeploy (more files)
│ └── lzxcompile (more files)
├── build.xml
├── lzx
│ ├── resources
│ │ └── Winnie-the-Pooh.jpg
│ └── testapp.lzx
└── release
├── dhtml
│ ├── index.html
│ ├── lps (more files)
│ ├── resources
│ │ └── Winnie-the-Pooh.jpg
│ ├── testapp.20120810-125652.lzx.js
│ └── testapp.20120810-125652.sprite.png
├── dhtml-debug
│ ├── index.html
│ ├── lps (more files)
│ ├── resources
│ │ └── Winnie-the-Pooh.jpg
│ ├── testapp.20120810-125652.lzx.js
│ └── testapp.20120810-125652.sprite.png
└── swf10-debug
├── index.html
└── lps (more files)
构建过程生成了三个版本的 OpenLaszlo 应用程序:带调试的 SWF、启用和不启用 Debug模式的 DHTML/HTML5。所有 JavaScript 和 SWF 文件都附加了时间戳,这意味着不会从浏览器缓存中提取应用程序的新版本。如果将浏览器指向发布文件夹,单击三个文件夹(swf10-debug、dhtml、dhtml-debug)中的任何一个应该会打开 SOLO 编译的应用程序。
添加您自己的脚本以将发布上传到网络服务器,这应该不难。
关于html - 如何使用 Apache Ant 构建 OpenLaszlo DHTML 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11897892/
我一直在看 OpenLaszlo。我找不到如何部署单独的应用程序.. 我必须复制什么或我必须运行什么程序? 我知道部署类型可以是 dhtml 或 flash ... 提前致谢。 最佳答案 对于 SOL
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 6 年前。 Improv
在 JavaScript 中,我们有 document.elementfrompoint 来获取基于坐标的元素。Openlaszlo 中是否有类似的东西来获取基于坐标的 View ? 最佳答案 Ope
如何在查询字符串中传递多个参数,openlaszlo?我收到编译时错误 当我在两个参数之间使用“&”时。 示例代码: LzBrowser.loadURL("../modules/Index.jsp?"
我是 OpenLaszlo 开发新手,并且尝试过 Eclipse(希望能完成不错的代码),但发现它对我的口味来说太重了。又转而使用 Textmate,但 OpenLaszlo 的 bundle 已经过
作为一名长期的 Flex 开发人员,我考虑过使用 OpenLaszlo 构建我的下一个应用程序——它也应该在 iPad 上运行。 OpenLaszlo 提供了 Flash 和 DHTML 运行时,但除
我尝试通过 WebSocket Api 连接我的 openlaszlo 应用程序。但它没有奏效。我在 lzx 文件中使用了 javascript。相同的 javascript 作为纯 html 文件工
好像OpenLaszlo可以 run on AIR .不太明显的是 OpenLaszlo 应用程序是否可以使用特定于 AIR 的 API,例如文件系统访问。如果是这样,具体是如何完成的? 最佳答案 虽
我一直在尝试在 SWF10 运行时上为我的一些 OpenLaszlo 应用程序添加辅助功能。基本上我一直无处可去。我用来测试的屏幕阅读器,Mac 上的“VoiceOver”拒绝注意到我的 flash
我目前正在 Flex 中从事 RIA 项目,但最近遇到 openlaszlo 。似乎很多大型项目都选择了它而不是 Flex,例如流媒体音乐服务 Pandora。我很感兴趣为什么。到目前为止,我看到的最
如何在 openlaszlo 中使用 LzBrowser.loadURL() 在查询字符串中传递两个值。 我的示例代码: LzBrowser.loadURL("../modules/Index.jsp
我打算自定义 Openmeetings,并且想知道是否有适用于 Openlaszlo 的 GUI 编辑器。 显然有一个名为 IDE4Lazlo 的插件,在 IBM 和 Eclipse.org 上都提到
我读过 OpenLaszlo 的 lzdeploy tool , 但似乎只有很少的文档可用。 应该可以使用 Apache Ant 构建 OpenLaszlo DHTML 应用程序(例如,作为自动构建过
据我所知,OpenLaszlo 是唯一具有以下特性的富 Internet 应用程序平台: 基于声明性 XML 的用户界面语言(类似于 Mozilla 的 XUL)称为 LZX。 将 LZX 交叉编译为
我一直在关注 OpenLaszlo,发现客户端中的脚本是用 JavaScript 实现的。这是否意味着可以使用 JQuery 和 PrototypeJS 等库? 最佳答案 jQuery 和 Proto
我读过 Adobe 的 Flash Builder 4.0+ supports profiling of ActionScript 3应用程序。那么是否可以使用 Flash Builder 相应地
我打算构建一个小型应用程序,它使用 Flash Player 11 的某些功能。是否可以使用 OpenLaszlo 来定位 Flash Player 11 API?在 this discussion它
是否有人尝试使用最新版本的 Adobe AIR SDK 将 OpenLaszlo 应用程序编译为适用于 Android 或 iOS 的移动应用程序?对于不需要大量计算能力的应用程序,性能是否足够?
我目前正在使用以下函数,该函数基于网络上的示例,每秒调用一次以通过视频流显示当前进度。 我可以做些什么来提高效率吗? function secondstominutes(secs){ var s; i
OpenLaszlo的优势之一是,创建自定义组件相对容易,尤其是使用类层次结构的组合,mixins , CSS support ,以及添加到最新版本的 OpenLaszlo 的 CSS2/3 特性。
我是一名优秀的程序员,十分优秀!