Mercurial > projects > dwt2
annotate rakefile @ 27:1bf55a6eb092
Renamed java tree to base
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 21 Mar 2009 11:33:57 +0100 |
parents | f713da8bc051 |
children | 69b1fa94a4a8 |
rev | line source |
---|---|
1 | 1 # |
2 # RSP : Create a response file for the compiler, which lists all files from the packages | |
3 # Compile and create Headers | |
4 # Move objects to unique names | |
5 # | |
6 require 'find' | |
7 require 'fileutils' | |
8 | |
8 | 9 #DMD="c:\\project\\dmd-2.026\\dmd\\windows\\bin\\dmd.exe" |
10 DMD="dmd" | |
1 | 11 LOCALOBJDIR="obj" |
12 OBJDIR="obj" | |
13 DIMPDIR="imp" | |
14 RSPNAME="rsp" | |
27 | 15 ALL_RESDIRS= [ "base/res", "res" ] |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
16 |
25 | 17 def isWindows |
18 Config::CONFIG['host_os'] =~ /mswin/ | |
19 end | |
20 | |
21 if isWindows | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
22 ALL_RESDIRS << "org.eclipse.swt.win32.win32.x86/res" |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
23 else |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
24 ALL_RESDIRS << "org.eclipse.swt.gtk.linux.x86/res" |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
25 end |
1 | 26 |
27 class String | |
28 def to_path | |
25 | 29 if isWindows |
30 self.gsub( '/', '\\' ); | |
31 else | |
32 self | |
33 end | |
1 | 34 end |
35 end | |
36 | |
16
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
37 def buildTree( basedir, srcdir, resdir, dcargs="" ) |
20 | 38 puts "Building #{basedir}/#{srcdir}" |
1 | 39 |
40 objdir_abs = File.expand_path( OBJDIR ) | |
41 dimpdir_abs = File.expand_path( DIMPDIR ) | |
42 resdir_abs = File.expand_path( File.join( basedir, resdir )) | |
43 srcdir_abs = File.expand_path( File.join( basedir, srcdir )) | |
44 rspfile_abs = File.expand_path( RSPNAME ) | |
45 | |
46 FileUtils.mkdir_p dimpdir_abs | |
47 FileUtils.mkdir_p objdir_abs | |
48 | |
49 rsp = File.new( rspfile_abs, "w+" ) | |
50 rsp.puts "-H" | |
51 rsp.puts "-I#{srcdir_abs.to_path}" | |
52 rsp.puts "-I#{dimpdir_abs.to_path}" | |
53 rsp.puts "-J#{resdir_abs.to_path}" | |
16
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
54 if dcargs.size > 0 then |
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
55 rsp.puts dcargs |
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
56 end |
3
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
57 ALL_RESDIRS.each do | dir | |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
58 rsp.puts "-J#{File.expand_path(dir).to_path}" |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
59 end |
1 | 60 rsp.puts "-c" |
61 rsp.puts "-op" | |
62 Find.find( srcdir_abs ) do |path| | |
63 if path =~ /\.d$/ then | |
64 rsp.puts path.to_path | |
65 end | |
66 end | |
67 rsp.close | |
68 | |
69 Dir.chdir(basedir) do | |
25 | 70 if isWindows |
71 cmd = "#{DMD} @#{rspfile_abs.to_path}" | |
72 else | |
73 cmd = "cat #{rspfile_abs.to_path} | xargs #{DMD}" | |
74 end | |
75 sh cmd, :verbose => false do |ok, res| | |
3
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
76 if !ok then |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
77 Find.find( srcdir_abs ) do |path| |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
78 if FileTest.file?(path) && path =~ /\.di$/ then |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
79 FileUtils.rm path |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
80 end |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
81 end |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
82 |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
83 raise "compile error" |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
84 end |
1 | 85 end |
86 end | |
87 | |
88 Find.find( srcdir_abs ) do |path| | |
89 if FileTest.file?(path) && path =~ /\.di$/ then | |
90 trgfile = File.join( dimpdir_abs, path[ srcdir_abs.length+1 .. -1 ]) | |
91 FileUtils.mkdir_p File.dirname(trgfile) | |
92 FileUtils.mv path, trgfile | |
93 end | |
94 end | |
95 | |
96 srcdirparts = split_all( srcdir_abs ).length | |
97 Find.find( srcdir_abs ) do |path| | |
98 if FileTest.file?(path) && path =~ /\.o(bj)?$/ then | |
99 trgfile = split_all( path )[ srcdirparts .. -1 ].join( "-" ) | |
100 FileUtils.mv path, File.join( objdir_abs, trgfile ) | |
101 end | |
102 end | |
103 | |
104 end | |
105 | |
3
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
106 desc "Clean" |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
107 task :clean do |
20 | 108 puts "Cleaning" |
3
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
109 FileUtils.rm_rf DIMPDIR |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
110 FileUtils.rm_rf OBJDIR |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
111 FileUtils.rm_rf RSPNAME |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
112 end |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
113 |
27 | 114 desc "Build Base (Java Environment and Helpers)" |
115 task :base do | |
116 buildTree( "base", "src", "res" ) | |
1 | 117 end |
118 | |
119 desc "Build SWT" | |
120 task :swt do | |
25 | 121 if isWindows |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
122 buildTree( "org.eclipse.swt.win32.win32.x86", "src", "res" ) |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
123 else |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
124 buildTree( "org.eclipse.swt.gtk.linux.x86", "src", "res" ) |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
125 end |
1 | 126 end |
127 | |
20 | 128 desc "Build Equinox" |
129 task :equinox do | |
16
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
130 buildTree( "org.eclipse.osgi", "src", "res" ) |
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
131 buildTree( "org.eclipse.osgi", "supplement/src", "res" ) |
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
132 buildTree( "org.eclipse.equinox.common", "src", "res" ) |
20 | 133 end |
134 | |
135 desc "Build Eclipse Core" | |
136 task :core do | |
16
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
137 buildTree( "org.eclipse.core.runtime", "src", "res" ) |
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
138 buildTree( "org.eclipse.core.commands", "src", "res" ) |
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
139 buildTree( "org.eclipse.core.jobs", "src", "res" ) |
20 | 140 end |
141 | |
142 desc "Build JFace" | |
143 task :jface do | |
16
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
144 buildTree( "org.eclipse.jface", "src", "res" ) |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
145 end |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
146 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
147 desc "Build JFace.Text" |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
148 task :jfacetext do |
12
bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
Frank Benoit <benoit@tionex.de>
parents:
8
diff
changeset
|
149 buildTree( "org.eclipse.text", "src", "res" ) |
16
dbfb303e8fb0
first complete successful compile (win-only)
Frank Benoit <benoit@tionex.de>
parents:
12
diff
changeset
|
150 buildTree( "org.eclipse.jface.text", "projection", "res", "-Isrc" ) |
12
bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
Frank Benoit <benoit@tionex.de>
parents:
8
diff
changeset
|
151 buildTree( "org.eclipse.jface.text", "src", "res" ) |
20 | 152 end |
153 | |
154 desc "Build UI Forms" | |
155 task :uiforms do | |
12
bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
Frank Benoit <benoit@tionex.de>
parents:
8
diff
changeset
|
156 buildTree( "org.eclipse.ui.forms", "src", "res" ) |
20 | 157 end |
158 | |
159 desc "Build Draw2D" | |
160 task :draw2d do | |
12
bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
Frank Benoit <benoit@tionex.de>
parents:
8
diff
changeset
|
161 buildTree( "org.eclipse.draw2d", "src", "res" ) |
3
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
162 end |
4c0057e71936
Made a class for StringBuffer
Frank Benoit <benoit@tionex.de>
parents:
1
diff
changeset
|
163 |
20 | 164 desc "Build ALL" |
27 | 165 task :all => [ :base, :swt, :equinox, :core, :jface, :jfacetext, :uiforms, |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
166 :draw2d ] |
20 | 167 |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
20
diff
changeset
|
168 desc "Clean, then build ALL" |
20 | 169 task :default => [ :clean, :all ] |
170 | |
171 |