Mercurial > projects > dwt2
view rakefile @ 24:b7a1d02a0e1f
renamed swt win resource files
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 20 Mar 2009 14:09:41 +0100 |
parents | 9b96950f2c3c |
children | f713da8bc051 |
line wrap: on
line source
# # RSP : Create a response file for the compiler, which lists all files from the packages # Compile and create Headers # Move objects to unique names # require 'find' require 'fileutils' #DMD="c:\\project\\dmd-2.026\\dmd\\windows\\bin\\dmd.exe" DMD="dmd" LOCALOBJDIR="obj" OBJDIR="obj" DIMPDIR="imp" RSPNAME="rsp" ALL_RESDIRS= [ "java/res", "res" ] if Rake::Win32.windows? ALL_RESDIRS << "org.eclipse.swt.win32.win32.x86/res" else ALL_RESDIRS << "org.eclipse.swt.gtk.linux.x86/res" end class String def to_path self.gsub( '/', '\\' ); end end def buildTree( basedir, srcdir, resdir, dcargs="" ) puts "Building #{basedir}/#{srcdir}" objdir_abs = File.expand_path( OBJDIR ) dimpdir_abs = File.expand_path( DIMPDIR ) resdir_abs = File.expand_path( File.join( basedir, resdir )) srcdir_abs = File.expand_path( File.join( basedir, srcdir )) rspfile_abs = File.expand_path( RSPNAME ) FileUtils.mkdir_p dimpdir_abs FileUtils.mkdir_p objdir_abs rsp = File.new( rspfile_abs, "w+" ) rsp.puts "-H" rsp.puts "-I#{srcdir_abs.to_path}" rsp.puts "-I#{dimpdir_abs.to_path}" rsp.puts "-J#{resdir_abs.to_path}" if dcargs.size > 0 then rsp.puts dcargs end ALL_RESDIRS.each do | dir | rsp.puts "-J#{File.expand_path(dir).to_path}" end rsp.puts "-c" rsp.puts "-op" Find.find( srcdir_abs ) do |path| if path =~ /\.d$/ then rsp.puts path.to_path end end rsp.close Dir.chdir(basedir) do sh "#{DMD} @#{rspfile_abs.to_path}" do |ok, res| if !ok then Find.find( srcdir_abs ) do |path| if FileTest.file?(path) && path =~ /\.di$/ then FileUtils.rm path end end raise "compile error" end end end Find.find( srcdir_abs ) do |path| if FileTest.file?(path) && path =~ /\.di$/ then trgfile = File.join( dimpdir_abs, path[ srcdir_abs.length+1 .. -1 ]) FileUtils.mkdir_p File.dirname(trgfile) FileUtils.mv path, trgfile end end srcdirparts = split_all( srcdir_abs ).length Find.find( srcdir_abs ) do |path| if FileTest.file?(path) && path =~ /\.o(bj)?$/ then trgfile = split_all( path )[ srcdirparts .. -1 ].join( "-" ) FileUtils.mv path, File.join( objdir_abs, trgfile ) end end end desc "Clean" task :clean do puts "Cleaning" FileUtils.rm_rf DIMPDIR FileUtils.rm_rf OBJDIR FileUtils.rm_rf RSPNAME end desc "Build Java" task :java do buildTree( "java", "src", "res" ) end desc "Build SWT" task :swt do if Rake::Win32.windows? buildTree( "org.eclipse.swt.win32.win32.x86", "src", "res" ) else buildTree( "org.eclipse.swt.gtk.linux.x86", "src", "res" ) end end desc "Build Equinox" task :equinox do buildTree( "org.eclipse.osgi", "src", "res" ) buildTree( "org.eclipse.osgi", "supplement/src", "res" ) buildTree( "org.eclipse.equinox.common", "src", "res" ) end desc "Build Eclipse Core" task :core do buildTree( "org.eclipse.core.runtime", "src", "res" ) buildTree( "org.eclipse.core.commands", "src", "res" ) buildTree( "org.eclipse.core.jobs", "src", "res" ) end desc "Build JFace" task :jface do buildTree( "org.eclipse.jface", "src", "res" ) end desc "Build JFace.Text" task :jfacetext do buildTree( "org.eclipse.text", "src", "res" ) buildTree( "org.eclipse.jface.text", "projection", "res", "-Isrc" ) buildTree( "org.eclipse.jface.text", "src", "res" ) end desc "Build UI Forms" task :uiforms do buildTree( "org.eclipse.ui.forms", "src", "res" ) end desc "Build Draw2D" task :draw2d do buildTree( "org.eclipse.draw2d", "src", "res" ) end desc "Build ALL" task :all => [ :java, :swt, :equinox, :core, :jface, :jfacetext, :uiforms, :draw2d ] desc "Clean, then build ALL" task :default => [ :clean, :all ]