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