Select to view content in your preferred language

Automate Flex Viewer Source Build

695
5
02-10-2011 01:54 AM
AndrewHaigh
Occasional Contributor
I am looking at potentially using the Flex Viewer as a based for a custom application with Adobe Flash Builder 4 and the SVN source control system.

I'm having problems automating the build process on our build server, I have followed the process describe on: http://help.adobe.com/en_US/flashbuilder/using/WSbde04e3d3e6474c4-59108b2e1215eb9d5e4-8000.html. This all works fine when I attempt to build against an workspace which has already been accessed via Flash Builder but if I get a fresh copy of the code from SVN and try and build / open the workspace in Flash Builder it doesn't seem to recognise the FlexViewer Project...


The files I have in source control are:

\Flex (workspace root)
\Flex\FlexViewer (flex project)
\Flex\FlexViewer\.actionScriptProperties
\Flex\FlexViewer\.flexProperties
\Flex\FlexViewer\.fxpProperties
\Flex\FlexViewer\.project
\Flex\FlexViewer\.settings (and sub files)
\Flex\FlexViewer\html-templates (and sub files)
\Flex\FlexViewer\libs (and sub files)
\Flex\FlexViewer\src (and sub files)

I've been advised not to add the .metadata folders into source control.

Any ideas?

Thanks

Andrew
Tags (2)
0 Kudos
5 Replies
ReneRubalcava
Esri Frequent Contributor
yeah, you'll want to exclude your .* files and folders from the svn because they will usually be machine specific and path dependant. So they won't play well across multiple machines.

I have never used the fb.exportReleaseBuild, but this is probably going to be a FlashBuilder dependant tool. I have not checked to see if it's in the SDK folder or the FlashBuilder App folder.

I have been using your very scenario for a couple of years now, svn->automated build.

To get started, I would recommend the following walkthroughs.
http://www.unitedmindset.com/jonbcampos/2010/01/07/using-ant-to-build-an-application/
http://www.unitedmindset.com/jonbcampos/2010/01/14/building-a-library-with-ant/
http://www.unitedmindset.com/jonbcampos/2010/01/19/building-the-html-wrapper-with-ant/
http://www.unitedmindset.com/jonbcampos/2010/01/20/building-a-custom-html-wrapper-with-ant/
http://www.unitedmindset.com/jonbcampos/2010/01/21/including-assets-files-with-ant/
http://www.unitedmindset.com/jonbcampos/2010/01/26/building-a-library-and-application-with-ant/
http://www.unitedmindset.com/jonbcampos/2010/01/28/building-asdocs-with-ant/
http://www.unitedmindset.com/jonbcampos/2010/02/09/the-master-flex-ant-file/

There are a couple of others that have to do with building FlexUnit tests with ANT, but you could find them in there.

Now, I have not tried creating build scripts for Flexviewer, but ideally, I would invest the time into creating a build script per widget. This way, a co-worker can work on a widget, I could work on a widget and we could both run our widget specific build scripts without having to rebuild the whole project.

So in a per widget ANT build scenario in your svn, you could have a master ANT build that would run each individual build file, while at the same time it should allow you to build the widgets independantly.
Here is a sample of using ANT to compile modules.
http://jvalentino.blogspot.com/2010/03/flex-ant-build-optimized-modules_24.html
http://modular.theflexsite.net/blog/ant/build.xml
0 Kudos
AndrewHaigh
Occasional Contributor
Rene,

Thanks for your suggestions on this.

I've had feedback from Adobe that this is a known limitation of their software and there is no workaround.

As such it looks like I'll have to progress on the process you've described.

Thanks

Andrew
0 Kudos
AndrewHaigh
Occasional Contributor
Well I've created quite a basic build script for the Flex Viewer as a starting point but when I try and complie I'm getting error relating to
Error: unable to resolve 'assets/images/cross_cursor.png' for transcoding


I've looked on the internet and most of the results on these errors talk about missing files but I've checked the files and they all seem to be present.

The build file is:

<project name="Flex Build" basedir=".">
  
  <property name="FLEX_HOME" value="D:\apps\Adobe Flash Builder 4\sdks\4.0.0" />
  <property name="project.src.dir" value="${basedir}\src" />
  <property name="output.dir" value="D:\CM\Out" />
  <property name="debug" value="false" />
    
  <taskdef resource="flexTasks.tasks" classpath="${basedir}\buildLibs\flexTasks.jar" />
  
  <target name="compileApp">
    <echo message="About to complie Flex Application" />
 
 <delete dir="${output.dir}" />
 
 <mxmlc file="${project.src.dir}\index.mxml"
        incremental="false"
     actionscript-file-encoding="UTF-8"
     output="${output.dir}\FlexViewer.swf"
     debug="${debug}"
     keep-generated-actionscript="false">
  <load-config filename="${FLEX_HOME}\frameworks\flex-config.xml" />
  <compiler.source-path path-element="${project.src.dir}" />
  <compiler.library-path dir="${basedir}\libs">
    <include name="*.swc" />
  </compiler.library-path>
 </mxmlc> 
 
 <echo message="Complete" />
  </target>

</project>


The full logfile is attached.

Has anyone seen this error before?

Thanks

Andrew
0 Kudos
ReneRubalcava
Esri Frequent Contributor
Try adding a "/" in front of the path in your app like
"/assets/images/cross_cursor.png"

The mxmlc compiler can be picky about that when using embeds in your app.
0 Kudos
AndrewHaigh
Occasional Contributor
Thanks, that seemed to fix that problem, now I just need to figure out the Locale error's

Thanks for your help

Andrew
0 Kudos