rakish 0.9.01.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/RakishOverview.html +8 -0
- data/doc/SimpleJavaSamples.txt +448 -0
- data/doc/ToDoItems.txt +18 -0
- data/doc/UserGuide +15 -0
- data/doc/WhyIDidIt.txt +96 -0
- data/lib/rakish/ArchiveBuilder.rb +216 -0
- data/lib/rakish/BuildConfig.rb +254 -0
- data/lib/rakish/CppProjects.rb +696 -0
- data/lib/rakish/IntellijConfig.rb +123 -0
- data/lib/rakish/JavaProjects.rb +504 -0
- data/lib/rakish/PlatformTools.rb +299 -0
- data/lib/rakish/Rakish.rb +2049 -0
- data/lib/rakish/RakishProject.rb +539 -0
- data/lib/rakish/RubydocModule.rb +58 -0
- data/lib/rakish/TomcatProjects.rb +45 -0
- data/lib/rakish/VcprojBuilder.rb +256 -0
- data/lib/rakish/WindowsCppTools.rb +897 -0
- data/lib/rakish/ZipBuilder.rb +82 -0
- data/lib/rakish.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +94 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
|
|
2
|
+
module Rakish
|
|
3
|
+
|
|
4
|
+
# C++ build tools
|
|
5
|
+
# Not really part of public distributioin - too littered with local stuff
|
|
6
|
+
# specific to my main builds This needs to be converted to work in a more configurable way
|
|
7
|
+
module PlatformTools
|
|
8
|
+
|
|
9
|
+
VALID_PLATFORMS = {
|
|
10
|
+
:Win32 => {
|
|
11
|
+
:requires => 'WindowsPlatformTools.rb',
|
|
12
|
+
:factory => :WindowsToolsFactory,
|
|
13
|
+
},
|
|
14
|
+
:Win64 => {
|
|
15
|
+
:requires => 'WindowsPlatformTools.rb',
|
|
16
|
+
:factory => :WindowsToolsFactory,
|
|
17
|
+
},
|
|
18
|
+
:iOS => {
|
|
19
|
+
:requires => 'IOSPlatformTools.rb',
|
|
20
|
+
:factory => :IOSToolsFactory,
|
|
21
|
+
},
|
|
22
|
+
:Linux32 => {
|
|
23
|
+
:requires => 'Rakish.rb',
|
|
24
|
+
},
|
|
25
|
+
:Linux64 => {
|
|
26
|
+
:requires => 'Rakish.rb',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
def self.parseConfigString(strCfg)
|
|
31
|
+
|
|
32
|
+
splitcfgs = strCfg.split('-');
|
|
33
|
+
platform = splitcfgs[0];
|
|
34
|
+
|
|
35
|
+
platformBits = '32';
|
|
36
|
+
if(platform =~ /\d+/)
|
|
37
|
+
platform = $`;
|
|
38
|
+
platformBits = $&;
|
|
39
|
+
end
|
|
40
|
+
if(platform === 'Win')
|
|
41
|
+
platform = 'Windows';
|
|
42
|
+
end
|
|
43
|
+
return({ :platformType=>platform,
|
|
44
|
+
:platformBits=>platformBits,
|
|
45
|
+
:split=>splitcfgs
|
|
46
|
+
});
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.getConfiguredTools(strCfg,config)
|
|
50
|
+
|
|
51
|
+
parsed = parseConfigString(strCfg);
|
|
52
|
+
split = parsed[:split];
|
|
53
|
+
|
|
54
|
+
platform = split[0].to_sym;
|
|
55
|
+
pdef = VALID_PLATFORMS[platform];
|
|
56
|
+
unless(pdef)
|
|
57
|
+
puts("###### platform #{platform} not a supported");
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
config.set(':PLATFORM',platform);
|
|
61
|
+
|
|
62
|
+
# load tools module and initialize a tools object
|
|
63
|
+
require File.join(Rakish::MAKEDIR,pdef[:requires]);
|
|
64
|
+
factory = PlatformTools.const_get(pdef[:factory]);
|
|
65
|
+
tools = factory.loadTools(parsed,config);
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class ToolsBase
|
|
70
|
+
include Rakish::Util
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# given a list of dependencies will write out a '.raked' format dependencies file
|
|
74
|
+
# for the target task
|
|
75
|
+
def updateDependsFile(task, outName, dependencies)
|
|
76
|
+
|
|
77
|
+
srcfile = task.source
|
|
78
|
+
tempfile = "#{outName}.temp";
|
|
79
|
+
|
|
80
|
+
File.open(tempfile,'w') do |out|
|
|
81
|
+
if(dependencies.size > 0)
|
|
82
|
+
out.puts "t = Rake::Task[\'#{task.name}\'];"
|
|
83
|
+
out.puts 'if(t)'
|
|
84
|
+
out.puts ' t.enhance ['
|
|
85
|
+
out.puts " \'#{srcfile}\',"
|
|
86
|
+
dependencies.each do |f|
|
|
87
|
+
out.puts " \'#{f}\',"
|
|
88
|
+
end
|
|
89
|
+
out.puts ' ]'
|
|
90
|
+
out.puts 'end'
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# only touch file if new files differs from old one
|
|
95
|
+
if(textFilesDiffer(outName,tempfile))
|
|
96
|
+
# @#$#@$#@ messed up. set time of new file ahead by one second.
|
|
97
|
+
# seems rake time resolution is low enough that the comparison often says
|
|
98
|
+
# times are equal between depends files and depends.rb.
|
|
99
|
+
mv(tempfile, outName, :force=>true);
|
|
100
|
+
time = Time.at(Time.new.to_f + 1.0);
|
|
101
|
+
File.utime(time,time,outName);
|
|
102
|
+
else
|
|
103
|
+
rm(tempfile, :force=>true);
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def initDependsTask(cfg) # :nodoc:
|
|
108
|
+
|
|
109
|
+
# create dependencies file by concatenating all .raked files
|
|
110
|
+
tsk = file "#{cfg.nativeObjectPath()}/depends.rb" => [ :includes, cfg.nativeObjectPath() ] do |t|
|
|
111
|
+
cd(cfg.nativeObjectPath(),:verbose=>false) do
|
|
112
|
+
File.open('depends.rb','w') do |out|
|
|
113
|
+
out.puts("# puts \"loading #{t.name}\"");
|
|
114
|
+
end
|
|
115
|
+
t.prerequisites.each do |dep|
|
|
116
|
+
next unless (dep.pathmap('%x') == '.raked')
|
|
117
|
+
system "cat \'#{dep}\' >> depends.rb"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
# build and import the consolidated dependencies file
|
|
122
|
+
task :depends => [ "#{cfg.nativeObjectPath()}/depends.rb" ] do |t|
|
|
123
|
+
load("#{cfg.nativeObjectPath()}/depends.rb")
|
|
124
|
+
end
|
|
125
|
+
task :cleandepends do
|
|
126
|
+
deleteFiles("#{cfg.nativeObjectPath()}/*.raked",
|
|
127
|
+
"#{cfg.nativeObjectPath()}/depends.rb");
|
|
128
|
+
end
|
|
129
|
+
tsk
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def initCompileTask(cfg)
|
|
133
|
+
cfg.project.addCleanFiles("#{cfg.nativeObjectPath()}/*#{OBJEXT()}",
|
|
134
|
+
"#{cfg.nativeObjectPath()}/*.sbr");
|
|
135
|
+
Rake::Task.define_task :compile => [:includes,
|
|
136
|
+
cfg.nativeObjectPath(),
|
|
137
|
+
:depends]
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
@@CompileForSuffix = {};
|
|
141
|
+
protected
|
|
142
|
+
def ToolsBase.addCompileAction(suff,action)
|
|
143
|
+
@@CompileForSuffix[suff] = action;
|
|
144
|
+
end
|
|
145
|
+
public
|
|
146
|
+
def createCompileTask(source,obj,cfg)
|
|
147
|
+
|
|
148
|
+
action = @@CompileForSuffix[File.extname(source).downcase];
|
|
149
|
+
|
|
150
|
+
unless action
|
|
151
|
+
puts("unrecognized source file type \"#{File.name(source)}\"");
|
|
152
|
+
return(nil);
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if(Rake::Task.task_defined? obj)
|
|
156
|
+
puts("Warning: task already defined for #{obj}")
|
|
157
|
+
return(nil);
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
tsk = Rake::FileTask.define_task obj
|
|
161
|
+
tsk.enhance(tsk.sources=[source], &action)
|
|
162
|
+
tsk.config = cfg;
|
|
163
|
+
tsk;
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def createCompileTasks(files,cfg)
|
|
167
|
+
|
|
168
|
+
# format object files name
|
|
169
|
+
|
|
170
|
+
mapstr = "#{cfg.nativeObjectPath()}/%n#{OBJEXT()}";
|
|
171
|
+
|
|
172
|
+
objs=FileList[];
|
|
173
|
+
files.each do |source|
|
|
174
|
+
obj = source.pathmap(mapstr);
|
|
175
|
+
task = createCompileTask(source,obj,cfg);
|
|
176
|
+
objs << obj if task; # will be the same as task.name
|
|
177
|
+
end
|
|
178
|
+
objs
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# rule based
|
|
183
|
+
# obj = f.pathmap(objstr);
|
|
184
|
+
# srcdir = File.dirname(f);
|
|
185
|
+
# objs << obj;
|
|
186
|
+
#
|
|
187
|
+
# compileCppRule(srcdir) if(@srcdirs.add?(srcdir))
|
|
188
|
+
# begin
|
|
189
|
+
# tsk = Rake::Task[obj]
|
|
190
|
+
# tsk.config = cfg;
|
|
191
|
+
# rescue => e
|
|
192
|
+
# puts "Error don't know how to build \n\t#{obj} \nfrom\t#{f}"
|
|
193
|
+
# raise e
|
|
194
|
+
# end
|
|
195
|
+
|
|
196
|
+
# def compileCppRule(srcdir) # :nodoc:
|
|
197
|
+
#
|
|
198
|
+
# srcdir ||= @projectDir;
|
|
199
|
+
#
|
|
200
|
+
# # if(verbose?)
|
|
201
|
+
# # puts("creating rule for #{srcdir} -> #{@nativeObjectPath}");
|
|
202
|
+
# # end
|
|
203
|
+
#
|
|
204
|
+
# pmapcpp = srcdir + '/%n.cpp';
|
|
205
|
+
# pmapc = srcdir + '/%n.c';
|
|
206
|
+
#
|
|
207
|
+
# # rule for object file generation
|
|
208
|
+
# regex =
|
|
209
|
+
# Regexp.new('^' + Regexp.escape(@nativeObjectPath) + '\/[^\/]+' + OBJEXT() + '\z');
|
|
210
|
+
#
|
|
211
|
+
# Rake::Task::create_rule( regex => [
|
|
212
|
+
# proc { |task_name|
|
|
213
|
+
# task_name = task_name.pathmap(pmapcpp);
|
|
214
|
+
# }
|
|
215
|
+
# ], &tools.compileCPPAction)
|
|
216
|
+
#
|
|
217
|
+
# Rake::Task::create_rule( regex => [
|
|
218
|
+
# proc { |task_name|
|
|
219
|
+
# task_name = task_name.pathmap(pmapc);
|
|
220
|
+
# }
|
|
221
|
+
# ], &tools.compileCAction)
|
|
222
|
+
#
|
|
223
|
+
# if(nil)
|
|
224
|
+
# # rule for dependency generation
|
|
225
|
+
# regexd =
|
|
226
|
+
# Regexp.new('^' + Regexp.escape(@nativeObjectPath) + '\/[^\/]+.raked\z');
|
|
227
|
+
#
|
|
228
|
+
# Rake::Task::create_rule( regexd => [
|
|
229
|
+
# proc { |task_name|
|
|
230
|
+
# task_name = task_name.pathmap(pmapcpp);
|
|
231
|
+
# }
|
|
232
|
+
# ], &tools.compileCPPDependsAction)
|
|
233
|
+
#
|
|
234
|
+
# Rake::Task::create_rule( regexd => [
|
|
235
|
+
# proc { |task_name|
|
|
236
|
+
# task_name = task_name.pathmap(pmapc);
|
|
237
|
+
# }
|
|
238
|
+
# ], &tools.compileCPPDependsAction)
|
|
239
|
+
# end
|
|
240
|
+
# end
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
#---------- PLATFORM DEFS ------------#
|
|
246
|
+
|
|
247
|
+
# SUPPORTED_HOST_TYPES := Win64 Win32 Linux32 Linux64 Macosx64
|
|
248
|
+
#
|
|
249
|
+
# BASEHOST_Win64 := Windows
|
|
250
|
+
# BASEHOST_Win32 := Windows
|
|
251
|
+
# BASEHOST_Linux64 := Linux
|
|
252
|
+
# BASEHOST_Linux32 := Linux
|
|
253
|
+
# #BASEHOST_Macosx64 := Macosx
|
|
254
|
+
# #BASEHOST_Macosx32 := Macosx
|
|
255
|
+
#
|
|
256
|
+
# #supported platforms
|
|
257
|
+
# #VALID_PLATFORMS := Win32 Win64 Linux32 Linux64 Macosx64 Macosx32
|
|
258
|
+
# VALID_PLATFORMS := Win32 Win64 Linux32 Linux64
|
|
259
|
+
#
|
|
260
|
+
# #default args here
|
|
261
|
+
# DEFAULT_CONFIG_Win32 := Win32 VC8 MDd Debug
|
|
262
|
+
# DEFAULT_CONFIG_Win64 := Win64 VC9 MDd Debug
|
|
263
|
+
# DEFAULT_CONFIG_Linux32 := Linux32 GCC3 Dynamic Debug
|
|
264
|
+
# DEFAULT_CONFIG_Linux64 := Linux64 GCC3 Dynamic Debug
|
|
265
|
+
# #DEFAULT_CONFIG_Macosx32 := Macosx32 GCC4 Dynamic Debug
|
|
266
|
+
#
|
|
267
|
+
# #define base platforms
|
|
268
|
+
# BASEPLATFORM_Win32 := Windows
|
|
269
|
+
# BASEPLATFORM_Win64 := Windows
|
|
270
|
+
# BASEPLATFORM_Linux32 := Linux
|
|
271
|
+
# BASEPLATFORM_Linux64 := Linux
|
|
272
|
+
# #BASEPLATFORM_Macosx64 := Macosx
|
|
273
|
+
# #BASEPLATFORM_Macosx32 := Macosx
|
|
274
|
+
#
|
|
275
|
+
# #platform compilers
|
|
276
|
+
# COMPILERS_Windows := VC6 VC7 VC8 VC9 VC10
|
|
277
|
+
# COMPILERS_Linux := GCC3 GCC4
|
|
278
|
+
# COMPILERS_Macosx := GCC4
|
|
279
|
+
#
|
|
280
|
+
# #base compiler type
|
|
281
|
+
# BASECOMPILER_VC6 := VC
|
|
282
|
+
# BASECOMPILER_VC7 := VC
|
|
283
|
+
# BASECOMPILER_VC8 := VC
|
|
284
|
+
# BASECOMPILER_VC9 := VC
|
|
285
|
+
# BASECOMPILER_VC10 := VC
|
|
286
|
+
# BASECOMPILER_GCC3 := GCC
|
|
287
|
+
# BASECOMPILER_GCC4 := GCC
|
|
288
|
+
#
|
|
289
|
+
# #platform linkages
|
|
290
|
+
# LINKAGES_VC := MD MDd MT MTd
|
|
291
|
+
# LINKAGES_GCC := Dynamic Static
|
|
292
|
+
#
|
|
293
|
+
# BASELINKAGE_MD := Dynamic
|
|
294
|
+
# BASELINKAGE_MDd := Dynamic
|
|
295
|
+
# BASELINKAGE_MT := Static
|
|
296
|
+
# BASELINKAGE_MTd := Static
|
|
297
|
+
# BASELINKAGE_Dynamic := Dynamic
|
|
298
|
+
# BASELINKAGE_Static := Static
|
|
299
|
+
#
|