require_relative('./dependencies.rb')
class Artifacts < Array
def initialize
# gem, dev_tasks-0.0.7.gem
Dir.glob('*.gemspec') {|f|
spec=Gem::Specification.load(f)
artifact="#{spec.name}-#{spec.version.to_s}.gem"
self << artifact if(!self.include?(artifact))
}
# C# dll, bin/Net4.0/QcNet.dll
Dir.glob("*.csproj").each{|p|
text = File.read(p)
# extract AssemblyName of form: MyLibrary.Test
assemblyName=text[/([\w\.]+),1]
outputType=text[/([\w\.]+),1]
outputPath=text[/Release[.\w\W]+([\w\.\\]+),1]
if(!assemblyName.nil? && !outputPath.nil? && !assemblyName.include?("Test"))
extension="dll"
extension="exe" if(outputType=="WinExe" || outputType=="Exe")
artifact = "#{outputPath}\\#{assemblyName}.#{extension}".gsub("\\\\","\\").gsub('/','\\').gsub('\\','/')
self << artifact if(!self.include?(artifact))
# add in file dependencies
Dependencies.csharp_file_dependencies(text).each{|dep|
cs_dll_dep=dep.gsub(File.dirname(dep),File.dirname(artifact)).gsub('\\','/')
self << cs_dll_dep if(!self.include?(cs_dll_dep))
}
end
}
end
end