-
Notifications
You must be signed in to change notification settings - Fork 64
asmver and asmver_files
haf edited this page Jan 2, 2015
·
7 revisions
Generate a single file with assembly attributes. Code comments in example below mention output in F#.
asmver :asmver do |a|
a.file_path = 'src/Version.fs' # required, no default
a.namespace = 'Hello.World' # required for F#, defaults to empty string '' for C#
# optional
a.attributes assembly_title: 'Hello.World', # generates: [<AssemblyTitle("Hello.World")>]
assembly_version: '0.1.2', # generates: [<AssemblyVersion("0.1.2")>]
my_product_attr: 'Hello world', # generates: [<MyProductAttr("Hello World")>]
a.out = StringIO.new # optional, don't use it this way: takes an IO/Stream
a.using 'System' # optional, can be called multiple times to add more using-directives
end
desc 'create assembly infos'
asmver_files :assembly_info do |a|
a.files = FileList['**/*proj'] # optional, will find all projects recursively by default
# attributes are required:
a.attributes assembly_description: "My wonderful lib",
assembly_configuration: 'RELEASE',
assembly_company: 'Wonders Inc.',
assembly_copyright: "(c) #{Time.now.year} by John Doe",
assembly_version: ENV['LONG_VERSION'],
assembly_file_version: ENV['LONG_VERSION'],
assembly_informational_version: ENV['BUILD_VERSION']
# optional, given an Albacore::Project and the configuration hash of the AsmVer task type
# example:
a.handle_config do |proj, conf|
conf.namespace = conf.namespace + ".Extra"
conf.change_attributes do |attrs|
attrs[:assembly_description] = {
'MyCorp.Subassembly' => 'This is a an assembly to handle TLS authentication',
'MyCorp.Core' => 'This is a an assembly to handle the core stuff'
}[attrs[:assembly_title]]
end
# you MUST return the new Config instance to use
conf
end
a.using 'System' # optional, can be called multiple times to add more using-directives
end
You can feed the system a non-snake-case symbol in this case:
# ...
a.attributes assembly_description: "My wonderful lib",
assembly_configuration: 'RELEASE',
CLSCompliant: true
# ...