Flex Builder 中的后期构建操作

发布于 2024-08-02 02:49:32 字数 123 浏览 3 评论 0原文

如何在 Flex Builder 中添加构建后操作? 例如,我希望我的构建能够正常工作,并从 bin 文件夹中执行; 但我还希望将最终 SWF 的副本自动复制到另一个文件夹(我厌倦了自己这样做)。

谢谢!

How do I add post-build actions in Flex Builder? For example, I'd like my build to work as normal, and execute from the bin folder; but I'd also like a copy of the final SWF to be copied to another folder automatically (I'm sick of doing it myself).

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

怎樣才叫好 2024-08-09 02:49:32

我知道这篇文章已经得到解答,但我发现了一些更简单的东西。 我确信 Ant 解决方案是可行的方法,但我不想在我的小项目中使用 ant。 我真正想要的只是将 html 文件和 swf 文件放在不同的目录中。 我想有很多问题要问。

我正在 Windows 上构建,因此我创建了一个简单的批处理文件来执行构建后步骤(即一些移动命令)。 然后我使用 Windows cmd.exe 在 Flex 中创建了一个新的构建器。 我只是告诉它使用 /C 选项调用批处理文件。 它工作完美并且设置非常简单。 我尝试添加屏幕截图,但我想我对这个网站太陌生了。

I know this post has been answered, but I found something simpler. I'm sure the Ant solutions are the way to go, but I didn't feel like messing with ant for my small project. All I really want is to have my html files and swf files in different directories. I guess that's a lot to ask.

I'm building on windows, so I created a simple batch file that performs my post-build steps (namely some move commands). I then created a new builder in flex using windows cmd.exe. I just told it to call the batch file using the /C option. It works perfectly and was very simple to set up. I tried adding screen shots, but I guess I'm too new to the site.

蝶…霜飞 2024-08-09 02:49:32

您可以使用外部程序扩展或替换 Flex Builder 3 使用的构建器 - ant 是一个不错的选择。

如果您运行“Flex Builder 3 独立版”(这是一个极简 Eclipse 版本 + Flex 构建器插件)而不是标准 Eclipse 中的 Flex 构建器插件,则首先需要安装 ant 支持。 我没有找到单独打包的ant,所以我只是从帮助/软件更新中选择了Java构建环境。

现在您可以转到项目属性(右键单击您的项目,属性)并选择构建器。 您会注意到默认有一个 Flex Builder,您无法删除或更改它。 但是,您可以取消选择它并添加其他构建器。

因此,在您的情况下:“添加”一个新的构建器,ant builder,选择一个build.xml(可以以不同的方式命名),最好来自在您的项目文件夹中,并设置正确的目标。 这将在运行 ant 任务之前或之后继续使用内部 IDE 构建器。 屏幕上的顺序将是构建顺序,您可以使用箭头按钮进行更改。

我用它来将所需的库复制到我的 /lib 文件夹中,使用 IDE 构建(它具有带有错误消息的 Eclipse 集成,纯基于 ant 的命令行构建会错过)来编译 Flex 源代码,并将结果复制到公共部署目录,在此过程中重命名包装器 html 文件。

有关如何编写ant文件的详细信息,请参阅ant文档

You can extend or replace the builder used by Flex Builder 3 with extenal programs - ant is a good choice.

If you run "Flex Builder 3 standalone" (which is a minimalist Eclipse version + the Flex builder plugin) as opposed to the Flex builder plugin in a standard Eclipse, you first need to install ant support. I didn't find ant separately packaged, so I just selected the Java build environment from Help / Software Updates.

Now you can go to your project properties (Right-Click on your Project, Properties) and chose Builders. You'll notice there is a Flex Builder per default, which you cannot remove nor change. However, you can deselect it and you can add other builders.

So in your case: "add" a new builder, ant builder, select a build.xml (can be named differently), preferably from within your project folder, and set the correct targets. This will continue to use the internal IDE builder while running your ant task just before or afterwards. The ordering on the screen will be the build order, which you can change using the arrow buttons.

I used this to copy required libraries into my /lib folder, compile the Flex sources using the IDE build (which has Eclipse-integration with error messages, which a pure ant-based commandline build would miss), and copy the result to a common deploy directory, renaming the wrapper html file in this process.

For details of how to write an ant file, please refer to the ant documentation.

﹏雨一样淡蓝的深情 2024-08-09 02:49:32

您必须创建自定义构建脚本。 无论出于何种原因,包含的默认“构建器”都无法通过界面进行编辑,因此您必须复制其许多功能。 幸运的是(或者可能不是)Flex Builder 使用 Apache Ant 作为其构建脚本,因此这可能是也可能不是您熟悉的方法。

要创建自定义构建脚本:

  1. 在 Flex Navigator 视图中,选择一个项目,然后右键单击(在 Macintosh 上按住 Control 单击)以显示上下文菜单并选择“属性”。
  2. 选择构建器属性页面。 如果您正在使用其他 Eclipse 插件,则可能会列出多个构建器。 Flex Builder 提供了一个名为 Flex 的构建器,您无法对其进行修改。
  3. 选择新建。
  4. 在“选择配置类型”对话框中,选择适当的配置类型。 Flex Builder 支持该程序类型。 选择它并单击“确定”继续。 在新的构建器属性页面中,您可以定义构建器属性并引用 Ant 脚本(XML 文件)。
  5. 单击“确定”将其应用到项目中。

Flex 构建器基于 Eclipse 3.1,因此该版本的 Ant 集成的文档与此处相关。

注意:必须首先在 Flex Builder 中启用 Ant 支持。 我通常使用 Flex Builder 作为插件,而不是独立版本,并且独立版本并不是开箱即用的。 这是有关如何执行此操作的教程

You'll have to create a custom build script. For whatever reason, the included, default 'builder' is not editable through the interface, so you'll have to replicate a lot of its functionality. Luckily, (or maybe not) Flex Builder uses Apache Ant for its build scripts, so this may or may not be a familiar way to do this for you.

To create a custom build script:

  1. In the Flex Navigator view, select a project and then right-click (Control-click on Macintosh) to display the context menu and select Properties.
  2. Select the Builders properties page. If you're using other Eclipse plug-ins, there may be more than one builder listed. Flex Builder provides a builder named Flex, which you cannot modify.
  3. Select New.
  4. In the Choose Configuration Type dialog box, select the appropriate configuration type. Flex Builder supports the program type. Select it and click OK to continue. From the new builder properties page you define the builder properties and reference the Ant script (an XML file).
  5. Click OK to apply it to the project.

Flex builder is based on Eclipse 3.1, so documentation for Ant integration for that release is relevant here.

Note: Ant support must be enabled in Flex Builder first. I usually use Flex Builder as a plugin, rather than the standalone version, and the standalone version doesn't come with it out of the box. Here's a tutorial on how to do this.

您的好友蓝忘机已上羡 2024-08-09 02:49:32

我还推荐使用 ant。

我在这里发布了一篇关于如何为 flexbuilder 设置它的大文章 http: //dispatchevent.org/mims/ant-for-flex-part-1/ 我认为我的构建脚本中甚至有一个在编译后将文件从一个地方复制到另一个地方的示例。

祝你好运!

I would also recommend using ant.

I posted a big article on how to get it set up for flexbuilder here http://dispatchevent.org/mims/ant-for-flex-part-1/ I think there is even an example in my build script of copying files from one place to another after compiling.

Good luck!

完美的未来在梦里 2024-08-09 02:49:32

Steve,

如果您想在 Flex Builder 中使用 Ant,您可能会看到:http://www.peterelst.com/blog/2006/09/03/flex-builder-2-ant-support/

但我不确定这是否适用于 Flex Builder 3或不。

Steve,

If you want use Ant in Flex Builder, you may see:http://www.peterelst.com/blog/2006/09/03/flex-builder-2-ant-support/

but I am not sure this is work in flex builder 3 or not.

ぃ双果 2024-08-09 02:49:32

史蒂夫,

这是有关构建后脚本的更多详细信息。 这将是一个简单的bat 文件。 例如,将以下行添加到简单的文本文件 postbuild.bat (名称并不重要)。

copy bin/*.* 'someother location'

这会将 bin 文件夹中的所有内容复制到另一个文件夹,只需更改“其他位置”即可。

Steve,

Here is a bit more detail on the post build script. It will be a simple bat file. For instance add the below line to a simple text file postbuild.bat (name doesn't matter).

copy bin/*.* 'someother location'

This would copy everything in the bin folder to another folder, just change the 'someother location'.

鹤舞 2024-08-09 02:49:32

最不优雅的解决方案,但它可以在 Linux 上运行。

创建每分钟执行一次的 cron 任务。

使用带有“-u”选项的cp命令。
来自“man cp”。

-u, --update
          copy  only  when  the  SOURCE file is newer than the destination
          file or when the destination file is missing

在 crontab -e 添加

* * * * * cp -u /path/to/bin-debug/*.swf /path/to/destination/

对于更优雅的解决方案 - Ant 的方法。

The least elegant solution but it will work on linux.

Create cron task to be executed every minute.

Use cp command with "-u" option.
From "man cp".

-u, --update
          copy  only  when  the  SOURCE file is newer than the destination
          file or when the destination file is missing

In crontab -e add

* * * * * cp -u /path/to/bin-debug/*.swf /path/to/destination/

For more elegant solution - Ant the way to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文