Class: Bozo::Compilers::Project
- Inherits:
-
Object
- Object
- Bozo::Compilers::Project
show all
- Includes:
- Runner
- Defined in:
- lib/bozo/compilers/msbuild.rb
Instance Method Summary
collapse
Constructor Details
#initialize(project_file, project_name) ⇒ Project
Returns a new instance of Project.
143
144
145
146
|
# File 'lib/bozo/compilers/msbuild.rb', line 143
def initialize(project_file, project_name)
@project_file = project_file
@project_name = project_name
end
|
Instance Method Details
#build(configuration) ⇒ Object
152
153
154
155
156
|
# File 'lib/bozo/compilers/msbuild.rb', line 152
def build(configuration)
populate_config(configuration)
args = generate_args configuration
execute_command :msbuild, args
end
|
#clean(configuration) ⇒ Object
158
159
160
161
162
163
164
165
|
# File 'lib/bozo/compilers/msbuild.rb', line 158
def clean(configuration)
configuration.delete(:max_cores)
configuration[:targets] = [:clean]
args = generate_args configuration
execute_command :msbuild, args
remove_obj_directory
end
|
#framework_version ⇒ Object
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/bozo/compilers/msbuild.rb', line 167
def framework_version
framework_version = 'unknown'
File.open(@project_file) do |f|
framework_version = Nokogiri::XML(f).css('Project PropertyGroup TargetFrameworkVersion').first.content
framework_version = framework_version.sub('v', 'net').sub('.', '')
end
framework_version
end
|
#generate_args(config) ⇒ Object
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/bozo/compilers/msbuild.rb', line 178
def generate_args(config)
args = []
args << File.join(ENV['WINDIR'], 'Microsoft.NET', config[:framework], config[:version], 'msbuild.exe')
args << '/nologo'
args << '/verbosity:normal'
args << '/nodeReuse:false'
args << "/target:#{config[:targets].map{|t| t.to_s}.join(';')}"
args << "/p:StyleCopEnabled=false" if config[:without_stylecop]
args << "/maxcpucount" if config[:max_cores].nil? args << "/maxcpucount:#{config[:max_cores]}" unless config[:max_cores].nil?
config[:properties].each do |key, value|
args << "/property:#{key}=\"#{value}\""
end
args << "\"#{@project_file}\""
end
|
#location ⇒ Object
205
206
207
|
# File 'lib/bozo/compilers/msbuild.rb', line 205
def location
File.expand_path(File.join(temp_project_path, framework_version))
end
|
#name ⇒ Object
148
149
150
|
# File 'lib/bozo/compilers/msbuild.rb', line 148
def name
@project_name
end
|
#project_path ⇒ Object
209
210
211
|
# File 'lib/bozo/compilers/msbuild.rb', line 209
def project_path
File.dirname(@project_file)
end
|
#temp_project_path ⇒ Object
201
202
203
|
# File 'lib/bozo/compilers/msbuild.rb', line 201
def temp_project_path
File.expand_path(File.join('temp', 'msbuild', @project_name))
end
|
#windowsize_path(path) ⇒ Object
197
198
199
|
# File 'lib/bozo/compilers/msbuild.rb', line 197
def windowsize_path(path)
path.gsub(/\//, '\\')
end
|