Building System For Large C#/XNA Projects


This Post will talk about our custom Building System used to create the PloobsEngine MSI Package. Lots of time ago, when the engine code and the project number were smaller, we could afford to build our packages by hand, but when things got bigger and bigger the necessity for something fully automatizated became obvious.

The main funcionalities of our Building System are:

  1. Download Latest/Specific version of your repo (Mercurial)
  2. Compile all Projects, Tests and Demos
  3. Run Some Tests
  4. Compile Documentation
  5. Create and compress the Package (generate the Msi file)
  6. Upload to a Server (ftp)
  7. Notify People (send emails)

Here we will describe with details how each part was implemented, showing some parts of the used scripts.  (Everything is hosted in a Windows 7 machine).

Download Latest/Specific version of your repo.
As said, We used Mercurial for source code management. To download the repo and update to the latest version we used the following script.

set RepoPath=c:/PATH_WHERE_WE_WILL_DOWNLOAD_OUR_REPO
@echo off
echo Downloading Ploobs HG Repo
cd /
if exist %RepoPath%/port-ploobsengine   goto NEXT
md %RepoPath%\
cd %RepoPath%\
call hg clone https://thiagodiaspastor@code.google.com/p/port-ploobsengine/
if %errorlevel% 1 (
   echo Failure Reason Given is %errorlevel%
   chdir /d %OLDDIR%
   exit /b %errorlevel%
)
cd /
:NEXT

cd %RepoPath%port-ploobsengine
call hg pull
call hg update --clean
cd /

The script is very simple, it just creates the repo folder and clone the repo (if it does not exists yet) and then pull and updates its contents to the latest remote version. (the bin folder of the TortoiseHg must be on the Windows Path. If you use SVN or git or …. just adapt the script).

To those that are curious, our public repo is: http://code.google.com/p/port-ploobsengine/

Compile all Projects, Tests and Demos
We have lots of different types of projects in PloobsEngine, then we need to use different tools to build each of them. The following script shows how to deal with these situations:
First of all: Set some Environment Variables (MSBuild Path, XNA PATH, .Net Framework Path …)

SET PATH=%*;%XNAGSv4%Tools;%XNAGSShared%XnaPack;%XNAGSShared%Device Center;C:\Windows\Microsoft.NET\Framework\v4.0.30319\;C:\Windows\Microsoft.NET\Framework\v3.5\;C:\Windows\Microsoft.NET\Framework\v2.0.50727;%PATH%

Using Msbuild for content pipeline and main XNA project

The content pipeline / XNA project are just “regular” Visual Studio projects, to build them we just used the following lines (adapt to your needs)

msbuild %RepoPath%\PloobsEngine\PloobsEngineContent\PloobsEngineContent.contentproj /p:XNAContentPipelineTargetPlatform=Windows;XNAContentPipelineTargetProfile=HiDef;TargetFrameworkVersion=v4.0;Configuration=Release
msbuild %RepoPath%\PloobsEngine\PloobsEngine\PloobsEngine.csproj /p:Configuration=Release

Using the Visual Studion IDE compiling ability directely (msbuild cant compile Visual Studio Installer projects !!!)

Some projects (like those that ends with .vdproj) cant be built using MSBuild, then we call directely the Visual studio line comand IDE utility.

echo Compiling Ploobs Updater
"%VS100COMNTOOLS%..\IDE\devenv.com" /build Release %RepoPath%\PROJEC_PATH\PloobsInstallerSetup.vdproj
rd /s/q FOLDER
md FOLDER
copy %RepoPath%\PROJECT_PATH\*.* FOLDER /Y

Just building and copying the generated contents to a folder (deleting if it already exists)

Using Msbuild to Compile/Clean Full Solutions

The script:

echo Copy Others Demos
rd /s/q SourceCodeDemos
md SourceCodeDemos
msbuild %RepoPath%\PloobsUpdater\PloobsUpdater.sln
msbuild %RepoPath%\AdvancedDemos\AdvancedDemos.sln /t:Clean
msbuild %RepoPath%\IntroductionDemo\IntroductionDemo4.0\IntroductionDemo4.0.sln /t:Clean
msbuild %RepoPath%\ReachDemos\ReachDemos.sln /t:Clean
msbuild %RepoPath%\PhoneSilverLightDemo\GraphicsApp1.sln /t:Clean

Just building the PloobsUpdater.sln Solution and cleaning some others (removing the Bin and Obj folders -> removing previous builds contents, we dont need to send then to the clients !)

Calling Some Custom Scripts

PloobsEngine depends of LOOTS of Dlls, for the end user is easier to have just one with everything inside of it, the following code shows how this can be achieved (using the Microsoft ILMerge Program)

ilmerge /out:PloobsEngineDebug.dll SharedOsiris.dll PloobsEngine.dll FarseerPhysicsXNA.dll Lidgren.Network.dll Library.dll TomShane.Neoforce.Controls.dll BEPUphysics.dll XNAnimation.dll DPSF.dll  /lib:"C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86" /targetplatform:v4,"C:\Windows\Microsoft.NET\Framework\v4.0.30319" /keyfile:XNAnimation.snk  /xmldocs  /ver:0.0.0.1 /log

For more informations about the arguments, look at the ILMerge Documentation. In this line we just merged Lots of dlls (and the xml docs of each one) and signed the generated assembly with a keyfile.

Running Some Tests

To make sure that we are delivering something that works, our building system also implements some custom unity and Visual Tests. The following script calls our Test Module and checks its answer. (if somethings wrong happens, errors are directed to us !)

echo Executing Visual Tests
cd AdvDemosBin
call AdvancedDemos.exe VisualUnitTests
echo Return Code is %errorlevel%
if %errorlevel% == 0 goto LB
   echo Tests Failed, Check the Logs
   set erro=1 #### Pack the logs and mail the programmers =P ....
   exit /b -1
:LB
del *.log
cd ..

Compiling the Documentation
We use the marvelous SandCastle project to create our documentation.
Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies and optionally integrating XML Documentation Comments. It also let us to create some custom pages in order to make a full professional like manual.
The amazing thing is that SandCastle compilation can be triggered using msbuild. (the output is a .chm file), the following script shows how:

if %NODOC% == "FALSE"  goto ND
echo Compiling Ploobs Documentation
msbuild %RepoPath%\Documentation\EngineHelper.shfbproj
rd /s/q Help
md Help
copy "%RepoPath%\Documentation\Ploobs Engine Help.chm" Help /Y
:ND

Creating the Installer (using the marvelous InstallShield Visual Studio Extension)

Each piece are put together with the Install Shield Installer (ends up up a MSI package). The building process can also be triggered using msbuild !!!

echo Creating the Installer
rd /s/q PloobsEngine
md PloobsEngine
rd /s/q %RepoPath%\PloobsInstaller\PloobsInstaller\Express
msbuild %RepoPath%\PloobsInstaller\PloobsInstaller.isproj /p:Configuration=Release;Build=Complete;BuildCompressed=true;BuildSetupExe=true
xcopy %RepoPath%\PloobsInstaller\PloobsInstaller\Express\Release\DiskImages\DISK1\*.*  PloobsEngine /Y /e /i /h

We also run some custom scripts to set the right minor/minor version of the release.

Compressing with Rar (using the classic Winrar)

After the package generation, we need to compress it to a single file (not a requirement in most cases). We just used the classic Winrar for this task.

set PATH="C:\Program Files (x86)\WinRAR";%PATH%
cd PloobsEngine
rd /s/q Package
md Package
cd ..
rar a -r "PloobsEngine/Package/PloobsEngine.rar" "PloobsEngine/*"
copy %DeployPath%\Changes.pdf %DeployPath%\PloobsEngine\Package\ /Y

Uploading to FTP server (generated from the previous pass)

Then we make a simple script to connect to our FTP server to upload the rar file to the righ folder

@echo off
echo Uploading Installer to the Main Server
echo user USER> ftpcmd.dat
echo PASSWORD>> ftpcmd.dat
echo cd Web/Updater>> ftpcmd.dat
echo mkdir teste>> ftpcmd.dat
echo cd teste>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo mput piece.bat>> ftpcmd.dat
echo y>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat FTP_URL
del ftpcmd.dat

The script just generates a dummy conf file (to be able to log in the remote ftp server) and uses it as a parameter to the FTP command.

You can download our packages here: http://www.ploobs.com.br/Updater/0.4.4/PloobsEngine.rar

Sending some Emails and notifications

The last step is notifying everyone involved about the new release. For this we just send some email to the righ people (We made a custom .exe to perform this task, unfortunaly the code is not avaliable but this is a very simple thing to build)

We also have some things to adjust the version number of the releases that were not shown here.

The whole proccess takes more than 4 hours to be completed and is fully automatized. (We remotely calls it and waits for the email containing the Download Link !!!)

There are lots of good build systems avaliable like Team City. I always encourage people to use them. Exceptionaly in our case, i prefered to do all by hand because of the large amount of customization we needed.

  1. #1 by http://news.cartierreplica.win/cartierreplicawin/582.asp on 27 de maio de 2017 - 9:50 am

    Bought this particular as a gift for the the mom and/or she enjoyed information technology. kind good cool cost additionally my personal mother loved information technology. And sent ultra quickly. When you need a gifts quickly while like this then this is the a person you need to purchase!

  2. #2 by Gardening training courses on 27 de maio de 2017 - 10:38 am

    Hello. impressive job. I did not expect this. This is a remarkable story. Thanks!

  3. #3 by pelaminan minang on 27 de maio de 2017 - 10:47 am

    Hiya, I’m really glad I’ve found this information. Today bloggers publish only about gossip and net stuff and this is really irritating. A good web site with exciting content, that is what I need. Thank you for making this site, and I will be visiting again. Do you do newsletters by email?

  4. #4 by Porn on 27 de maio de 2017 - 12:10 pm

    What made you first develop an interest in this topic?

  5. #5 by cnc machining brisbane on 27 de maio de 2017 - 12:38 pm

    Awesome write-up. I am a normal visitor of your site and appreciate you taking the time to maintain the nice site. I’ll be a regular visitor for a long time.

  6. #6 by cheap tyres on 27 de maio de 2017 - 1:53 pm

    Awesome write-up. I am a regular visitor of your web site and appreciate you taking the time to maintain the nice site. I will be a frequent visitor for a long time.

  7. #7 by auto followers instagram on 27 de maio de 2017 - 2:32 pm

    “Real journalist work and helpful summary. It�s amazing how good quality info can be found in the dark alleys of the internet “

  8. #8 by Business News International on 27 de maio de 2017 - 2:43 pm

    I simply couldn’t leave your site prior to suggesting that I really enjoyed the standard information a person supply on your guests? Is gonna be again incessantly in order to check up on new posts

  9. #9 by EugeneUnmat on 27 de maio de 2017 - 3:05 pm

    wh0cd960781 [url=http://lasix17.top/]homepage[/url] [url=http://zithromax10.top/]zithromax[/url] [url=http://buytadalafil2013.top/]tadalafil price[/url] [url=http://buyaugmentin2.gdn/]augmentin[/url] [url=http://flagyl1.top/]get the facts[/url] [url=http://prednisolone2011.top/]prednisolone pack[/url]

  10. #10 by obat pelangsing herbal on 27 de maio de 2017 - 4:16 pm

    Hiya, I am really glad I’ve found this info. Today bloggers publish only about gossip and internet stuff and this is really irritating. A good site with interesting content, this is what I need. Thank you for making this website, and I will be visiting again. Do you do newsletters by email?

  11. #11 by http://news.louboutinreplica.xyz/louboutinreplicaxyz/372.asp on 27 de maio de 2017 - 4:24 pm

    I got that headphonesfor the mother towards moms evening, as well as she definitely adored that it! It is completely pretty headphonesand stating regarding the card you already know goes in package is very emotional!! And the top quality of the beads is actually awesome!

  12. #12 by http://a1security.com.ua/media/com_components/27.html on 27 de maio de 2017 - 4:25 pm

    I have your headphonesfor my mom for the mothers time, as well as she definitely liked information technology! Its truly cute headphonesas well as the suggesting on the card just that will come within the box is very emotional!! As well as the high quality of beads was very good!

  13. #13 by psychologist north brisbane on 27 de maio de 2017 - 4:53 pm

    Hiya, I’m really glad I have found this information. Today bloggers publish just about gossip and net stuff and this is really frustrating. A good web site with exciting content, this is what I need. Thanks for making this web-site, and I will be visiting again. Do you do newsletters by email?

  14. #14 by north brisbane psychologists on 27 de maio de 2017 - 5:04 pm

    Hiya, I am really glad I’ve found this information. Today bloggers publish just about gossip and net stuff and this is actually irritating. A good blog with exciting content, that is what I need. Thanks for making this web site, and I will be visiting again. Do you do newsletters by email?

  15. #15 by Kyocera brisbane on 27 de maio de 2017 - 5:46 pm

    Awesome post. I’m a regular visitor of your site and appreciate you taking the time to maintain the nice site. I’ll be a frequent visitor for a really long time.

  16. #16 by http://vinumstables.se/inactive/75.html on 27 de maio de 2017 - 7:02 pm

    The boy provided myself this of parents evening. He realizes im maybe not about price but what originates from all center. I cannot feel this has the favorite color then really matches the wrist. I not can see bracelets to fit headphonesmy smaller wrist. Most pleased to enjoy recieved your as being a present.

  17. #17 by http://www.knowyournextmove.com/simple/68.html on 27 de maio de 2017 - 7:02 pm

    Great headphonespick, nicely priced additionally exactly what is actually shown. Awesome gifts box then poem also enclosed. Ideal towards mother’s day!

  18. #18 by self healing books on 27 de maio de 2017 - 7:12 pm

    that could be the end of this report. Here youll find some internet sites that we think youll enjoy, just click the links over

  19. #19 by play games on 27 de maio de 2017 - 8:15 pm

    I have been browsing online more than three hours these days, but I never discovered any attention-grabbing article like yours. It is lovely worth enough for me. In my view, if all site owners and bloggers made good content as you did, the web will probably be a lot more useful than ever before.

  20. #20 by gym bag on 27 de maio de 2017 - 8:16 pm

    I simply could not go away your website prior to suggesting that I really enjoyed the usual information an individual supply on your guests? Is going to be again often in order to inspect new posts

  21. #21 by http://news.bvlgaribracelet.xyz/bvlgaribraceletxyz/112.asp on 28 de maio de 2017 - 2:30 am

    Our son gave me this towards mothers evening. He understands im not really around price tag then again just what comes from that the heart. I cannot believe this has our favourite shade additionally even fits my wrist. I never ever could look for bracelets to fit headphonesmy personal small wrist. Most pleased to has recieved it being a gift.

  22. #22 by http://news.cartierreplica.xyz/cartierreplicaxyz/356.asp on 28 de maio de 2017 - 2:30 am

    Ideal headphonesget, nicely listed as well as exactly what are shown. Perfect gifts box furthermore poem furthermore enclosed. Ideal of mother’s time!

  23. #23 by freechip poker on 28 de maio de 2017 - 5:07 am

    Hiya, I’m really glad I have found this information. Nowadays bloggers publish only about gossip and net stuff and this is actually irritating. A good site with exciting content, this is what I need. Thank you for making this web-site, and I’ll be visiting again. Do you do newsletters by email?

  24. #24 by bicara wanita on 28 de maio de 2017 - 6:48 am

    Awesome write-up. I am a regular visitor of your web site and appreciate you taking the time to maintain the nice site. I’ll be a frequent visitor for a really long time.

  25. #25 by plakat akrilik on 28 de maio de 2017 - 7:05 am

    Awesome write-up. I am a normal visitor of your website and appreciate you taking the time to maintain the nice site. I will be a frequent visitor for a really long time.

  26. #26 by Family Trip on 28 de maio de 2017 - 7:14 am

    I as well as my buddies were studying the excellent tips and hints found on your web page and then immediately got an awful suspicion I never thanked the website owner for those strategies. These men are already as a result excited to read them and have sincerely been enjoying these things. I appreciate you for truly being simply helpful and also for deciding upon variety of ideal subject areas most people are really desperate to understand about. My personal sincere apologies for not saying thanks to you earlier.

  27. #27 by Higher Education on 28 de maio de 2017 - 7:14 am

    you’re in point of fact a excellent webmaster. The website loading pace is incredible. It kind of feels that you’re doing any distinctive trick. Moreover, The contents are masterpiece. you have performed a fantastic job on this topic!

  28. #28 by Flower in Vase on 28 de maio de 2017 - 7:50 am

    Hiya, I am really glad I’ve found this information. Today bloggers publish just about gossip and internet stuff and this is really irritating. A good website with interesting content, that is what I need. Thanks for making this web site, and I will be visiting again. Do you do newsletters by email?

  29. #29 by http://news.panchro.xyz/panchroxyz/496.asp on 28 de maio de 2017 - 9:21 am

    Bought that as being a gift for our mom then she loved that. great excellent cool price and my mom enjoyed it. Furthermore delivered extremely quick. So if you need a gift quickly while like this versus this is the any make sure you pick!

  30. #30 by http://www.creativehutindia.com/power/68.html on 28 de maio de 2017 - 9:22 am

    But not since fancy inside real life should moms wrist are never 2small do not choose this cause things try to be tight .. the cute and yet something yur 5year aged make . No on reduced its one okay gifts in order to render yet not per wow present…cant go wrong in case do not has a lot to blow for a gift after that see they

  31. #31 by Cartier Love Ring Replica on 28 de maio de 2017 - 9:33 am

    I got this one gift concerning our mother for the Christmas time due she was your precious jewelry freak. The particular one thing she cannot don a lot to is, bracelets. I bought this girl this charm bracelet plus whenever she started that yesterday she absolutley adored it! Nowadays the problem is, the lady buying things on top of and down simply by herself. Haha… overall awesome system, it sent to appeared incredibly early and/or our mother is actually enjoying information technology. Thank we.

  32. #32 by http://www.ja-trax.com/fr/soledshoes.asp on 28 de maio de 2017 - 9:34 am

    it comes within a pretty package appearance ideal but it is slightly smaller much for my personal moms wrist but it appearance very good only wish information technology had been extended

  33. #33 by http://www.indianmedicaltourismshop.com/uploads/68.html on 28 de maio de 2017 - 11:07 am

    The boy provided myself that for the mothers evening. He understands im never regarding price and yet everything originates from their heart. I can’t know this has our favourite color and/or truly fits our wrist. I by no means could come across bracelets to suit headphonesthe little wrist. Quite happy to come with recieved your as a gift.

  34. #34 by http://ekovatten.se/js/liy/516.html on 28 de maio de 2017 - 11:08 am

    Very good headphoneschoose, nicely priced as well as what was revealed. Awesome gift package and/or poem always enclosed. Very good of mother’s time!

  35. #35 by http://enhand.se/ckfinder/skins/hitter/412.html on 28 de maio de 2017 - 11:08 am

    My boy provided me personally your towards mothers day. He understands im not around price then again everything comes from that the center. I can’t think this has my preferred colors as well as really suits my personal wrist. I not could come across bracelets to suit headphonesmy tiny wrist. Extremely pleased to have actually recieved this one as being a present.

  36. #36 by buy one get one free shoes online on 28 de maio de 2017 - 11:18 am

    Note: Fb will assign you an unsightly URL for your page.|Allow us review in brief couple of of the most taking place bidding sites in the nation. It significantly curtails the endless surfing through each service provider website. Registration is needed to verify your identification.|You require to conscious of these simply because you are most likely heading to ship products in most transactions. Few LED light for bicycle function from battery, few function from the power of paddles.|Post useful articles and links to relevant information of curiosity to your goal market. Hitachi DH36DAL is a unique type of drill that serves more than 1 objective. I am going to keep it my little secret.|You can effortlessly avail the online facility and get home shipping and delivery too! If you follow some precautionary actions it will be more safe on buying at ebay. And the automobile produced its auspicious entrance.|Your Facebook enthusiast web page should assist your clients enhance on their own or their lives in some tangible way.

1 259 260 261
(não será publicado)