Continuous Integration with Flex, Hudson, and ArcGIS Server, Part IV
(Part 1, Part 2, Part 3, Part 5)
(Note: I have started moving our builds to rake, the Ruby build DSL. It is, howyousay, fantastic. I see more posts in our series….)
Now that the school year has begun, I can get back into this series. Last we left, we had ant running the build and the scripts. Now it’s time to make the build portable, which means that our build.properties file needs to well, go away. All this really means is taking build.properties and copying it to build.properties.template. Then deleting build.properties out of source control. Anyone getting our build our of source control will have to create a local build.properties file, complete with all the settings that make the build go. This is a “best practice” and stops developers from overwriting each others’ properties when they check in the build file.
So, do that. Rename build.properties to build.properties.template. If you ant build-all now, the build throws an error, something about ${wrapper.dir} not found. That’s because the build couldn’t pull in the properties file. Copying build.properties.template to build.properties fixes the build. However, we aren’t done with the renaming. I want to introduce the concept of build environments to my build. That way, I can have different properties files for named environments. I may want to set up different SDK builds, etc. as well, and environments will help me do that. All I need to do is add a property to the top of the build.xml file to hold my environment name. It looks like:
This means that, by default, I’ll be running in the local environment. This also means that build.properties.template becomes local.properties.template. Now, I have to copy local.properties.template to local.properties to get the build going. Another change to the build.xml file is to the line that pulls in our properties file. It changes from:
The cool thing is that I can add another file called (for example) 34SDK.properties that points to the Flex 3.4 SDK. Then to run that build, I can write:
ant build-all -Denv=34SDK
and it will overwrite our env variable and look for a 34SDK.properties file. Flexibility is fun.
You can ignore the .metadata folder, as that is a Flex Builder thing and I won’t put it in source control. The build folder will hold the output of our build, docs is self-explanatory, src is where our Flex Builder project lives, and tools holds stuff we need to run the build. In this case, we need the FluintAirTestRunner.exe, which I’ll copy into my tools dir. The build file lives in the root of our project space, which means it has moved up relative to the Flex Builder project. We need to change some things in the build.properties file to get our build going again.
Now, running ‘ant’ at the project space root builds the project, and running ant test builds the test module and runs the test. We copy this file to local.properties.template, and we are ready to import this project into source control.
I found a couple of posts that show how to import an existing directory into Subversion and make that directory your working copy, which is snazzy. It’s all here. If you know anything about svn, that is a pretty straightforward post.
That’s that. We are now ready for Hudson. in the next post, we’ll get Hudson up, running, building our stuff, and running our test.