summaryrefslogtreecommitdiff
path: root/mcs/class/Moonlight.Build.Tasks
diff options
context:
space:
mode:
authorJo Shields <directhex@apebox.org>2014-02-19 22:12:43 +0000
committerJo Shields <directhex@apebox.org>2014-02-19 22:12:43 +0000
commit9972bf87b4f27d9c8f358ef8414ac1ab957a2f0f (patch)
tree5bb230c1d698659115f918e243c1d4b0aa4c7f51 /mcs/class/Moonlight.Build.Tasks
parentd0a215f5626219ff7927f576588a777e5331c7be (diff)
downloadmono-upstream/3.2.8+dfsg.tar.gz
Imported Upstream version 3.2.8+dfsgupstream/3.2.8+dfsg
Diffstat (limited to 'mcs/class/Moonlight.Build.Tasks')
-rw-r--r--mcs/class/Moonlight.Build.Tasks/ChangeLog3
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Makefile57
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks.dll.sources6
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/ChangeLog23
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/CreateTestPage.cs79
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateMoonlightManifest.cs179
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateXap.cs140
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GetMoonlightFrameworkPath.cs91
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/PreviewTemplate.html76
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/Respack.cs120
-rw-r--r--mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/XamlG.cs378
11 files changed, 0 insertions, 1152 deletions
diff --git a/mcs/class/Moonlight.Build.Tasks/ChangeLog b/mcs/class/Moonlight.Build.Tasks/ChangeLog
deleted file mode 100644
index 7e630808ba..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/ChangeLog
+++ /dev/null
@@ -1,3 +0,0 @@
-2010-04-13 Ankit Jain <jankit@novell.com>
-
- * Initial commit.
diff --git a/mcs/class/Moonlight.Build.Tasks/Makefile b/mcs/class/Moonlight.Build.Tasks/Makefile
deleted file mode 100644
index 5452bf8ed5..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-thisdir = class/Moonlight.Build.Tasks
-SUBDIRS =
-include ../../build/rules.make
-
-LIBRARY = Moonlight.Build.Tasks.dll
-LIBRARY_NAME = Moonlight.Build.Tasks.dll
-
-ifeq (3.5, $(FRAMEWORK_VERSION))
-NAME_SUFFIX = .v3.5
-else
-ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
-NAME_SUFFIX = .v4.0
-endif
-endif
-
-NO_INSTALL = yes
-NO_TEST = yes
-NO_SIGN_ASSEMBLY = yes
-
-REFERENCES = \
- /r:$(corlib) \
- /r:System.dll \
- /r:System.Xml.dll \
- /r:Microsoft.Build.Engine.dll \
- /r:Microsoft.Build.Framework.dll \
- /r:Microsoft.Build.Utilities$(NAME_SUFFIX).dll \
- /r:Microsoft.Build.Tasks$(NAME_SUFFIX).dll \
- /r:ICSharpCode.SharpZipLib.dll
-
-LIB_MCS_FLAGS = \
- $(REFERENCES) \
- $(RESOURCE_FILES:%=-resource:%)
-
-RESOURCE_FILES = Moonlight.Build.Tasks/PreviewTemplate.html
-
-EXTRA_DISTFILES = $(RESOURCE_FILES)
-
-XBUILD_DIR=../../tools/xbuild
-include $(XBUILD_DIR)/xbuild_targets.make
-
-include ../../build/library.make
-
-SILVERLIGHT_DIR = $(DESTDIR)$(mono_libdir)/mono/xbuild/Microsoft/Silverlight
-
-install-local: install-lib
-
-install-lib: $(the_lib)
- -$(MKINSTALLDIRS) $(SILVERLIGHT_DIR)/v2.0
- -$(MKINSTALLDIRS) $(SILVERLIGHT_DIR)/v3.0
- $(INSTALL_DATA) $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME) $(SILVERLIGHT_DIR)/v2.0
- $(INSTALL_DATA) $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME) $(SILVERLIGHT_DIR)/v3.0
-
-uninstall-local: uninstall-lib
-
-uninstall-lib:
- -rm -f $(SILVERLIGHT_DIR)/v2.0/$(LIBRARY_NAME)
- -rm -f $(SILVERLIGHT_DIR)/v3.0/$(LIBRARY_NAME)
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks.dll.sources b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks.dll.sources
deleted file mode 100644
index 74c3a27a72..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks.dll.sources
+++ /dev/null
@@ -1,6 +0,0 @@
-Moonlight.Build.Tasks/GenerateXap.cs
-Moonlight.Build.Tasks/XamlG.cs
-Moonlight.Build.Tasks/GetMoonlightFrameworkPath.cs
-Moonlight.Build.Tasks/GenerateMoonlightManifest.cs
-Moonlight.Build.Tasks/CreateTestPage.cs
-Moonlight.Build.Tasks/Respack.cs
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/ChangeLog b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/ChangeLog
deleted file mode 100644
index f622072904..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/ChangeLog
+++ /dev/null
@@ -1,23 +0,0 @@
-2010-07-16 Ankit Jain <jankit@novell.com>
-
- * XamlG.cs (Execute): Fix earlier commit, include the filename.
-
-2010-07-16 Ankit Jain <jankit@novell.com>
-
- * Respack.cs (Execute): Skip if output file is up-to-date wrt
- the input files. Bug reported by Rolf.
-
-2010-07-16 Ankit Jain <jankit@novell.com>
-
- * XamlG.cs: Fix arg to XamlGCompiler, to use path relative to project
- dir. Bug uncovered by Rolf.
-
-2010-04-13 Ankit Jain <jankit@novell.com>
-
- * CreateTestPage.cs:
- * GenerateMoonlightManifest.cs:
- * GetMoonlightFrameworkPath.cs:
- * GenerateXap.cs:
- * Respack.cs:
- * XamlG.cs:
- MSBuild tasks for building silverlight projects.
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/CreateTestPage.cs b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/CreateTestPage.cs
deleted file mode 100644
index 28051694ee..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/CreateTestPage.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// CreateTestPage.cs: Generates test page for moonlight app
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-// Ankit Jain <jankit@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Text;
-
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace Moonlight.Build.Tasks {
- public class CreateTestPage : Task {
-
- public override bool Execute ()
- {
- Log.LogMessage (MessageImportance.Low, "Generating test page {0}", XapFilename);
-
- var sb = new StringBuilder ();
- using (var sr = new StreamReader (Assembly.GetExecutingAssembly ().GetManifestResourceStream ("PreviewTemplate.html")))
- sb.Append (sr.ReadToEnd ());
-
- sb.Replace ("@TITLE@", Title);
- sb.Replace ("@XAP_FILE@", XapFilename);
-
- try{
- File.WriteAllText (TestPageFilename, sb.ToString ());
- } catch (IOException e) {
- Log.LogError (String.Format (
- "Error generating test page file {0}: {1}", TestPageFilename, e.Message));
- return false;
- }
-
- return true;
- }
-
- [Required]
- public string XapFilename {
- get; set;
- }
-
- [Required]
- public string Title {
- get; set;
- }
-
- [Required]
- [Output]
- public string TestPageFilename {
- get; set;
- }
- }
-}
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateMoonlightManifest.cs b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateMoonlightManifest.cs
deleted file mode 100644
index 4b7e7a30df..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateMoonlightManifest.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// GenerateMoonlightManifest.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-// Ankit Jain <jankit@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.Xml;
-
-using Microsoft.CSharp;
-
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace Moonlight.Build.Tasks {
- public class GenerateMoonlightManifest : Task {
-
- public override bool Execute ()
- {
- return GenerateManifest ();
- }
-
- bool GenerateManifest ()
- {
- const string depNS = "http://schemas.microsoft.com/client/2007/deployment";
-
- string template = null;
- var manifest = ManifestFile.ItemSpec;
- Log.LogMessage (MessageImportance.Normal, "Generating manifest file {0}", manifest);
-
- if (SilverlightManifestTemplate != null)
- template = String.IsNullOrEmpty (SilverlightManifestTemplate.ItemSpec) ?
- null :
- SilverlightManifestTemplate.GetMetadata ("FullPath");
-
- XmlDocument doc = new XmlDocument ();
- if (template != null) {
- if (!File.Exists (template)) {
- Log.LogError ("Could not find manifest template '" + template + "'.");
- return false;
- }
-
- try {
- doc.Load (template);
- } catch (XmlException ex) {
- Log.LogError (null, null, null, template, ex.LineNumber, ex.LinePosition, 0, 0,
- "Error loading manifest template '" + ex.Source);
- return false;
- } catch (Exception ex) {
- Log.LogError ("Could not load manifest template '" + template + "'.");
- Log.LogMessage (MessageImportance.Low, "Could not load manifest template '" + template + "': " + ex.ToString ());
- return false;
- }
-
- } else {
- doc.LoadXml (@"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""></Deployment>");
- }
-
- try {
- XmlNode deploymentNode = doc.DocumentElement;
- if (deploymentNode == null || deploymentNode.Name != "Deployment" || deploymentNode.NamespaceURI != depNS) {
- Log.LogError ("Missing or invalid root <Deployment> element in manifest template '" + template + "'.");
- return false;
- }
- if (deploymentNode.Attributes["EntryPointAssembly"] == null)
- deploymentNode.Attributes.Append (doc.CreateAttribute ("EntryPointAssembly")).Value =
- EntryPointAssembly.GetMetadata ("Filename");
-
- if (!String.IsNullOrEmpty (SilverlightAppEntry) && deploymentNode.Attributes["EntryPointType"] == null)
- deploymentNode.Attributes.Append (doc.CreateAttribute ("EntryPointType")).Value = SilverlightAppEntry;
-
- if (deploymentNode.Attributes["RuntimeVersion"] == null) {
- //FIXME:
- /*string fxVersion = MoonlightFrameworkBackend.GetFxVersion (proj.TargetFramework);
-
- if (proj.TargetRuntime is MonoDevelop.Core.Assemblies.MonoTargetRuntime) {
- var package = proj.TargetRuntime.RuntimeAssemblyContext.GetPackage ("moonlight-web-" + fxVersion);
- if (package != null && package.IsFrameworkPackage) {
- runtimeVersion = package.Version;
- } else {
- LoggingService.LogWarning ("Moonlight core framework package not found, cannot determine " +
- "runtime version string. Falling back to default value.");
- }
- }*/
-
- deploymentNode.Attributes.Append (doc.CreateAttribute ("RuntimeVersion")).Value =
- String.IsNullOrEmpty (RuntimeVersion) ? "2.0.31005.0" : RuntimeVersion;
- }
-
- XmlNamespaceManager mgr = new XmlNamespaceManager (doc.NameTable);
- mgr.AddNamespace ("dep", depNS);
- XmlNode partsNode = deploymentNode.SelectSingleNode ("dep:Deployment.Parts", mgr);
- if (partsNode == null)
- partsNode = deploymentNode.AppendChild (doc.CreateElement ("Deployment.Parts", depNS));
-
- AddAssemblyPart (doc, partsNode, EntryPointAssembly);
-
- foreach (ITaskItem ref_item in References)
- AddAssemblyPart (doc, partsNode, ref_item);
- } catch (XmlException ex) {
- Log.LogError (null, null, null, template, ex.LineNumber, ex.LinePosition, 0, 0,
- "Error processing manifest template: '" + ex.Source);
- return false;
- }
-
- doc.Save (manifest);
-
- return true;
- }
-
- static void AddAssemblyPart (XmlDocument doc, XmlNode partsNode, ITaskItem filename)
- {
- XmlNode child = doc.CreateElement ("AssemblyPart", "http://schemas.microsoft.com/client/2007/deployment");
- child.Attributes.Append (doc.CreateAttribute (
- "Name", "http://schemas.microsoft.com/winfx/2006/xaml")).Value = filename.GetMetadata ("Filename");
- string subdir = filename.GetMetadata ("DestinationSubdirectory");
- child.Attributes.Append (doc.CreateAttribute ("Source")).Value = Path.Combine (subdir ?? String.Empty, Path.GetFileName (filename.ItemSpec));
- partsNode.AppendChild (child);
- }
-
- [Required]
- [Output]
- public ITaskItem ManifestFile {
- get; set;
- }
-
- [Required]
- // with extension
- public ITaskItem EntryPointAssembly {
- get; set;
- }
-
- [Required]
- public ITaskItem[] References {
- get; set;
- }
-
- public ITaskItem SilverlightManifestTemplate {
- get; set;
- }
-
- public string SilverlightAppEntry {
- get; set;
- }
-
- public string RuntimeVersion {
- get; set;
- }
- }
-
-}
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateXap.cs b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateXap.cs
deleted file mode 100644
index 92082ac0ef..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GenerateXap.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-//
-// GenerateXap.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-// Ankit Jain <jankit@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.Xml;
-
-using Microsoft.CSharp;
-
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace Moonlight.Build.Tasks {
- public class GenerateXap : Task {
-
- public override bool Execute ()
- {
- if (InputFiles.Length == 0)
- return true;
-
- return Zip ();
- }
-
- bool Zip ()
- {
- var xapName = XapFilename.ItemSpec;
- if (File.Exists (xapName)) {
- DateTime lastMod = File.GetLastWriteTime (xapName);
- bool needsWrite = false;
- foreach (ITaskItem file_item in InputFiles) {
- if (File.GetLastWriteTime (file_item.ItemSpec) > lastMod) {
- needsWrite = true;
- break;
- }
- }
- if (!needsWrite) {
- Log.LogMessage (MessageImportance.Low, "Skipping xap file {0} generation, its up-to date");
- return true;
- }
- }
-
- Log.LogMessage (MessageImportance.Normal, "Generating compressed xap file {0}", xapName);
- try {
- using (FileStream fs = new FileStream (xapName, FileMode.Create)) {
- var zip_stream = new ICSharpCode.SharpZipLib.Zip.ZipOutputStream (fs);
- zip_stream.SetLevel (9);
-
- AddFilesToZip (InputFiles, zip_stream);
- AddFilesToZip (LocalCopyReferences, zip_stream);
-
- zip_stream.Finish ();
- zip_stream.Close ();
- }
- } catch (IOException ex) {
- Log.LogError ("Error writing xap file.", ex);
- Log.LogMessage (MessageImportance.Low, "Error writing xap file:" + ex.ToString ());
-
- try {
- if (File.Exists (xapName))
- File.Delete (xapName);
- } catch {}
-
- return false;
- }
-
- return true;
- }
-
- void AddFilesToZip (ITaskItem [] files, ICSharpCode.SharpZipLib.Zip.ZipOutputStream zipStream)
- {
- if (files == null)
- return;
-
- foreach (ITaskItem item in files) {
- string target_path = item.GetMetadata ("TargetPath");
- if (String.IsNullOrEmpty (target_path))
- target_path = Path.GetFileName (item.ItemSpec);
-
- zipStream.PutNextEntry (new ICSharpCode.SharpZipLib.Zip.ZipEntry (target_path));
- using (FileStream inStream = File.OpenRead (item.ItemSpec)) {
- int readCount;
- byte[] buffer = new byte[4096];
-
- do {
- readCount = inStream.Read (buffer, 0, buffer.Length);
- zipStream.Write (buffer, 0, readCount);
- } while (readCount > 0);
- }
- }
- }
-
- [Output]
- [Required]
- public ITaskItem XapFilename {
- get; set;
- }
-
- [Required]
- public ITaskItem[] InputFiles {
- get; set;
- }
-
- public ITaskItem[] LocalCopyReferences {
- get; set;
- }
-
- }
-
-
-}
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GetMoonlightFrameworkPath.cs b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GetMoonlightFrameworkPath.cs
deleted file mode 100644
index 91de54407b..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/GetMoonlightFrameworkPath.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// GetMoonlightFrameworkPath.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-// Ankit Jain <jankit@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using SI = System.IO;
-
-using System;
-using System.Text;
-
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace Moonlight.Build.Tasks {
- public class GetMoonlightFrameworkPath : Task {
-
- public override bool Execute ()
- {
- return true;
- }
-
- [Required]
- public string SilverlightVersion {
- get; set;
- }
-
- [Output]
- public string FrameworkPath {
- get {
- if (string.IsNullOrEmpty (SilverlightVersion))
- return FrameworkVersion30Path;
-
- return SI.Path.GetFullPath (
- PathCombine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20),
- "..", "..", "moonlight", SilverlightVersion));
- }
- }
-
- [Output]
- public string FrameworkVersion20Path {
- get {
- return SI.Path.GetFullPath (
- PathCombine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20),
- "..", "..", "moonlight", "2.0"));
- }
- }
-
- [Output]
- public string FrameworkVersion30Path {
- get {
- return SI.Path.GetFullPath (
- PathCombine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20),
- "..", "..", "moonlight", "3.0"));
- }
- }
-
- static string PathCombine (string path1, params string[] parts)
- {
- StringBuilder sb = new StringBuilder ();
- sb.Append (path1);
- foreach (string part in parts)
- sb.AppendFormat ("{0}{1}", SI.Path.DirectorySeparatorChar, part);
-
- return sb.ToString ();
- }
- }
-}
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/PreviewTemplate.html b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/PreviewTemplate.html
deleted file mode 100644
index 2be0575995..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/PreviewTemplate.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" >
-<head>
- <title>@TITLE@</title>
-
- <style type="text/css">
- html, body {
- height: 100%;
- overflow: auto;
- }
- body {
- padding: 0;
- margin: 0;
- }
- #silverlightControlHost {
- height: 100%;
- }
- </style>
-
- <script type="text/javascript">
- function onSilverlightError(sender, args) {
-
- var appSource = "";
- if (sender != null && sender != 0) {
- appSource = sender.getHost().Source;
- }
- var errorType = args.ErrorType;
- var iErrorCode = args.ErrorCode;
-
- var errMsg = "Unhandled Error in Silverlight 2 Application " + appSource + "\n" ;
-
- errMsg += "Code: "+ iErrorCode + " \n";
- errMsg += "Category: " + errorType + " \n";
- errMsg += "Message: " + args.ErrorMessage + " \n";
-
- if (errorType == "ParserError")
- {
- errMsg += "File: " + args.xamlFile + " \n";
- errMsg += "Line: " + args.lineNumber + " \n";
- errMsg += "Position: " + args.charPosition + " \n";
- }
- else if (errorType == "RuntimeError")
- {
- if (args.lineNumber != 0)
- {
- errMsg += "Line: " + args.lineNumber + " \n";
- errMsg += "Position: " + args.charPosition + " \n";
- }
- errMsg += "MethodName: " + args.methodName + " \n";
- }
-
- throw new Error(errMsg);
- }
- </script>
-</head>
-
-<body>
- <!-- Runtime errors from Silverlight will be displayed here.
- This will contain debugging information and should be removed or hidden when debugging is completed -->
- <div id='errorLocation' style="font-size: small;color: Gray;"></div>
-
- <div id="silverlightControlHost">
- <object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
- <param name="source" value="@XAP_FILE@"/>
- <param name="onerror" value="onSilverlightError" />
- <param name="background" value="white" />
- <param name="minRuntimeVersion" value="2.0.31005.0" />
- <param name="autoUpgrade" value="true" />
- <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
- <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
- </a>
- </object>
- <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
- </div>
-</body>
-</html>
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/Respack.cs b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/Respack.cs
deleted file mode 100644
index 4efcb41b0f..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/Respack.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// Respack.cs
-//
-// Author:
-// Ankit Jain (jankit@novell.com)
-//
-// Copyright 2010 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using Microsoft.Build.Framework;
-using Microsoft.Build.Tasks;
-using Microsoft.Build.Utilities;
-using Mono.XBuild.Utilities;
-
-namespace Moonlight.Build.Tasks {
- public class Respack : ToolTask
- {
- public override bool Execute ()
- {
- if (!ValidateParameters ()) {
- // not generating any resource file
- OutputFile = null;
- return true;
- }
-
- return BuildRequired () ? base.Execute () : true;
- }
-
- bool BuildRequired ()
- {
- if (!File.Exists (OutputFile.ItemSpec))
- return true;
-
- DateTime outputFileTime = File.GetLastWriteTime (OutputFile.ItemSpec);
- foreach (var res in Resources) {
- string file = res.ItemSpec;
- if (File.Exists (file) && File.GetLastWriteTime (file) > outputFileTime)
- return true;
- }
-
- return false;
- }
-
- void AddCommandLineCommands (CommandLineBuilderExtension commandLine)
- {
- if (Resources.Length == 0)
- return;
-
- commandLine.AppendFileNameIfNotNull (OutputFile);
-
- commandLine.AppendFileNamesIfNotNull (Resources, " ");
- }
-
- protected override string GenerateCommandLineCommands ()
- {
- CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
- AddCommandLineCommands (clbe);
- return clbe.ToString ();
- }
-
- protected override string GenerateFullPathToTool ()
- {
- return Path.Combine (ToolPath, ToolExe);
- }
-
- protected override bool ValidateParameters()
- {
- return Resources.Length > 0;
- }
-
- [Required]
- [Output]
- public ITaskItem OutputFile {
- get; set;
- }
-
- [Required]
- public ITaskItem[] Resources {
- get; set;
- }
-
- protected override string ToolName {
- get {
- return RunningOnWindows ? "respack.bat" : "respack";
- }
- }
-
- static bool RunningOnWindows {
- get {
- // Code from Mono.GetOptions/Options.cs
- // check for non-Unix platforms - see FAQ for more details
- // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
- int platform = (int) Environment.OSVersion.Platform;
- return ((platform != 4) && (platform != 128));
- }
-
- }
- }
-}
diff --git a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/XamlG.cs b/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/XamlG.cs
deleted file mode 100644
index bacd62da20..0000000000
--- a/mcs/class/Moonlight.Build.Tasks/Moonlight.Build.Tasks/XamlG.cs
+++ /dev/null
@@ -1,378 +0,0 @@
-//
-// XamlG.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-// Ankit Jain <jankit@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.Xml;
-
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace Moonlight.Build.Tasks {
- public class XamlG : Task {
-
- public override bool Execute ()
- {
- if (Sources.Length == 0)
- return true;
-
- if (OutputFiles == null || Sources.Length != OutputFiles.Length) {
- Log.LogError ("Number of OutputFiles must match the number of Source files");
- return false;
- }
-
- var codedom_provider = GetCodeDomProviderForLanguage (Language);
- if (codedom_provider == null) {
- Log.LogError ("Language {0} not supported for code generation.", Language);
- return false;
- }
-
- for (int i = 0; i < Sources.Length; i ++) {
- ITaskItem source_item = Sources [i];
- ITaskItem dest_item = OutputFiles [i];
- if (!File.Exists (dest_item.ItemSpec) ||
- File.GetLastWriteTime (dest_item.ItemSpec) < File.GetLastWriteTime (source_item.ItemSpec)) {
- Log.LogMessage (MessageImportance.Low, "Generating codebehind accessors for {0}...", source_item.ItemSpec);
-
- string full_source_path = source_item.GetMetadata ("FullPath");
- try {
- if (!XamlGCompiler.GenerateFile (codedom_provider, AssemblyName, full_source_path,
- Path.Combine (source_item.GetMetadata ("RelativeDir"),
- Path.GetFileName (source_item.ItemSpec)),
- dest_item.ItemSpec, Log)) {
- Log.LogError ("Error generating {0} from {1}", full_source_path, dest_item.ItemSpec);
- return false;
- }
- } catch (Exception e) {
- Log.LogError ("Error generating {0} from {1}: {2}", full_source_path, dest_item.ItemSpec, e.Message);
- Log.LogMessage (MessageImportance.Low, "Error generating {0} from {1}: {2}",
- full_source_path, dest_item.ItemSpec, e.ToString ());
- return false;
- }
- }
- }
-
- return true;
- }
-
- CodeDomProvider GetCodeDomProviderForLanguage (string lang)
- {
- switch (lang.ToLower ()) {
- case "c#": return new Microsoft.CSharp.CSharpCodeProvider ();
- case "vb": return new Microsoft.VisualBasic.VBCodeProvider ();
- }
-
- return null;
- }
-
- [Required]
- public ITaskItem [] Sources {
- get; set;
- }
-
- [Required]
- public string Language {
- get; set;
- }
-
- [Required]
- public string AssemblyName {
- get; set;
- }
-
- [Output]
- public ITaskItem [] OutputFiles {
- get; set;
- }
-
- bool HasFileChanged (string source, string dest)
- {
- if (!File.Exists (dest))
- return true;
-
- FileInfo sourceInfo = new FileInfo (source);
- FileInfo destinationInfo = new FileInfo (dest);
-
- return !(sourceInfo.Length == destinationInfo.Length &&
- File.GetLastWriteTime(source) <= File.GetLastWriteTime (dest));
- }
-
- }
-
- static class XamlGCompiler
- {
- private static bool sl2 = true;
-
- public static bool GenerateFile (CodeDomProvider provider, string app_name,
- string xaml_file, string xaml_path_in_project, string out_file, TaskLoggingHelper log)
- {
- XmlDocument xmldoc = new XmlDocument ();
- xmldoc.Load (xaml_file);
-
- XmlNamespaceManager nsmgr = new XmlNamespaceManager (xmldoc.NameTable);
- nsmgr.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml");
-
- XmlNode root = xmldoc.SelectSingleNode ("/*", nsmgr);
- if (root == null) {
- log.LogError ("{0}: No root node found.", xaml_file);
- return false;
- }
-
- XmlAttribute root_class = root.Attributes ["x:Class"];
- if (root_class == null) {
- File.WriteAllText (out_file, "");
- return true;
- }
-
- bool is_application = root.LocalName == "Application";
- string root_ns;
- string root_type;
- string root_asm;
-
- ParseXmlns (root_class.Value, out root_type, out root_ns, out root_asm);
-
- Hashtable names_and_types = GetNamesAndTypes (root, nsmgr);
-// Hashtable keys_and_types = GetKeysAndTypes (root, nsmgr);
-
- CodeCompileUnit ccu = new CodeCompileUnit ();
- CodeNamespace decl_ns = new CodeNamespace (root_ns);
- ccu.Namespaces.Add (decl_ns);
-
- decl_ns.Imports.Add (new CodeNamespaceImport ("System"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Controls"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Documents"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Input"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Media"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Media.Animation"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Shapes"));
- decl_ns.Imports.Add (new CodeNamespaceImport ("System.Windows.Controls.Primitives"));
-
- CodeTypeDeclaration decl_type = new CodeTypeDeclaration (root_type);
- decl_type.IsPartial = true;
-
- decl_ns.Types.Add (decl_type);
-
- CodeMemberMethod initcomp = new CodeMemberMethod ();
- initcomp.Name = "InitializeComponent";
- decl_type.Members.Add (initcomp);
-
- if (sl2) {
- CodeMemberField field = new CodeMemberField ();
- field.Name = "_contentLoaded";
- field.Type = new CodeTypeReference (typeof (bool));
-
- decl_type.Members.Add (field);
-
- CodeConditionStatement is_content_loaded = new CodeConditionStatement (new CodeVariableReferenceExpression ("_contentLoaded"),
- new CodeStatement [] { new CodeMethodReturnStatement () });
- initcomp.Statements.Add (is_content_loaded);
-
- CodeAssignStatement set_content_loaded = new CodeAssignStatement (new CodeVariableReferenceExpression ("_contentLoaded"),
- new CodePrimitiveExpression (true));
-
- initcomp.Statements.Add (set_content_loaded);
-
- string component_path = String.Format ("/{0};component/{1}", app_name, xaml_path_in_project);
- CodeMethodInvokeExpression load_component = new CodeMethodInvokeExpression (
- new CodeTypeReferenceExpression ("System.Windows.Application"), "LoadComponent",
- new CodeExpression [] { new CodeThisReferenceExpression (),
- new CodeObjectCreateExpression (new CodeTypeReference ("System.Uri"), new CodeExpression [] {
- new CodePrimitiveExpression (component_path),
- new CodeFieldReferenceExpression (new CodeTypeReferenceExpression ("System.UriKind"), "Relative") })
- });
- initcomp.Statements.Add (load_component);
- }
-
- if (!is_application) {
- foreach (DictionaryEntry entry in names_and_types) {
- string name = (string) entry.Key;
- CodeTypeReference type = (CodeTypeReference) entry.Value;
-
- CodeMemberField field = new CodeMemberField ();
-
- if (sl2)
- field.Attributes = MemberAttributes.Assembly;
-
- field.Name = name;
- field.Type = type;
-
- decl_type.Members.Add (field);
-
- CodeMethodInvokeExpression find_invoke = new CodeMethodInvokeExpression (
- new CodeThisReferenceExpression(), "FindName",
- new CodeExpression[] { new CodePrimitiveExpression (name) } );
-
- CodeCastExpression cast = new CodeCastExpression (type, find_invoke);
-
- CodeAssignStatement assign = new CodeAssignStatement (
- new CodeVariableReferenceExpression (name), cast);
-
- initcomp.Statements.Add (assign);
- }
- }
-
-
- using (StreamWriter writer = new StreamWriter (out_file)) {
- provider.GenerateCodeFromCompileUnit (ccu, writer, new CodeGeneratorOptions ());
- }
-
- return true;
- }
-
- private static Hashtable GetNamesAndTypes (XmlNode root, XmlNamespaceManager nsmgr)
- {
- Hashtable res = new Hashtable ();
-
- XmlNodeList names = root.SelectNodes ("//*[@x:Name]", nsmgr);
- foreach (XmlNode node in names) {
-
- // Don't take the root canvas
- if (node == root)
- continue;
-
- XmlAttribute attr = node.Attributes ["x:Name"];
- string name = attr.Value;
- string ns = GetNamespace (node);
- string member_type = node.LocalName;
-
- if (ns != null)
- member_type = String.Concat (ns, ".", member_type);
-
- CodeTypeReference type = new CodeTypeReference (member_type);
- if (ns != null)
- type.Options |= CodeTypeReferenceOptions.GlobalReference;
-
- res [name] = type;
- }
-
- return res;
- }
-
- /*
- private static Hashtable GetKeysAndTypes (XmlNode root, XmlNamespaceManager nsmgr)
- {
- Hashtable res = new Hashtable ();
-
- XmlNodeList keys = root.SelectNodes ("//*[@x:Key]", nsmgr);
- foreach (XmlNode node in keys) {
-
- // Don't take the root canvas
- if (node == root)
- continue;
-
- XmlAttribute attr = node.Attributes ["x:Key"];
- string key = attr.Value;
- string ns = GetNamespace (node);
- string member_type = node.LocalName;
-
- if (ns != null)
- member_type = String.Concat (ns, ".", member_type);
-
- res [key] = member_type;
- }
-
- return res;
- }
- */
-
- internal static string GetNamespace (XmlNode node)
- {
- if (!IsCustom (node.NamespaceURI))
- return null;
-
- return ParseNamespaceFromXmlns (node.NamespaceURI);
- }
-
- private static bool IsCustom (string ns)
- {
- switch (ns) {
- case "http://schemas.microsoft.com/winfx/2006/xaml":
- case "http://schemas.microsoft.com/winfx/2006/xaml/presentation":
- case "http://schemas.microsoft.com/client/2007":
- return false;
- }
-
- return true;
- }
-
- private static string ParseNamespaceFromXmlns (string xmlns)
- {
- string type_name = null;
- string ns = null;
- string asm = null;
-
- ParseXmlns (xmlns, out type_name, out ns, out asm);
-
- return ns;
- }
-
-// private static string ParseTypeFromXmlns (string xmlns)
-// {
-// string type_name = null;
-// string ns = null;
-// string asm = null;
-//
-// ParseXmlns (xmlns, out type_name, out ns, out asm);
-//
-// return type_name;
-// }
-
- internal static void ParseXmlns (string xmlns, out string type_name, out string ns, out string asm)
- {
- type_name = null;
- ns = null;
- asm = null;
-
- string [] decls = xmlns.Split (';');
- foreach (string decl in decls) {
- if (decl.StartsWith ("clr-namespace:")) {
- ns = decl.Substring (14, decl.Length - 14);
- continue;
- }
- if (decl.StartsWith ("assembly=")) {
- asm = decl.Substring (9, decl.Length - 9);
- continue;
- }
- int nsind = decl.LastIndexOf (".");
- if (nsind > 0) {
- ns = decl.Substring (0, nsind);
- type_name = decl.Substring (nsind + 1, decl.Length - nsind - 1);
- } else {
- type_name = decl;
- }
- }
- }
- }
-
-}