fix the call to mono-api-info
[mono.git] / mcs / tools / corcompare / gen-infos.rb
1 #!/usr/bin/env ruby
2
3 require 'ftools'
4
5 $gac = 'C:/WINDOWS/assembly/GAC_MSIL'
6 $fx =  'C:/WINDOWS/Microsoft.NET/Framework'
7
8 $fx1 = File.join $fx, "v1.1.4322"
9 $fx2 = File.join $fx, "v2.0.50727"
10 $fx3_0 = 'C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.0'
11 $fx3_5 = 'C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.5'
12 $fx4_0 = 'C:/Program Files/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0'
13 $sl2_0 = 'C:/Program Files/Microsoft Silverlight/2.0.31005.0'
14 $sl2_0sdk = 'C:/Program Files/Microsoft SDKs/Silverlight/v2.0/Libraries/Client/'
15
16 $net_1_1 = [
17         "mscorlib",
18         "System",
19         "System.Data",
20         "System.Data.OracleClient",
21         "System.DirectoryServices",
22         "System.Drawing",
23         "System.Runtime.Remoting",
24         "System.Runtime.Serialization.Formatters.Soap",
25         "System.Security",
26         "System.ServiceProcess",
27         "System.Web",
28         "System.Web.Services",
29         "System.Windows.Forms",
30         "System.Xml",
31         "cscompmgd",
32         "Microsoft.VisualBasic",
33         "",
34         "System.Configuration.Install",
35         "System.Design",
36         "System.Drawing.Design",
37         "System.EnterpriseServices",
38         "System.Management",
39         "System.Messaging"
40 ]
41
42 $net_2_0 = [
43         "mscorlib",
44         "System",
45         "System.Configuration",
46         "System.Data",
47         "System.Data.OracleClient",
48         "System.DirectoryServices",
49         "System.Drawing",
50         "System.Runtime.Remoting",
51         "System.Runtime.Serialization.Formatters.Soap",
52         "System.Security",
53         "System.ServiceProcess",
54         "System.Transactions",
55         "System.Web",
56         "System.Web.Services",
57         "System.Windows.Forms",
58         "System.Xml",
59         "cscompmgd",
60         "Microsoft.VisualBasic",
61         "",
62         "Microsoft.Build.Engine",
63         "Microsoft.Build.Framework",
64         "Microsoft.Build.Tasks",
65         "Microsoft.Build.Utilities",
66         "",
67         "System.Configuration.Install",
68         "System.Design",
69         "System.Drawing.Design",
70         "System.EnterpriseServices",
71         "System.Management",
72         "System.Messaging",
73 ]
74
75 $net_3_0 = [
76         "PresentationCore",
77
78         "PresentationFramework",
79         "System.Speech",
80         "WindowsBase",
81         "",
82         "System.IdentityModel",
83         "System.IdentityModel.Selectors",
84         "System.IO.Log",
85         "System.Runtime.Serialization",
86         "System.ServiceModel",
87         "",
88         "System.Workflow.Activities",
89         "System.Workflow.ComponentModel",
90         "System.Workflow.Runtime",
91         "",
92         "PresentationBuildTasks",
93         "",
94         "PresentationFramework.Aero",
95         "PresentationFramework.Classic",
96         "PresentationFramework.Luna",
97         "PresentationFramework.Royale",
98         "ReachFramework",
99         "",
100         "System.Printing",
101 ]
102
103 $net_3_5 = [
104         "mscorlib",
105         "System",
106         "System.AddIn",
107         "System.AddIn.Contract",
108         "System.Configuration",
109         "System.Core",
110         "System.Configuration.Install",
111         "System.Data",
112         "System.Data.Linq",
113         "System.Data.OracleClient",
114         "System.DirectoryServices",
115         # "System.DirectoryServices.AccountManagement",
116         # "System.DirectoryServices.Protocols",
117         "System.Drawing",
118         "System.Net",
119         "System.Runtime.Remoting",
120         "System.Security",
121         "System.ServiceProcess",
122         "System.Transactions",
123         "System.Web",
124         "System.Web.Extensions",
125         "System.Web.Extensions.Design",
126         "System.Web.Mobile",
127         "System.Web.RegularExpressions",
128         "System.Web.Services",
129         "System.Windows.Forms",
130         "System.Xml",
131         "System.Xml.Linq",
132         "",
133         "System.Runtime.Serialization.Formatters.Soap",
134         "cscompmgd",
135         "Microsoft.VisualBasic",
136         "",
137         "Microsoft.Build.Engine",
138         "Microsoft.Build.Framework",
139         "Microsoft.Build.Tasks",
140         "Microsoft.Build.Utilities",
141         "",
142         "System.Configuration.Install",
143         "System.Design",
144         "System.Drawing.Design",
145         "System.EnterpriseServices",
146         "System.Management",
147         "System.Management.Instrumentation",
148         "System.Messaging",
149 ]
150
151 $net_4_0 = [
152         "mscorlib",
153
154 #       "Microsoft.Build.Conversion.v3.5",
155         "Microsoft.Build.Conversion.v4.0",
156         "Microsoft.Build",
157         "Microsoft.Build.Engine",
158         "Microsoft.Build.Framework",
159 #       "Microsoft.Build.Tasks.v3.5",
160         "Microsoft.Build.Tasks.v4.0",
161 #       "Microsoft.Build.Utilities.v3.5",
162         "Microsoft.Build.Utilities.v4.0",
163         "Microsoft.CSharp",
164         "Microsoft.JScript",
165         "Microsoft.VisualBasic.Compatibility.Data",
166         "Microsoft.VisualBasic.Compatibility",
167         "Microsoft.VisualBasic",
168 #       "Microsoft.VisualC",
169 #       "Microsoft.VisualC.STLCLR",
170
171         "PresentationBuildTasks",
172         "PresentationCore",
173         "PresentationFramework.Aero",
174         "PresentationFramework.Classic",
175         "PresentationFramework",
176         "PresentationFramework.Luna",
177         "PresentationFramework.Royale",
178
179         "ReachFramework",
180         "ReferenceAssemblyBuildTask",
181
182         "System.Activities.Core.Design",
183         "System.Activities.Design.Base",
184         "System.Activities.Design",
185         "System.Activities",
186         "System.Activities.Extended",
187         "System.AddIn.Contract",
188         "System.AddIn",
189         "System.Caching",
190         "System.ComponentModel.Composition",
191         "System.ComponentModel.DataAnnotations",
192         "System.configuration",
193         "System.Configuration.Install",
194         "System.Core",
195         "System.Data.DataSetExtensions",
196         "System.Data",
197         "System.Data.Entity.Design",
198         "System.Data.Entity",
199         "System.Data.Linq",
200         "System.Data.OracleClient",
201         "System.Data.Services.Client",
202         "System.Data.Services.Design",
203         "System.Data.Services",
204         "System.Data.SqlXml",
205         "System.Deployment",
206         "System.Design",
207         "System.DirectoryServices.AccountManagement",
208         "System.DirectoryServices",
209         "System.DirectoryServices.Protocols",
210         "System",
211         "System.Drawing.Design",
212         "System.Drawing",
213         "System.Dynamic",
214         "System.EnterpriseServices",
215         "System.EnterpriseServices.Thunk",
216         "System.EnterpriseServices.Wrapper",
217         "System.IdentityModel",
218         "System.IdentityModel.Selectors",
219         "System.IO.Log",
220         "System.Management",
221         "System.Management.Instrumentation",
222         "System.Messaging",
223         "System.Net",
224         "System.Printing",
225         "System.Runtime",
226         "System.Runtime.Remoting",
227         "System.Runtime.Serialization",
228         "System.Runtime.Serialization.Formatters.Soap",
229         "System.Security",
230         "System.ServiceModel.Activities",
231         "System.ServiceModel.Channels",
232         "System.ServiceModel.Discovery",
233         "System.ServiceModel",
234         "System.ServiceModel.Routing",
235         "System.ServiceModel.Web",
236         "System.ServiceProcess",
237         "System.Speech",
238         "System.Transactions",
239         "System.Web.Abstractions",
240         "System.Web.DataVisualization.Design",
241         "System.Web.DataVisualization",
242         "System.Web",
243         "System.Web.DynamicData.Design",
244         "System.Web.DynamicData",
245         "System.Web.Entity.Design",
246         "System.Web.Entity",
247         "System.Web.Extensions.Design",
248         "System.Web.Extensions",
249         "System.Web.Mobile",
250         "System.Web.RegularExpressions",
251         "System.Web.Routing",
252         "System.Web.Services",
253         "System.Windows.Forms.DataVisualization.Design",
254         "System.Windows.Forms.DataVisualization",
255         "System.Windows.Forms",
256         "System.Windows.Presentation",
257         "System.Workflow.Activities",
258         "System.Workflow.ComponentModel",
259         "System.Workflow.Runtime",
260         "System.WorkflowServices",
261         "System.Xaml",
262         "System.Xaml.Hosting",
263         "System.XML",
264         "System.Xml.Linq",
265
266         "WindowsBase",
267         "XamlBuildTask"
268 ]
269
270 $sl_2_0 = [
271         "mscorlib",
272         "System.Windows",
273         "Microsoft.VisualBasic",
274         "System",
275         "System.Core",
276         "System.Net",
277         "System.Runtime.Serialization",
278         "System.ServiceModel",
279         "System.Windows.Browser",
280         "System.Xml",
281         "",
282         "System.Xml.Linq",
283         "System.Windows.Controls",
284         "System.Windows.Controls.Data",
285 ]
286
287 def locate(assembly, fxs = nil)
288         if fxs
289                 fxs.each do |fx|
290                         file = File.join fx, assembly + ".dll"
291                         return file if File.file?(file)
292                 end
293         end
294
295         gac = File.join $gac, assembly, "**", "*.dll"
296
297         glob = Dir.glob gac
298
299         return glob.first if glob and glob.length > 0
300 end
301
302 def delete(glob)
303         Dir.glob(glob).each do |file|
304                 File.delete file
305         end
306 end
307
308 def clean(pattern, allow_create = false)
309         if allow_create and not File.directory? "masterinfos"
310                 Dir.mkdir("masterinfos")
311                 return
312         end
313
314         delete(File.join("masterinfos", pattern))
315 end
316
317 def generate(location, assembly)
318         out = File.join "masterinfos", assembly + ".xml"
319         system("./mono-api-info.exe \"#{location}\" > #{out}")
320 end
321
322 def process(profile, assemblies, fxs = nil)
323         clean("*", true)
324
325         assemblies.each do |assembly|
326                 if assembly != nil and assembly.length > 0
327                         #puts assembly
328                         location = locate(assembly, fxs)
329                         if location
330                                 generate(location, assembly)
331                         else
332                                 puts "fail to locate " + assembly
333                         end
334                         #puts "   " + location if location
335                 end
336         end
337
338         clean("*.dll")
339
340         file = "masterinfos-#{profile}.tar"
341
342         system("tar -cf #{file} masterinfos")
343         system("gzip #{file}")
344
345         clean("*")
346
347         Dir.delete("masterinfos")
348 end
349
350 delete("*.tar.gz")
351
352 process("1.1", $net_1_1, [$fx1])
353 process("2.0", $net_2_0, [$fx2])
354 process("3.0", $net_3_0, [$fx3_0, $fx2])
355 process("3.5", $net_3_5, [$fx3_5, $fx2])
356 process("4.0", $net_4_0, [$fx4_0])
357 process("SL2", $sl_2_0, [$sl2_0, $sl2_0sdk])