rant 0.5.6 → 0.5.7
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/NEWS +12 -0
- data/README +3 -3
- data/Rantfile +7 -1
- data/doc/Untitled-1~ +7 -0
- data/doc/command.rdoc +1 -1
- data/doc/csharp.rdoc +49 -72
- data/doc/csharp.rdoc~ +37 -0
- data/doc/csharp_deprecated.rdoc +73 -0
- data/doc/homepage/index.html +5 -8
- data/doc/homepage/index.html~ +134 -0
- data/doc/sys.rdoc +14 -0
- data/lib/rant/coregen.rb~ +262 -0
- data/lib/rant/csharp/base_compiler_adapter.rb +125 -0
- data/lib/rant/csharp/base_compiler_adapter.rb~ +105 -0
- data/lib/rant/csharp/compiler_adapter_factory.rb +40 -0
- data/lib/rant/csharp/compiler_adapter_factory.rb~ +39 -0
- data/lib/rant/csharp/csc_compiler.rb +15 -0
- data/lib/rant/csharp/csc_compiler.rb~ +39 -0
- data/lib/rant/csharp/gmcs_compiler.rb +9 -0
- data/lib/rant/csharp/gmcs_compiler.rb~ +10 -0
- data/lib/rant/csharp/mcs_compiler.rb +13 -0
- data/lib/rant/csharp/mcs_compiler.rb~ +40 -0
- data/lib/rant/csharp/msc_compiler.rb~ +39 -0
- data/lib/rant/import/csharp.rb +48 -0
- data/lib/rant/import/csharp.rb~ +58 -0
- data/lib/rant/import/nunittest.rb +32 -0
- data/lib/rant/import/resgen.rb +21 -0
- data/lib/rant/import/resgen.rb~ +20 -0
- data/lib/rant/init.rb +1 -1
- data/lib/rant/rantlib.rb +1 -0
- data/lib/rant/rantlib.rb~ +1376 -0
- data/lib/rant/rantsys.rb +6 -0
- data/run_import +1 -1
- data/run_rant +1 -1
- data/test/import/package/test_package.rb~ +628 -0
- data/test/rule.rf +4 -0
- data/test/test_filetask.rb~ +97 -0
- data/test/test_rule.rb +10 -0
- data/test/test_sys_methods.rb +22 -0
- data/test/units/csharp/test_base_compiler_adapter.rb +107 -0
- data/test/units/csharp/test_base_compiler_adapter.rb~ +73 -0
- data/test/units/csharp/test_compiler_adapter_factory.rb +66 -0
- data/test/units/csharp/test_compiler_adapter_factory.rb~ +66 -0
- data/test/units/csharp/test_csc_compiler.rb +23 -0
- data/test/units/csharp/test_csc_compiler.rb~ +23 -0
- data/test/units/csharp/test_gmsc_compiler.rb +19 -0
- data/test/units/csharp/test_gmsc_compiler.rb~ +19 -0
- data/test/units/csharp/test_msc_compiler.rb +23 -0
- data/test/units/csharp/test_msc_compiler.rb~ +23 -0
- data/test/units/csharp_test_helper.rb +6 -0
- data/test/units/import/test_csharp.rb +127 -0
- data/test/units/import/test_csharp.rb~ +126 -0
- data/test/units/import/test_nunittest.rb +122 -0
- data/test/units/import/test_resgen.rb +107 -0
- data/test/units/import/test_resgen.rb~ +88 -0
- metadata +269 -224
data/doc/sys.rdoc
CHANGED
@@ -607,6 +607,20 @@ standard output:
|
|
607
607
|
sys.root_dir?("C:/") # true
|
608
608
|
sys.root_dir?("bin") # false
|
609
609
|
|
610
|
+
* <b>absolute_path?(path)</b>
|
611
|
+
|
612
|
+
Returns true if the given path is an absolute path, false otherwise.
|
613
|
+
|
614
|
+
Examples:
|
615
|
+
|
616
|
+
# on all systems:
|
617
|
+
sys.absolute_path?("/home/me/main.c") # true
|
618
|
+
sys.absolute_path?("main.c") # false
|
619
|
+
|
620
|
+
# on windows:
|
621
|
+
sys.absolute_path?("C:\\Programs") # true
|
622
|
+
sys.absolute_path?("C:/Programs") # true
|
623
|
+
|
610
624
|
== See also
|
611
625
|
|
612
626
|
Rantfile basics::
|
@@ -0,0 +1,262 @@
|
|
1
|
+
|
2
|
+
# coregen.rb - Generators available in all Rantfiles.
|
3
|
+
#
|
4
|
+
# Copyright (C) 2005 Stefan Lang <langstefan@gmx.at>
|
5
|
+
|
6
|
+
module Rant
|
7
|
+
module Generators
|
8
|
+
class Task
|
9
|
+
def self.rant_gen(rac, ch, args, &block)
|
10
|
+
unless args.size == 1
|
11
|
+
rac.abort("Task takes only one argument " +
|
12
|
+
"which has to be like one given to the " +
|
13
|
+
"`task' function")
|
14
|
+
end
|
15
|
+
rac.prepare_task(args.first, nil, ch) { |name,pre,blk|
|
16
|
+
rac.node_factory.new_custom(rac, name, pre, block)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
class Directory
|
21
|
+
# Generate a task for making a directory path.
|
22
|
+
# Prerequisites can be given, which will be added as
|
23
|
+
# prerequistes for the _last_ directory.
|
24
|
+
#
|
25
|
+
# A special feature is used if you provide a block: The
|
26
|
+
# block will be called after complete directory creation.
|
27
|
+
# After the block execution, the modification time of the
|
28
|
+
# directory will be updated.
|
29
|
+
def self.rant_gen(rac, ch, args, &block)
|
30
|
+
case args.size
|
31
|
+
when 1
|
32
|
+
name, pre = rac.normalize_task_arg(args.first, ch)
|
33
|
+
self.task(rac, ch, name, pre, &block)
|
34
|
+
when 2
|
35
|
+
basedir = args.shift
|
36
|
+
if basedir.respond_to? :to_str
|
37
|
+
basedir = basedir.to_str
|
38
|
+
else
|
39
|
+
rac.abort_at(ch,
|
40
|
+
"Directory: basedir argument has to be a string.")
|
41
|
+
end
|
42
|
+
name, pre = rac.normalize_task_arg(args.first, ch)
|
43
|
+
self.task(rac, ch, name, pre, basedir, &block)
|
44
|
+
else
|
45
|
+
rac.abort_at(ch, "Directory takes one argument, " +
|
46
|
+
"which should be like one given to the `task' command.")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the task which creates the last directory
|
51
|
+
# element (and has all other necessary directories as
|
52
|
+
# prerequisites).
|
53
|
+
def self.task(rac, ch, name, prerequisites=[], basedir=nil, &block)
|
54
|
+
dirs = ::Rant::Sys.split_all(name)
|
55
|
+
if dirs.empty?
|
56
|
+
rac.abort_at(ch,
|
57
|
+
"Not a valid directory name: `#{name}'")
|
58
|
+
end
|
59
|
+
path = basedir
|
60
|
+
last_task = nil
|
61
|
+
task_block = nil
|
62
|
+
desc_for_last = rac.pop_desc
|
63
|
+
dirs.each { |dir|
|
64
|
+
pre = [path]
|
65
|
+
pre.compact!
|
66
|
+
if dir.equal?(dirs.last)
|
67
|
+
rac.cx.desc desc_for_last
|
68
|
+
|
69
|
+
# add prerequisites to pre
|
70
|
+
# if prerequisites is a FileList: there is
|
71
|
+
# only one save (no later removal) way to add
|
72
|
+
# an entry: with <<
|
73
|
+
dp = prerequisites.dup
|
74
|
+
pre.each { |elem| dp << elem }
|
75
|
+
pre = dp
|
76
|
+
|
77
|
+
task_block = block
|
78
|
+
end
|
79
|
+
path = path.nil? ? dir : File.join(path, dir)
|
80
|
+
last_task = rac.prepare_task({:__caller__ => ch,
|
81
|
+
path => pre}, task_block) { |name,pre,blk|
|
82
|
+
rac.node_factory.new_dir(rac, name, pre, blk)
|
83
|
+
}
|
84
|
+
}
|
85
|
+
last_task
|
86
|
+
end
|
87
|
+
end # class Directory
|
88
|
+
class SourceNode
|
89
|
+
def self.rant_gen(rac, ch, args)
|
90
|
+
unless args.size == 1
|
91
|
+
rac.abort_at(ch, "SourceNode takes one argument.")
|
92
|
+
end
|
93
|
+
if block_given?
|
94
|
+
rac.abort_at(ch, "SourceNode doesn't take a block.")
|
95
|
+
end
|
96
|
+
rac.prepare_task(args.first, nil, ch) { |name, pre, blk|
|
97
|
+
rac.node_factory.new_source(rac, name, pre, blk)
|
98
|
+
}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
class Rule
|
102
|
+
# Generate a rule by installing an at_resolve hook for
|
103
|
+
# +rac+.
|
104
|
+
def self.rant_gen(rac, ch, args, &block)
|
105
|
+
unless args.size == 1
|
106
|
+
rac.abort_at(ch, "Rule takes only one argument.")
|
107
|
+
end
|
108
|
+
rac.abort_at(ch, "Rule: block required.") unless block
|
109
|
+
arg = args.first
|
110
|
+
target = nil
|
111
|
+
src_arg = nil
|
112
|
+
if Symbol === arg
|
113
|
+
target = ".#{arg}"
|
114
|
+
elsif arg.respond_to? :to_str
|
115
|
+
target = arg.to_str
|
116
|
+
elsif Regexp === arg
|
117
|
+
target = arg
|
118
|
+
elsif Hash === arg && arg.size == 1
|
119
|
+
arg.each_pair { |target, src_arg| }
|
120
|
+
src_arg = src_arg.to_str if src_arg.respond_to? :to_str
|
121
|
+
target = target.to_str if target.respond_to? :to_str
|
122
|
+
src_arg = ".#{src_arg}" if Symbol === src_arg
|
123
|
+
target = ".#{target}" if Symbol === target
|
124
|
+
else
|
125
|
+
rac.abort_at(ch, "Rule argument " +
|
126
|
+
"has to be a hash with one key-value pair.")
|
127
|
+
end
|
128
|
+
esc_target = nil
|
129
|
+
target_rx = case target
|
130
|
+
when String
|
131
|
+
esc_target = Regexp.escape(target)
|
132
|
+
/#{esc_target}$/
|
133
|
+
when Regexp
|
134
|
+
target
|
135
|
+
else
|
136
|
+
rac.abort_at(ch, "rule target has " +
|
137
|
+
"to be a string or regular expression")
|
138
|
+
end
|
139
|
+
src_proc = case src_arg
|
140
|
+
when String, Array
|
141
|
+
unless String === target
|
142
|
+
rac.abort(ch, "rule target has to be " +
|
143
|
+
"a string if source is a string")
|
144
|
+
end
|
145
|
+
if src_arg.kind_of? String
|
146
|
+
lambda { |name|
|
147
|
+
name.sub(/#{esc_target}$/, src_arg)
|
148
|
+
}
|
149
|
+
else
|
150
|
+
lambda { |name|
|
151
|
+
src_arg.collect { |s_src|
|
152
|
+
s_src = ".#{s_src}" if Symbol === s_src
|
153
|
+
name.sub(/#{esc_target}$/, s_src)
|
154
|
+
}
|
155
|
+
}
|
156
|
+
end
|
157
|
+
when Proc: src_arg
|
158
|
+
when nil: lambda { |name| [] }
|
159
|
+
else
|
160
|
+
rac.abort_at(ch, "rule source has to be a " +
|
161
|
+
"String, Array or Proc")
|
162
|
+
end
|
163
|
+
rac.resolve_hooks <<
|
164
|
+
(block.arity == 2 ? Hook : FileHook).new(
|
165
|
+
rac, ch, target_rx, src_proc, block)
|
166
|
+
nil
|
167
|
+
end
|
168
|
+
class Hook
|
169
|
+
attr_accessor :target_rx
|
170
|
+
def initialize(rant, ch, target_rx, src_proc, block)
|
171
|
+
@rant = rant
|
172
|
+
@ch = ch
|
173
|
+
@target_rx = target_rx
|
174
|
+
@src_proc = src_proc
|
175
|
+
@block = block
|
176
|
+
end
|
177
|
+
def call(target, rel_project_dir)
|
178
|
+
if @target_rx =~ target
|
179
|
+
have_src = true
|
180
|
+
src = @src_proc[target]
|
181
|
+
if src.respond_to? :to_ary
|
182
|
+
have_src = src.to_ary.all? { |s|
|
183
|
+
have_src?(rel_project_dir, s)
|
184
|
+
}
|
185
|
+
else
|
186
|
+
have_src = have_src?(rel_project_dir, src)
|
187
|
+
end
|
188
|
+
if have_src
|
189
|
+
create_nodes(rel_project_dir, target, src)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
alias [] call
|
194
|
+
private
|
195
|
+
def have_src?(rel_project_dir, name)
|
196
|
+
return true unless
|
197
|
+
@rant.rec_save_resolve(name, self, rel_project_dir).empty?
|
198
|
+
test(?e, @rant.abs_path(rel_project_dir, name))
|
199
|
+
end
|
200
|
+
def create_nodes(rel_project_dir, target, deps)
|
201
|
+
@rant.goto_project_dir rel_project_dir
|
202
|
+
case nodes = @block[target, deps]
|
203
|
+
when Array: nodes
|
204
|
+
when Node: [nodes]
|
205
|
+
else
|
206
|
+
@rant.abort_at(@ch, "Block has to " +
|
207
|
+
"return Node or array of Nodes.")
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
class FileHook < Hook
|
212
|
+
private
|
213
|
+
def have_src?(rel_project_dir, name)
|
214
|
+
test(?e, @rant.abs_path(rel_project_dir, name)) or
|
215
|
+
@rant.rec_save_resolve(name, self, rel_project_dir
|
216
|
+
).any? { |t| t.file_target? }
|
217
|
+
end
|
218
|
+
def create_nodes(rel_project_dir, target, deps)
|
219
|
+
@rant.goto_project_dir rel_project_dir
|
220
|
+
t = @rant.file(:__caller__ => @ch,
|
221
|
+
target => deps, &@block)
|
222
|
+
[t]
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end # class Rule
|
226
|
+
class Action
|
227
|
+
def self.rant_gen(rac, ch, args, &block)
|
228
|
+
case args.size
|
229
|
+
when 0:
|
230
|
+
unless (rac[:tasks] || rac[:stop_after_load])
|
231
|
+
yield
|
232
|
+
end
|
233
|
+
when 1:
|
234
|
+
rx = args.first
|
235
|
+
unless rx.kind_of? Regexp
|
236
|
+
rac.abort_at(ch, "Action: argument has " +
|
237
|
+
"to be a regular expression.")
|
238
|
+
end
|
239
|
+
rac.resolve_hooks << self.new(rac, block, rx)
|
240
|
+
nil
|
241
|
+
else
|
242
|
+
rac.abort_at(ch, "Action: too many arguments.")
|
243
|
+
end
|
244
|
+
end
|
245
|
+
def initialize(rant, block, rx)
|
246
|
+
@rant = rant
|
247
|
+
@subdir = @rant.current_subdir
|
248
|
+
@block = block
|
249
|
+
@rx = rx
|
250
|
+
end
|
251
|
+
def call(target, rel_project_dir)
|
252
|
+
if target =~ @rx
|
253
|
+
@rant.resolve_hooks.delete(self)
|
254
|
+
@rant.goto_project_dir @subdir
|
255
|
+
@block.call
|
256
|
+
@rant.resolve(target, rel_project_dir)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
alias [] call
|
260
|
+
end
|
261
|
+
end # module Generators
|
262
|
+
end # module Rant
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# Helper method to add a to_cs_arg method to a class (yay meta!)
|
2
|
+
def add_to_cs_arg_method klass, &block
|
3
|
+
klass.instance_eval { define_method :to_cs_arg, &block }
|
4
|
+
end
|
5
|
+
|
6
|
+
def add_to_cmd_array klass, &block
|
7
|
+
klass.instance_eval { define_method :to_cmd_array, &block}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Methods to convert types into arguments for the compiler
|
11
|
+
add_to_cs_arg_method(Object) do |key, compiler|
|
12
|
+
compiler.string_argument(key, self.to_s)
|
13
|
+
end
|
14
|
+
|
15
|
+
add_to_cs_arg_method(TrueClass) do |key, compiler|
|
16
|
+
compiler.boolean_argument(key, true)
|
17
|
+
end
|
18
|
+
|
19
|
+
add_to_cs_arg_method(FalseClass) do |key, compiler|
|
20
|
+
compiler.boolean_argument(key, false)
|
21
|
+
end
|
22
|
+
|
23
|
+
add_to_cs_arg_method(Array) do |key, compiler|
|
24
|
+
self.collect {|x| x.to_cs_arg(key, compiler) }
|
25
|
+
end
|
26
|
+
|
27
|
+
add_to_cmd_array(Object) do |context|
|
28
|
+
[context.sys.sp(self.to_s)]
|
29
|
+
end
|
30
|
+
|
31
|
+
add_to_cmd_array(Array) do |context|
|
32
|
+
self.collect {|x| context.sys.sp(x) }
|
33
|
+
end
|
34
|
+
|
35
|
+
add_to_cmd_array(Rant::FileList) do |context|
|
36
|
+
[self.arglist]
|
37
|
+
end
|
38
|
+
|
39
|
+
module Rant::CSharp
|
40
|
+
class BaseCompilerAdapter
|
41
|
+
attr_accessor :bin
|
42
|
+
attr_accessor :switch_map
|
43
|
+
|
44
|
+
def initialize bin = ""
|
45
|
+
@bin = bin
|
46
|
+
@switch_map = {}
|
47
|
+
raise Exception.new("Must specify an executable") if !@bin ||
|
48
|
+
@bin.length == 0
|
49
|
+
end
|
50
|
+
|
51
|
+
def cmd target, cs_args, context
|
52
|
+
@context = context
|
53
|
+
|
54
|
+
if !target || target.length == 0
|
55
|
+
raise Exception.new("Target must be specified and have a length " +
|
56
|
+
"greater than 0")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Generic argument processing
|
60
|
+
args = []
|
61
|
+
sources = cs_args.delete(:sources)
|
62
|
+
cs_args[:target] ||= guess_target(target)
|
63
|
+
|
64
|
+
cs_args.each_key do |key|
|
65
|
+
args.push(cs_args[key].to_cs_arg(key, self))
|
66
|
+
end
|
67
|
+
|
68
|
+
src_list = sources.to_cmd_array(context)
|
69
|
+
|
70
|
+
([bin, outfile(target)] + args.flatten + src_list).join(' ')
|
71
|
+
end
|
72
|
+
|
73
|
+
# Map rant arguments to compiler arguments
|
74
|
+
def map_arg arg
|
75
|
+
switch_map[arg] ? switch_map[arg] : arg
|
76
|
+
end
|
77
|
+
|
78
|
+
def outfile target
|
79
|
+
string_argument "out", target
|
80
|
+
end
|
81
|
+
|
82
|
+
def boolean_argument arg, on
|
83
|
+
switch = map_arg(arg)
|
84
|
+
ret = "#{self.argument_prefix}#{switch}"
|
85
|
+
ret += on ? "" : "-"
|
86
|
+
end
|
87
|
+
|
88
|
+
def string_argument arg, value
|
89
|
+
switch = map_arg(arg)
|
90
|
+
# Assume all string arguments except target are
|
91
|
+
# files
|
92
|
+
value = @context.sys.sp(value) if arg != :target
|
93
|
+
|
94
|
+
"#{self.argument_prefix}#{switch}:#{value}"
|
95
|
+
end
|
96
|
+
|
97
|
+
def argument_prefix
|
98
|
+
""
|
99
|
+
end
|
100
|
+
|
101
|
+
# Try to automatically guess the type of output file
|
102
|
+
# based on the extension
|
103
|
+
def guess_target outfile
|
104
|
+
target = "library"
|
105
|
+
|
106
|
+
ext = outfile.match(/\.([^\.]+)$/)
|
107
|
+
ext = ext[1] if ext
|
108
|
+
|
109
|
+
if ext
|
110
|
+
case ext.downcase
|
111
|
+
when "netmodule"
|
112
|
+
target = map_target("module")
|
113
|
+
when "exe"
|
114
|
+
target = map_target("winexe")
|
115
|
+
end
|
116
|
+
end
|
117
|
+
target
|
118
|
+
end
|
119
|
+
|
120
|
+
# Allows subclasses to override default target names
|
121
|
+
def map_target target
|
122
|
+
target
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# Helper method to add a to_cs_arg method to a class (yay meta!)
|
2
|
+
def add_to_cs_arg_method klass, &block
|
3
|
+
klass.instance_eval { define_method :to_cs_arg, &block }
|
4
|
+
end
|
5
|
+
|
6
|
+
def add_to_cmd_array klass, &block
|
7
|
+
klass.instance_eval { define_method :to_cmd_array, &block}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Methods to convert types into arguments for the compiler
|
11
|
+
add_to_cs_arg_method(Object) {|key, compiler| compiler.string_argument(key, self.to_s) }
|
12
|
+
add_to_cs_arg_method(TrueClass) {|key, compiler| compiler.boolean_argument(key, true) }
|
13
|
+
add_to_cs_arg_method(FalseClass) {|key, compiler| compiler.boolean_argument(key, false) }
|
14
|
+
add_to_cs_arg_method(Array) {|key, compiler| self.collect {|x| x.to_cs_arg(key, compiler) } }
|
15
|
+
|
16
|
+
add_to_cmd_array(Object) { |context| [context.sys.sp(self.to_s)] }
|
17
|
+
add_to_cmd_array(Array) { |context| self.collect {|x| context.sys.sp(x) }}
|
18
|
+
add_to_cmd_array(Rant::FileList) { |context| [self.arglist] }
|
19
|
+
|
20
|
+
module Rant::CSharp
|
21
|
+
class BaseCompilerAdapter
|
22
|
+
attr_accessor :bin
|
23
|
+
attr_accessor :switch_map
|
24
|
+
|
25
|
+
def initialize bin = ""
|
26
|
+
@bin = bin
|
27
|
+
@switch_map = {}
|
28
|
+
raise Exception.new("Must specify an executable") if !@bin || @bin.length == 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def cmd target, cs_args, context
|
32
|
+
@context = context
|
33
|
+
|
34
|
+
if !target || target.length == 0
|
35
|
+
raise Exception.new("Target must be specified and have a length " +
|
36
|
+
"greater than 0")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Generic argument processing
|
40
|
+
args = []
|
41
|
+
sources = cs_args.delete(:sources)
|
42
|
+
cs_args[:target] ||= guess_target(target)
|
43
|
+
|
44
|
+
cs_args.each_key do |key|
|
45
|
+
args.push(cs_args[key].to_cs_arg(key, self))
|
46
|
+
end
|
47
|
+
|
48
|
+
src_list = sources.to_cmd_array(context)
|
49
|
+
|
50
|
+
([bin, outfile(target)] + args.flatten + src_list).join(' ')
|
51
|
+
end
|
52
|
+
|
53
|
+
# Map rant arguments to compiler arguments
|
54
|
+
def map_arg arg
|
55
|
+
switch_map[arg] ? switch_map[arg] : arg
|
56
|
+
end
|
57
|
+
|
58
|
+
def outfile target
|
59
|
+
string_argument "out", target
|
60
|
+
end
|
61
|
+
|
62
|
+
def boolean_argument arg, on
|
63
|
+
switch = map_arg(arg)
|
64
|
+
ret = "#{self.argument_prefix}#{switch}"
|
65
|
+
ret += on ? "" : "-"
|
66
|
+
end
|
67
|
+
|
68
|
+
def string_argument arg, value
|
69
|
+
switch = map_arg(arg)
|
70
|
+
# Assume all string arguments except target are
|
71
|
+
# files
|
72
|
+
value = @context.sys.sp(value) if arg != :target
|
73
|
+
|
74
|
+
"#{self.argument_prefix}#{switch}:#{value}"
|
75
|
+
end
|
76
|
+
|
77
|
+
def argument_prefix
|
78
|
+
""
|
79
|
+
end
|
80
|
+
|
81
|
+
# Try to automatically guess the type of output file
|
82
|
+
# based on the extension
|
83
|
+
def guess_target outfile
|
84
|
+
target = "library"
|
85
|
+
|
86
|
+
ext = outfile.match(/\.([^\.]+)$/)
|
87
|
+
ext = ext[1] if ext
|
88
|
+
|
89
|
+
if ext
|
90
|
+
case ext.downcase
|
91
|
+
when "netmodule"
|
92
|
+
target = map_target("module")
|
93
|
+
when "exe"
|
94
|
+
target = map_target("winexe")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
target
|
98
|
+
end
|
99
|
+
|
100
|
+
# Allows subclasses to override default target names
|
101
|
+
def map_target target
|
102
|
+
target
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|