Category Archives: Delphi

A Simple Delphi rakefile

Building projects has always been a pain in the arse. You want it to be simple, fast and easily reproducible, all of which are tenets of good continuous integration. When it comes to building a Delphi project I’ve tried a whole slew of things from batch files to the Ant-based Want to very slick IDE’s like Automated Build Studio and FinalBuilder. I keep coming back to simple DOS-based apps though because in my ideal world a user should be able to do a clean checkout of your code and then be able to build.

Currently I use Want, which is a Delphi port of Java’s Ant, .NET users will probably think of NAnt which was also a port and then heavily extended. Ant, or it’s derivatives, is great until you need to manage a large build file and have to wade though all that xml to figure out what’s going on. Xml is just not the best format for humans to muck about in so lately I’ve been looking at Rake, basically Ruby’s version of make. Maybe I’ll whip this up into an tutorial or something more informative but for now here is a *very* basic build script using rake, in fact it’s the one I use to build my ZuneKeys application:

(I’ll sex up the code formatting later once I find a good online code formatter)

def compile_project(project_file)
args = “-B -Q #{project_file}”;
result = %x[dcc32 #{args}]
if result =~ /Error/
puts result
else
project_name = project_file.gsub(/..*/, “”)
puts “built #{project_name}”
end
end

file ‘ZuneKeys.exe’ => ['ZuneKeys.dpr', FileList['*.pas']] do
compile_project “ZuneKeys.dpr”
end

task :default => ['ZuneKeys.exe'] do
end

desc “Remove temporary files created during compile”
task :clean do
if File.exists?(‘ZuneKeys.exe’)
rm “ZuneKeys.exe”
end
rm FileList['*.dcu']
puts “clean”
end

task :release => [:clean, :default] do
puts “release project”
end

TortoiseSVN global ignore pattern for Visual Studio and Delphi

Seems I’m reinstalling all the time and I commonly forget my global ignore pattern for svn. Here it is for future me:

*bin *obj RECYCLER Bin *.user *.suo *.dcu __history ModelSupport_* *.rsm thumbs.db

This pattern is useful for Visual Studio and Delphi development, though if you’re checking in third-party Delphi components be sure you have the full source, otherwise you may need to pull the *.dcu part of the pattern.