Permalink
Browse files

+ albacore aspnetcompiler task

  • Loading branch information...
1 parent 81ad461 commit 7093af674045654d2fa3d35f255ae6edce0d5a72 @prabirshrestha committed Oct 22, 2010
Showing with 90 additions and 4 deletions.
  1. +56 −0 libs/albacore/albacore/aspnetcompiler.rb
  2. +29 −0 libs/albacore/albacore/config/aspnetcompilerconfig.rb
  3. +5 −4 rakefile.rb
@@ -0,0 +1,56 @@
+require 'albacore/albacoretask'
+require 'albacore/config/aspnetcompilerconfig'
+require 'albacore/support/supportlinux'
+
+class AspNetCompiler
+ include AlbacoreTask
+ include RunCommand
+ include Configuration::AspNetCompiler
+ include SupportsLinuxEnvironment
+
+ attr_accessor :clean, # Optional Boolean parameter. If this parameter is true, the precompiled application will be built clean. Any previously compiled components will be recompiled. The default value is false. This parameter corresponds to the -c switch on aspnet_compiler.exe.
+ #:allow_partially_trusted_callers, # Optional Boolean parameter. If this parameter is true, the strong-name assembly will allow partially trusted callers.
+ :debug, # Optional Boolean parameter. If this parameter is true, debug information (.PDB file) is emitted during compilation. The default value is false. This parameter corresponds to the -d switch on aspnet_compiler.exe.
+ :delay_sign, # Optional Boolean parameter. If this parameter is true, the assembly is not fully signed when created.
+ :fixed_names, # Optional Boolean parameter. If this parameter is true, the compiled assemblies will be given fixed names.
+ :force, # Optional Boolean parameter. If this parameter is true, the task will overwrite the target directory if it already exists. Existing contents are lost. The default value is false. This parameter corresponds to the -f switch on aspnet_compiler.exe.
+ #:key_container, # Optional String parameter. Specifies a strong name key container.
+ #:key_file, # Optional String parameter. Specifies the physical path to the strong name key file..
+ #:metabase_path, # Optional String parameter. Specifies the full IIS metabase path of the application. This parameter cannot be combined with the VirtualPath or PhysicalPath parameters. This parameter corresponds to the -m switch on aspnet_compiler.exe.
+ :physical_path, # Optional String parameter. Specifies the physical path of the application to be compiled. If this parameter is missing, the IIS metabase is used to locate the application. This parameter corresponds to the -p switch on aspnet_compiler.exe.
+ #:target_framework_moniker, # Optional String parameter. Specifies the TargetFrameworkMoniker indicating which .NET Framework version of aspnet_compiler.exe should be used. Only accepts .NET Framework monikers.
+ :target_path, # Optional String parameter. Specifies the physical path to which the application is compiled. If not specified, the application is precompiled in-place.
+ :updateable, # Optional Boolean parameter. If this parameter is true, the precompiled application will be updateable. The default value is false. This parameter corresponds to the -u switch on aspnet_compiler.exe.
+ :virtual_path # Optional String parameter. The virtual path of the application to be compiled. If PhysicalPath specified, the physical path is used to locate the application. Otherwise, the IIS metabase is used, and the application is assumed to be in the default site. This parameter corresponds to the -v switch on aspnet_compiler.exe.
+
+ def initialize
+ @clean = false
+ @debug = false
+ @delay_sign = false
+ @fixed_names = false
+ @force = false
+ @updateable = false
+ @virtual_path = '/'
+ super()
+ update_attributes aspnetcompiler.to_hash
+ end
+
+ def execute
+ params = []
+ params << "-v #{@virtual_path}" unless @virtual_path.nil?
+ params << "-p #{format_path(@physical_path)}" unless @physical_path.nil?
+ params << "-c" if @clean
+ params << "-delaysign" if @delay_sign
+ params << "-fixednames" if @fixed_names
+ params << "-d" if @debug
+ params << "-u" if @updateable
+ params << "-f" if @force
+ params << format_path(@target_path) unless @target_path.nil?
+
+ result = run_command "AspNetCompiler", params
+
+ failure_message = 'AspNetCompiler Failed. See Build Log For Detail'
+ fail_with_message failure_message if !result
+ end
+
+end
@@ -0,0 +1,29 @@
+require 'ostruct'
+require 'albacore/config/netversion'
+require 'albacore/support/openstruct'
+
+module Configuration
+ module AspNetCompiler
+ include Configuration::NetVersion
+ include Albacore::Configuration
+
+ def self.aspnetcompilerconfig
+ @config ||= OpenStruct.new.extend(OpenStructToHash).extend(AspNetCompiler)
+ end
+
+ def aspnetcompiler
+ @config ||= AspNetCompiler.aspnetcompilerconfig
+ yield(@config) if block_given?
+ @config
+ end
+
+ def self.included(mod)
+ self.aspnetcompilerconfig.use :net40
+ end
+
+ def use(netversion)
+ netversion = :net20 if netversion == :net35 # since .net 3.5 doesn't have aspnet_compiler use .net 2.0
+ self.command = File.join(get_net_version(netversion), "aspnet_compiler.exe")
+ end
+ end
+end
View
@@ -114,10 +114,11 @@ def get_version_from_file
xunit.options '/nunit ' + TEST_OUTPUT_PATH + 'FacebookSharp.Tests.nUnit.xml', '/xml ' + TEST_OUTPUT_PATH + 'FacebookSharp.Tests.xUnit.xml'
end
-exec :precompile_samples_webapplication_task do |exec|
- include Configuration::NetVersion
- exec.command = dotnet_path + '/aspnet_compiler.exe'
- exec.parameters = ['-f','-u','-p','src/Samples/FacebookSharp.Samples.WebApplication','-v','/','bin/Samples/FacebookSharp.Samples.WebApplication']
+aspnetcompiler :precompile_samples_webapplication_task => [:build_release] do |c|
+ c.physical_path = "src/Samples/FacebookSharp.Samples.WebApplication"
+ c.target_path = "bin/Samples/FacebookSharp.Samples.WebApplication"
+ c.updateable = true
+ c.force = true
end
task :precompile_samples_webapplication => [:build_release,:precompile_samples_webapplication_task] do

0 comments on commit 7093af6

Please sign in to comment.