forked from storyteller/Storyteller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ILRepack.rb
38 lines (30 loc) · 1.13 KB
/
ILRepack.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class ILRepack
def initialize(attributes)
out = attributes.fetch(:out, '')
lib = attributes.fetch(:lib, nil)
target = attributes.fetch(:target, 'library')
targetplatform = attributes.fetch(:targetplatform, "v4")
internalize = attributes.fetch(:internalize, true)
debugsymbols = attributes.fetch(:debugsymbols, false)
union = attributes.fetch(:union, false)
params = []
params << "/out:#{out}"
params << "/lib:#{lib}" unless lib.nil?
params << "/target:#{target}" unless target.nil?
params << "/targetplatform:#{targetplatform}" unless targetplatform.nil?
params << "/internalize" if internalize
params << "/ndebug" unless debugsymbols
params << "/union" if union
merge_exe = "#{File.dirname(__FILE__)}/ILMerge.exe"
@cmd = "#{merge_exe} #{params.join(' ')}"
end
def merge(params)
if Platform.is_nix
puts "Merging is *currently* not supported on Mono. Skipping merge..."
return
end
src = params.fetch(:lib, '')
refs = params.fetch(:refs, []).map {|f| File.join(src, f)}
sh Platform.runtime("#{@cmd} #{refs.join(' ')}", params[:clrversion])
end
end