~ubuntu-branches/ubuntu/natty/monodevelop/natty

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight/MoonlightBuildExtension.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-01-07 19:06:58 UTC
  • mto: (1.6.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 46.
  • Revision ID: james.westby@ubuntu.com-20100107190658-z9z95lgk4kwfes7p
ImportĀ upstreamĀ versionĀ 2.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
                        return exitCode;
191
191
                }
192
192
                
193
 
                protected override void Clean (IProgressMonitor monitor, SolutionEntityItem item, string configuration)
 
193
                protected override void Clean (IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
194
194
                {
195
195
                        MoonlightProject proj = item as MoonlightProject;
196
196
                        DotNetProjectConfiguration conf = null;
237
237
                        }
238
238
                }
239
239
                
240
 
                protected override bool GetNeedsBuilding (SolutionEntityItem item, string configuration)
 
240
                protected override bool GetNeedsBuilding (SolutionEntityItem item, ConfigurationSelector configuration)
241
241
                {
242
242
                        MoonlightProject proj = item as MoonlightProject;
243
243
                        DotNetProjectConfiguration conf = null;
299
299
                        return false;
300
300
                }               
301
301
                
302
 
                protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem item, string configuration)
 
302
                protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
303
303
                {
304
304
                        MoonlightProject proj = item as MoonlightProject;
305
305
                        DotNetProjectConfiguration conf = null;
326
326
                        return result;
327
327
                }
328
328
 
329
 
                BuildResult GenerateManifest (IProgressMonitor monitor, MoonlightProject proj, DotNetProjectConfiguration conf, string slnConf)
 
329
                BuildResult GenerateManifest (IProgressMonitor monitor, MoonlightProject proj, DotNetProjectConfiguration conf, ConfigurationSelector slnConf)
330
330
                {
331
331
                        const string depNS = "http://schemas.microsoft.com/client/2007/deployment";
332
332
                        
378
378
                                        deploymentNode.Attributes.Append (doc.CreateAttribute ("EntryPointType")).Value = proj.SilverlightAppEntry;
379
379
 
380
380
                                if (deploymentNode.Attributes["RuntimeVersion"] == null) {
381
 
                                        if (proj.TargetFramework.ClrVersion == ClrVersion.Clr_2_1)
382
 
                                                deploymentNode.Attributes.Append (doc.CreateAttribute ("RuntimeVersion")).Value = "2.0.31005.0";
 
381
                                        string runtimeVersion = null;
 
382
                                        string fxVersion = MoonlightFrameworkBackend.GetFxVersion (proj.TargetFramework);
 
383
                                        
 
384
                                        if (proj.TargetRuntime is MonoDevelop.Core.Assemblies.MonoTargetRuntime) {
 
385
                                                var package = proj.TargetRuntime.RuntimeAssemblyContext.GetPackage ("moonlight-web-" + fxVersion);
 
386
                                                if (package != null && package.IsFrameworkPackage) {
 
387
                                                        runtimeVersion = package.Version;
 
388
                                                } else {
 
389
                                                        LoggingService.LogWarning ("Moonlight core framework package not found, cannot determine " +
 
390
                                                                "runtime version string. Falling back to default value.");
 
391
                                                }
 
392
                                        }
 
393
                                        
 
394
                                        if (runtimeVersion == null) {
 
395
                                                //FIXME how will we determine this for other runtimes?
 
396
                                                runtimeVersion = "2.0.31005.0";
 
397
                                        }
 
398
                                        
 
399
                                        deploymentNode.Attributes.Append (doc.CreateAttribute ("RuntimeVersion")).Value = runtimeVersion;
383
400
                                }
384
401
 
385
402
                                XmlNamespaceManager mgr = new XmlNamespaceManager (doc.NameTable);
458
475
                        return Path.Combine (conf.OutputDirectory, xapName);
459
476
                }
460
477
                
461
 
                BuildResult Zip (IProgressMonitor monitor, MoonlightProject proj, DotNetProjectConfiguration conf, string slnConf)
 
478
                BuildResult Zip (IProgressMonitor monitor, MoonlightProject proj, DotNetProjectConfiguration conf, ConfigurationSelector slnConf)
462
479
                {
463
480
                        string xapName = GetXapName (proj, conf);
464
481
                        
467
484
                        
468
485
                        src.Add (conf.CompiledOutputName);
469
486
                        targ.Add (Path.GetFileName (conf.CompiledOutputName));
 
487
                        
 
488
                        // FIXME: this is a hack for the Mono Soft Debugger. In future the mdb files should be *beside* the xap,
 
489
                        // when sdb supports that model. Note that there's no point doing this for pdb files, because the debuggers 
 
490
                        // that read pdb files don't expect them to be in the xap.
 
491
                        var doSdbCopy = conf.DebugMode && proj.TargetRuntime is MonoDevelop.Core.Assemblies.MonoTargetRuntime;
 
492
                        
 
493
                        if (doSdbCopy) {
 
494
                                var mdb = conf.CompiledOutputName + ".mdb";
 
495
                                if (File.Exists (mdb)) {
 
496
                                        src.Add (mdb);
 
497
                                        targ.Add (Path.GetFileName (mdb));
 
498
                                }
 
499
                        }
470
500
 
471
501
                        if (proj.GenerateSilverlightManifest) {
472
502
                                src.Add (Path.Combine (conf.OutputDirectory, "AppManifest.xaml"));
482
512
                        
483
513
                        BuildResult res = new BuildResult ();
484
514
 
 
515
                        // The "copy to output" files don't seem to be included in xaps, so we can't use project.GetSupportFiles.
 
516
                        // Instead we need to iterate over the refs and handle them manually.
485
517
                        foreach (ProjectReference pr in proj.References) {
486
518
                                if (pr.LocalCopy) {
487
519
                                        var pk = pr.Package;
488
 
                                        if (pk == null || !pk.IsFrameworkPackage) {
 
520
                                        if (pk == null || (!pk.IsFrameworkPackage || pk.Name.EndsWith ("-redist"))) {
489
521
                                                string err = pr.ValidationErrorMessage;
490
522
                                                if (!String.IsNullOrEmpty (err)) {
491
523
                                                        string msg = String.Format ("Could not add reference '{0}' to '{1}': {2}",
497
529
                                                foreach (string s in pr.GetReferencedFileNames (slnConf)) {
498
530
                                                        src.Add (s);
499
531
                                                        targ.Add (Path.GetFileName (s));
 
532
                                                        
 
533
                                                        if (doSdbCopy && s.EndsWith (".dll")) {
 
534
                                                                var mdb = s + ".mdb";
 
535
                                                                if (File.Exists (mdb)) {
 
536
                                                                        src.Add (mdb);
 
537
                                                                        targ.Add (Path.GetFileName (mdb));
 
538
                                                                }
 
539
                                                        }
500
540
                                                }
501
541
                                        }
502
542
                                }