Flex, Ant and TeamCity - apache-flex

Is anyone using TeamCity for building their Flex apps? We're using .Net for our main site code and backend flex data calls and we use flex for our application. I have a working Ant build script, but I can't get it to run with the TeamCity Ant Runner. I'm curious if anyone has gotten this working and if they have, could I potentitially see a sample of your build script?
For some reason the build script won't pick up the FLEX_HOME environment variables for the Flex Ant Tasks.

I cannot see why it shouldn´t work. Just declare FLEX_HOME in the top of your Ant script, and point to the sdk on the TeamCity machine, like:
<property name="FLEX_HOME" value="c:/adobe/flex/sdk/3.3"/>

On a previous project I worked on we had exactly the same situation as you and it can work. I can't remember doing anything special to get this going although we may have had to manually set some environment variables in the TeamCity config. Check out the TeamCity docs for how to set these and how to they are used
You might also try using the basic Command line runner to see if that works. When troubleshooting environment variable issues in TeamCity I have found it useful to have part of the build process run a DOS set command (env for Linux) and then look in the build logs to see what the actual environment is.

Related

MSBuild: Web application, build once package and deploy many

I'm sure this question has come up before, but I can't seem to find an elegant solution.
I have a web application project with multiple configurations based on deployment environment (Test, QA, Production) along with web.config transforms for each environment. We are using a web deployment package to automatically create the .zip of the app which can be deployed via MSDeploy. It's easy enough to call the package target multiple times, each with a different configuration:
msbuild MyProject.csproj /t:Package /p:Configuration=QA
msbuild MyProject.csproj /t:Package /p:Configuration=Test
But this triggers a complete rebuild of the web project each time before packaging. I want to build once, then apply the web.config transforms, and create separate packages for each environment. Is there an easy way to accomplish this without forcing a complete rebuild for each environment?
Dupe of Build once and deploy to multiple environments with msdeploy & Visual Studio 2012
I've also been wanting a solution to this, but apparently there isn't any real COMPLETE MS solution that I know of. Visual Studio provides the following (as noted here):
Web.Config transformation
Parameterization
Vishal Joshi concluded with the following:
If you can know your environment settings during build time use
Web.Config transformation.
If you would want to create deployment package only once and then
enter the settings during install time then use Parameters.xml
What I would like to see, though, is have the best of both worlds. I want to "package" up a target having ALL the configuration transformations embedded. Therefore, when the IT guy runs the WebDeploy cmd file (that gets generated when you "package"), they can provide a switch of which environment configuration they want (i.e. Dev, Test, Stage, Prod, Release, etc). I don't believe there is a solution from MS out there that does that. :(

any way to pass -Usechecksum to msdeploy using msbuild

I have a website with lots of files using team build and deploying though web deploy packages. The problem i am having is that the packages are build from one of the machines from the farm and the time stamp will not always match. By default with web deploy that means a full site roll and with so many file and the sync across the cluster this is not optimal.
With cmd line deploy i can pass -UseCheckSum and this is solved for manual deployment. Now i'm trying to use a CI build with auto deploy and passing MSbuild arguments though my build setup. Is there a way to get this to deploy in the same manner?
You can't do it in your MSBuild, but you can edit the Microsoft.Web.Publishing.targets file on the build server to apply -UseChecksum.
See my answer here: https://stackoverflow.com/a/13863041/8037
UPDATE: MS has added the ability to pass the UseChecksum flag to VS 2013. To do this, add the following property to the .pubxml file:
<MSDeployUseChecksum>true</MSDeployUseChecksum>
Further information can be found here: http://blogs.msdn.com/b/webdev/archive/2013/10/30/web-publishing-updates-for-app-offline-and-usechecksum.aspx
If, by "MSBuild" you mean the Web Publishing Pipeline, then the answer is no. The MSDeploy msbuild task supports a UseChecksum property, but the WPP targets provide no mechanism through which you can set it. This is also true of a number of other features (like stored credentials).

Compile Eclipse Project With Ant

I don't have eclipse on my system at all, but I have on my hands an eclipse project (flex) that I would like to compile and I was wondering if there was any way to do it with minimal to no changes having to be made. Is this possible?
I am not aware of a full automatic process which would take a Flex Eclipse project and generate the build.xml.
You could try and take advantage of your eclipse environment to write a ant builder:
You can also try flex2ant to add a specific Ant task to the Ant installation that is part of the Eclipse IDE, therefore making this task visible to the Eclipse environment.
That would facilitate the manual process mentioned above.

Configure Eclipse to run my FlexUnit tests automatically

I'd like to set up my projects in Eclipse to run FlexUnit tests everytime I save my work.
I found an example with JUnit here : http://misko.hevery.com/2009/05/07/configure-your-ide-to-run-your-tests-automatically/
How would you do it? Is it possible to run FlexUnit tests without Flash Player?
Yes, you could create a setup much like the one Misko describes using FlexUnit4. The key is creating an ANT build script that compiles your test runner and then invokes the FlexUnit ANT task on the resulting SWF.
Once you have the ANT build script setup you can jump right into step 4, as outlined in the article.
Getting the ANT build script setup correctly can be a little tricky if you're not familiar with ANT. I found the continuous integration (CI) sample project provided by the FlexUnit4 team to be a great reference. As of this writing, it's available here:
http://opensource.adobe.com/svn/opensource/flexunit/branches/4.x/FlexUnit4SampleCIProject/
Try using Flex Builder 4 beta, it has unit testing integration built in.
Are you using the FlexUnit plugin for Eclipse?
I don't know it, but it should execute FlexUnit tests.
If you want to execute something after you saved, you could use the Save Actions in Eclipse. They are inserted in org.eclipse.jdt.ui.cleanUps (according to a mailing list post).
Oh, I recently found this blog entry: FlexUnit + Ant. It seems like it covers your problem!
Good luck with that!

How is FlexBuilder compiling my app?

I'd like to see the command-line arguments that FlexBuilder is using to compile my application. This is so that I can build them into the ANT script I'm working on. Is there any way to view the command line compilation step?
The reason I'm asking for this is that when I compile my app using Ant/Flex SDK vs. FlexBuilder my app behaves differently.
So I figured out the answer.
First of all, you can get a better idea of how FlexBuilder compiles your app by adding a -dump-config=C:\myConfig.xml to the compile arguments in FlexBuilder. This outputs an xml file containing configuration settings used in the compilation step. You can also use this file as an argument to compc or mxmlc if you'd like. Read more about it
here...
But, here's what actually solved my problem. I was using the regular old Flex SDK installed on our integration server to compile my apps using Ant. This is the free SDK you can download from Adobe's site. I then took the FlexBuilder directory from my local machine and copied it up to the integration server and pointed my build script to use that version of the SDK (and changed my path env variable).
When I compiled using the FlexBuilder version of the SDK, all was well and the strange bugs I was seeing in my app disappeared.
Moral of the story, make sure you are using the same version of the SDK for your automated builds as you use to build locally.

Resources