in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

Follow Up: How do you manage your open source software

A while ago I asked: How do you manage your open source software?. It seems like Bill Pierce had the same question, so I thought I should get to writing my follow up.

I also asked this same question on the alt.net mailing list (whole thread is here).

A lot of folks suggest not updating once you have picked some library to use. That is a fine approach in some cases, but in my opinion things like Castle and NHibernate are never done and I want to be able to update and take advantage of new features.

So, how do I handle this today?

  1. Import the open source project subversion repository into a git repository.
  2. Build the project and copy its outputs to MyProject/Lib/OpenSourceProjectName using a rakefile I wrote.
  3. Commit the changes to MyProject noting the sha1 (from git) and the svn revision of the open source project.
  4. Create a git tag in the open source project git repository that ties it to the branch in my other project.

What does this look like in practice?

	cd /cygdrive/q/castle
	git svn fetch #gets changes from castle svn
	cd ..
	rake build:castle libcopy:castle_to_myproject
	cd myproject
	git add lib/castle
	git commit -m "Updated castle libs to sha xxxxxxxxxxxxxx svn revision 4000"
	cd ../castle
	git tag -f -a myproject-trunk

So far I have been pretty happy with this approach. It could definitely be a little more automated, but it is doing the job.

The link between the open source code and myproject is maybe a bit too fragile. I think I can do better using either git submodules or braid.

I've been experimenting with braid on my rails projects, I'm not sure yet if it will make sense to use it with for this though.

If you are interested here's the rakefile I use:

require 'rake'

class LibCopy

  def copy(lib_files, lib_build_dir)
    libs_in_use = lib_files
    libs_in_use.each do |lib|
      puts "Check for " + lib
      lib_file = lib_build_dir + "/" +  lib.pathmap("%f") 
      if File.exists?(lib_file)
        puts "Found " + lib_file
        cp lib_file, File.expand_path(lib.pathmap("%p"))
      else
        puts "lib not found:" + lib_file 
      end
    end
  end
end

namespace :build do


  CASTLE_BUILD_DIR = 'q:/castle/build/net-3.5/debug'

  task :castle do |t|
    cd 'castle'
    puts "Building Castle...."
    puts sh("c:\\tools\\nant-0.86-beta1\\bin\\nant.exe -t:net-3.5 -D:common.testrunner.enabled=false -D:mbunit-console=c:\\progra~1\\mbunit\\mbunit.cons.exe")
    puts "Build Finished"
    cd '..'
  end

  task :rhino do |t|
    #Seems like i may need to do an MSBUILD using the generator sln file before the whole build will work
    cd 'rhino-tools'
    puts "Building Rhino-tools"
    puts `msbuild.exe BuildAll.build`
    puts "Done building rhino"

  end

  task :update_rhino_from_castle do
    rhino_castle_libs = FileList['./rhino-tools/SharedLibs/Castle/*']
    LibCopy.new.copy(rhino_castle_libs, CASTLE_BUILD_DIR)
  end
end

namespace :libcopy do 

  task :castle_to_api do
    api_castle_libs = FileList['./OmniaAPI/DependentFiles/Castle/*']
    LibCopy.new.copy(api_castle_libs,CASTLE_BUILD_DIR)
  end

  task :castle_to_mrrest do
    dest_castle_libs = FileList['./MRRestSupport/lib/*']
    LibCopy.new.copy(dest_castle_libs,CASTLE_BUILD_DIR)
  end

  task :castle_to_myproject do
    dest_castle_libs = FileList['./myproject/DependentFiles/Castle/*']
    LibCopy.new.copy(dest_castle_libs,CASTLE_BUILD_DIR)
  end

  task :castle_to_codegenerator do
    dest_castle_libs = FileList['./Castle.MonoRail.CodeGenerator/Libraries/*.dll']
    LibCopy.new.copy(dest_castle_libs,CASTLE_BUILD_DIR)
  end
end

Technorati Tags: ,

Published Apr 06 2008, 08:50 AM by chrisortman
Filed under: , , ,

Comments

No Comments

Leave a Comment

(required)
(optional)
(required)
Add
Powered by Community Server (Commercial Edition), by Telligent Systems