Class: RakeDotNet::MsBuildTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- RakeDotNet::MsBuildTask
- Defined in:
- lib/rake_dotnet.rb
Instance Attribute Summary collapse
-
#src_dir ⇒ Object
Returns the value of attribute src_dir.
-
#verbosity ⇒ Object
Returns the value of attribute verbosity.
-
#working_dir ⇒ Object
Returns the value of attribute working_dir.
Instance Method Summary collapse
- #define ⇒ Object
- #figure_out_project_type(project_pathname) ⇒ Object
-
#initialize(params = {}) {|_self| ... } ⇒ MsBuildTask
constructor
A new instance of MsBuildTask.
- #src_dir_regex ⇒ Object
Constructor Details
#initialize(params = {}) {|_self| ... } ⇒ MsBuildTask
Returns a new instance of MsBuildTask.
662 663 664 665 666 667 668 669 670 671 672 673 674 |
# File 'lib/rake_dotnet.rb', line 662 def initialize(params={}) #TODO: Support for arbitrary properties, not just configuration. For example, TreatWarningsAsErrors, WarningLevel. @configuration = params[:configuration] || CONFIGURATION @src_dir = params[:src_dir] || SRC_DIR @verbosity = params[:verbosity] || MSBUILD_VERBOSITY || 'm' @working_dir = params[:working_dir] || '.' @deps = params[:deps] || [Bin_out] @buildable_projects = ['.csproj', '.vbproj', '.wixproj'] @properties = {:Configuration => @configuration, :TreatWarningsAsErrors => true, :WarningLevel => 4, :BuildInParallel => true}.merge(params[:properties] || {}) yield self if block_given? define end |
Instance Attribute Details
#src_dir ⇒ Object
Returns the value of attribute src_dir.
660 661 662 |
# File 'lib/rake_dotnet.rb', line 660 def src_dir @src_dir end |
#verbosity ⇒ Object
Returns the value of attribute verbosity.
660 661 662 |
# File 'lib/rake_dotnet.rb', line 660 def verbosity @verbosity end |
#working_dir ⇒ Object
Returns the value of attribute working_dir.
660 661 662 |
# File 'lib/rake_dotnet.rb', line 660 def working_dir @working_dir end |
Instance Method Details
#define ⇒ Object
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
# File 'lib/rake_dotnet.rb', line 676 def define # most project types put output into bin/{configuration} rule(/#{src_dir_regex}\/[\w\.]+\/bin\/#{@configuration}\/[\w\.]+\.(?:dll|exe)/) do |r| pn = Pathname.new(r.name) name = pn.basename.to_s.sub('.dll', '') project = FileList.new("#{@src_dir}/#{name}/#{name}.*proj").first mb = MsBuildCmd.new(project, @properties, ['Build'], verbosity, @working_dir) mb.run end # web application projects put output into /bin rule(/#{src_dir_regex}\/[\w\.]+\/bin\/[\w\.]+\.dll/) do |r| pn = Pathname.new(r.name) name = pn.basename.to_s.sub('.dll', '') project = FileList.new("#{@src_dir}/#{name}/#{name}.*proj").first mb = MsBuildCmd.new(project, @properties, ['Build'], verbosity, @working_dir) mb.run end desc "Compile the specified projects (give relative paths) (otherwise, all matching src/**/*.*proj)" task :compile, [:projects] do |t, args| project_list = FileList.new("#{src_dir}/**/*.*proj") args.with_defaults(:projects => project_list) args.projects.each do |p| pn = Pathname.new(p) # TODO: Figure out which type of project we are so we can invoke the correct rule, with the correct output extension dll = File.join(pn.dirname, 'bin', @configuration, pn.basename.sub(pn.extname, '.dll')) Rake::FileTask[dll].invoke if @buildable_projects.include?(pn.extname) end end @deps.each do |d| task :compile => d end self end |
#figure_out_project_type(project_pathname) ⇒ Object
718 719 720 |
# File 'lib/rake_dotnet.rb', line 718 def figure_out_project_type(project_pathname) # TODO. end |
#src_dir_regex ⇒ Object
714 715 716 |
# File 'lib/rake_dotnet.rb', line 714 def src_dir_regex RakeDotNet::regexify(@src_dir) end |