From 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 11 Jul 2007 08:02:47 +0000 Subject: * Wiping trunk in prep for Sugilite --- Prebuild/src/Core/Targets/AutotoolsTarget.cs | 926 ----------------------- Prebuild/src/Core/Targets/DebugTarget.cs | 102 --- Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 458 ----------- Prebuild/src/Core/Targets/NAntTarget.cs | 621 --------------- Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 90 --- Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 437 ----------- Prebuild/src/Core/Targets/VS2002Target.cs | 96 --- Prebuild/src/Core/Targets/VS2003Target.cs | 633 ---------------- Prebuild/src/Core/Targets/VS2005Target.cs | 883 --------------------- 9 files changed, 4246 deletions(-) delete mode 100644 Prebuild/src/Core/Targets/AutotoolsTarget.cs delete mode 100644 Prebuild/src/Core/Targets/DebugTarget.cs delete mode 100644 Prebuild/src/Core/Targets/MonoDevelopTarget.cs delete mode 100644 Prebuild/src/Core/Targets/NAntTarget.cs delete mode 100644 Prebuild/src/Core/Targets/SharpDevelop2Target.cs delete mode 100644 Prebuild/src/Core/Targets/SharpDevelopTarget.cs delete mode 100644 Prebuild/src/Core/Targets/VS2002Target.cs delete mode 100644 Prebuild/src/Core/Targets/VS2003Target.cs delete mode 100644 Prebuild/src/Core/Targets/VS2005Target.cs (limited to 'Prebuild/src/Core/Targets') diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs deleted file mode 100644 index 2b4a678..0000000 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ /dev/null @@ -1,926 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2006 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -C.J. Adams-Collier (cjcollier@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ - * $Revision: 136 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Parse; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("autotools")] - public class AutotoolsTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; - ret += Path.Combine(project.Path, finalPath); - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - // int index = refr.Name.IndexOf(","); - // if ( index > 0) - // { - // ret += assem.Location; - // //Console.WriteLine("Location1: " + assem.Location); - // } - // else - // { - // ret += (refr.Name + ".dll"); - // //Console.WriteLine("Location2: " + assem.Location); - // } - //} - //else - //{ - int index = refr.Name.IndexOf(","); - if ( index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location3: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location4: " + assem.Location); - } - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - int index = refr.Name.IndexOf(","); - if ( index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location5: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location6: " + assem.Location); - } - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - - if(refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - if(path == null) - { - return ""; - } - - StringBuilder tmpPath; - - if (Core.Parse.Preprocessor.GetOS() == "Win32") - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath.Replace("/", @"\\"); - } - else - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); - } - return tmpPath.ToString(); - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - StreamWriter ss = new StreamWriter(projFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); - ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); - foreach(string file in project.Files) - { - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\tresgen "); - ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); - } - } - } - ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); - ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); - if (project.References.Count > 0) - { - ss.Write("\t\t/reference:"); - bool firstref = true; - foreach(ReferenceNode refr in project.References) - { - if (firstref) - { - firstref = false; - } - else - { - ss.Write(","); - } - ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); - } - ss.WriteLine(" \\"); - } - //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); - - foreach(string file in project.Files) - { - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.Write("\t\t/resource:"); - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\t\t/resource:"); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); - } - } - break; - } - } - - foreach(ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile !="") - { - ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); - break; - } - } - foreach(ConfigurationNode conf in project.Configurations) - { - if (conf.Options.AllowUnsafe) - { - ss.WriteLine("\t\t/unsafe \\"); - break; - } - } - if (project.AppIcon != "") - { - ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); - } - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); - break; - } - - foreach(ConfigurationNode conf in project.Configurations) - { - if (GetXmlDocFile(project, conf) !="") - { - ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); - break; - } - } - foreach(string file in project.Files) - { - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine("\t\t\\"); - ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); - break; - default: - break; - } - } - ss.WriteLine(); - ss.WriteLine(); - - if (project.Type == ProjectType.Library) - { - ss.WriteLine("install-data-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - ss.WriteLine("uninstall-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - } - ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); - ss.WriteLine("EXTRA_DIST = \\"); - ss.Write(" $(FILES)"); - foreach(ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.Write(" \\"); - ss.WriteLine("\t" + conf.Options.KeyFile); - } - break; - } - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - bool hasLibrary = false; - - private void WriteCombine(SolutionNode solution) - { - - /* TODO: These vars should be pulled from the prebuild.xml file */ - string releaseVersion = "2.0.0"; - string assemblyVersion = "2.1.0.0"; - string description = - "Tao Framework " + solution.Name + " Binding For .NET"; - - hasLibrary = false; - m_Kernel.Log.Write("Creating Autotools make files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - StreamWriter ss = new StreamWriter(combFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using(ss) - { - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - hasLibrary = true; - break; - } - } - - if (hasLibrary) - { - ss.Write("pkgconfig_in_files = "); - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); - ss.Write(" " + project.Name + ".pc.in "); - StreamWriter sspc = new StreamWriter(combFilepc); - sspc.NewLine = "\n"; - using(sspc) - { - sspc.WriteLine("prefix=@prefix@"); - sspc.WriteLine("exec_prefix=${prefix}"); - sspc.WriteLine("libdir=${exec_prefix}/lib"); - sspc.WriteLine(); - sspc.WriteLine("Name: @PACKAGE_NAME@"); - sspc.WriteLine("Description: @DESCRIPTION@"); - sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); - sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); - } - } - } - - ss.WriteLine(); - ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); - ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); - } - ss.WriteLine(); - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("-include x {0}", - Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); - } - ss.WriteLine(); - ss.WriteLine("all: \\"); - ss.Write("\t"); - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); - - } - ss.WriteLine(); - if (hasLibrary) - { - ss.WriteLine("EXTRA_DIST = \\"); - ss.WriteLine("\t$(pkgconfig_in_files)"); - } - else - { - ss.WriteLine("EXTRA_DIST = "); - } - ss.WriteLine(); - ss.WriteLine("DISTCLEANFILES = \\"); - ss.WriteLine("\tconfigure \\"); - ss.WriteLine("\tMakefile.in \\"); - ss.WriteLine("\taclocal.m4"); - } - combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - StreamWriter ts = new StreamWriter(combFile); - ts.NewLine = "\n"; - using(ts) - { - if (this.hasLibrary) - { - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); - break; - } - } - } - else - { - ts.WriteLine("AC_INIT(Makefile.am)"); - } - ts.WriteLine("AC_PREREQ(2.53)"); - ts.WriteLine("AC_CANONICAL_SYSTEM"); - - ts.WriteLine("PACKAGE_NAME={0}", solution.Name); - ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); - ts.WriteLine("DESCRIPTION=\"{0}\"", description); - ts.WriteLine("AC_SUBST(DESCRIPTION)"); - ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); - - ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); - ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); - - ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); - ts.WriteLine("AC_SUBST(PUBKEY)"); - - ts.WriteLine(); - ts.WriteLine("AM_MAINTAINER_MODE"); - ts.WriteLine(); - ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); - ts.WriteLine(); - ts.WriteLine("AC_PROG_INSTALL"); - ts.WriteLine(); - ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); - ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine("else"); - ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine(" else"); - ts.WriteLine(" from_cvs=no"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_RESULT($from_cvs)"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(MONO, mono)"); - ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for mono])"); - ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); - ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); - //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); - //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); - //ts.WriteLine("else"); - //ts.WriteLine(" AC_MSG_RESULT([found])"); - //ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(PATH)"); - ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); - ts.WriteLine(); - ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); - ts.WriteLine("CSFLAGS=\"\""); - ts.WriteLine("AC_SUBST(CSFLAGS)"); - ts.WriteLine(); - // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); - // ts.WriteLine("AC_ARG_ENABLE(sdl,"); - // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); - // ts.WriteLine(" [disable_sdl=$disableval],"); - // ts.WriteLine(" [disable_sdl=\"no\"])"); - // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); - // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); - // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); - // ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("dnl Find pkg-config"); - ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); - ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); - ts.WriteLine("BUILD_DIR=\"bin\""); - ts.WriteLine("AC_SUBST(BUILD_DIR)"); - ts.WriteLine("CONFIG=\"Release\""); - ts.WriteLine("AC_SUBST(CONFIG)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); - ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); - ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); - ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" else"); - ts.WriteLine(" LIB_PREFIX=.so"); - ts.WriteLine(" LIB_SUFFIX="); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); - ts.WriteLine(" if test x$CSC = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); - ts.WriteLine(" else"); - ts.WriteLine(" RUNTIME="); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(LIB_PREFIX)"); - ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); - ts.WriteLine(); - ts.WriteLine("dnl Find monodoc"); - ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); - ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); - ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); - ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); - ts.WriteLine(" if test x$MONODOC = xno; then"); - ts.WriteLine(" enable_monodoc=no"); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" MONODOC="); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(MONODOC)"); - ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); - ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); - ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); - ts.WriteLine("fi"); - ts.WriteLine(); - // foreach(ProjectNode project in solution.ProjectsTableOrder) - // { - // if (project.Type == ProjectType.Library) - // { - // } - // } - ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); - ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); - ts.WriteLine(); - ts.WriteLine("winbuild=no"); - ts.WriteLine("case \"$host\" in"); - ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); - ts.WriteLine(" winbuild=yes"); - ts.WriteLine(" ;;"); - ts.WriteLine("esac"); - ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); - ts.WriteLine(); - // ts.WriteLine("dnl Check for SDL"); - // ts.WriteLine(); - // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); - // ts.WriteLine("have_sdl=no"); - // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); - // ts.WriteLine(" have_sdl=yes"); - // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); - // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); - // ts.WriteLine(" #"); - // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); - // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); - // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); - // ts.WriteLine(" # version of the library also exists in SDL's library installation"); - // ts.WriteLine(" # directory, typically /usr/lib."); - // ts.WriteLine(" #"); - // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); - // ts.WriteLine("fi"); - // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); - // ts.WriteLine("AC_SUBST([SDL_LIBS])"); - ts.WriteLine(); - ts.WriteLine("AC_OUTPUT(["); - ts.WriteLine("Makefile"); - // TODO: this does not work quite right. - //ts.WriteLine("Properties/AssemblyInfo.cs"); - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine(project.Name + ".pc"); - } - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); - } - ts.WriteLine("])"); - ts.WriteLine(); - ts.WriteLine("#po/Makefile.in"); - ts.WriteLine(); - ts.WriteLine("echo \"---\""); - ts.WriteLine("echo \"Configuration summary\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \" * Installation prefix: $prefix\""); - ts.WriteLine("echo \" * compiler: $CSC\""); - ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); - ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); - ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); - ts.WriteLine("echo \" * Public Key: $PUBKEY\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \"---\""); - ts.WriteLine(); - } - - ts.NewLine = "\n"; - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.GenerateAssemblyInfoFile) - { - GenerateAssemblyInfoFile(solution, combFile); - } - } - } - - private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) - { - System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); - combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); - StreamWriter ai = new StreamWriter(combFile); - - using (ai) - { - ai.WriteLine("#region License"); - ai.WriteLine("/*"); - ai.WriteLine("MIT License"); - ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); - ai.WriteLine("http://www.taoframework.com"); - ai.WriteLine("All rights reserved."); - ai.WriteLine(""); - ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); - ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); - ai.WriteLine("in the Software without restriction, including without limitation the rights"); - ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); - ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); - ai.WriteLine("furnished to do so, subject to the following conditions:"); - ai.WriteLine(""); - ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); - ai.WriteLine("copies or substantial portions of the Software."); - ai.WriteLine(""); - ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); - ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); - ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); - ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); - ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); - ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); - ai.WriteLine("SOFTWARE."); - ai.WriteLine("*/"); - ai.WriteLine("#endregion License"); - ai.WriteLine(""); - ai.WriteLine("using System;"); - ai.WriteLine("using System.Reflection;"); - ai.WriteLine("using System.Runtime.InteropServices;"); - ai.WriteLine("using System.Security;"); - ai.WriteLine("using System.Security.Permissions;"); - ai.WriteLine(""); - ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); - ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); - ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); - ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); - ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); - ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); - ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); - ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); - ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: CLSCompliant(true)]"); - ai.WriteLine("[assembly: ComVisible(false)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); - - } - //return combFile; - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "autotools"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs deleted file mode 100644 index 6baa623..0000000 --- a/Prebuild/src/Core/Targets/DebugTarget.cs +++ /dev/null @@ -1,102 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ - * $Revision: 164 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; - -#if (DEBUG && _DEBUG_TARGET) -namespace Prebuild.Core.Targets -{ - [Target("debug")] - public class DebugTarget : ITarget - { -#region Fields - - private Kernel m_Kernel = null; - -#endregion - -#region ITarget Members - - public void Write() - { - foreach(SolutionNode s in m_Kernel.Solutions) - { - Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); - foreach(string file in s.Files) -{ - Console.WriteLine("\tFile [ {0} ]", file); -} - - foreach(ProjectNode proj in s.Projects) - { - Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); - foreach(string file in proj.Files) - Console.WriteLine("\t\tFile [ {0} ]", file); - } - } - } - - public void Clean() - { - Console.WriteLine("Not implemented"); - } - - public string Name - { - get - { - return "debug"; - } - } - - public Kernel Kernel - { - get - { - return m_Kernel; - } - set - { - m_Kernel = value; - } - } - -#endregion - } -} -#endif diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs deleted file mode 100644 index 8620e4b..0000000 --- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ /dev/null @@ -1,458 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $ - * $Revision: 206 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("monodev")] - public class MonoDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\""; - ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; - ret += " refto=\""; - try - { - //Assembly assem = Assembly.Load(refr.Name); - //ret += assem.FullName; - ret += refr.Name; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Mcs"; - string netRuntime = "Mono"; - if(project.Runtime == ClrRuntime.Microsoft) - { - csComp = "Csc"; - netRuntime = "MsNet"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.WriteLine(" ", conf.Name); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - ss.Write(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - int count = 0; - - using(ss) - { - ss.WriteLine("", solution.Name); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - count = 0; - - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "mdp")); - } - ss.WriteLine(" "); - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs deleted file mode 100644 index 0f0deb2..0000000 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ /dev/null @@ -1,621 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ - * $Revision: 205 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("nant")] - public class NAntTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} -// else -// { -// tmpPath = Helper.NormalizePath("./" + tmpPath); -// } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) - { - string ret = ""; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - - string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + ".dll", '/'); - - return finalPath; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - //ret += (refr.Name + ".dll"); - //} - //else - //{ - ret += (refr.Name + ".dll"); - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name + ".dll"; - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); - - return finalPath; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using(ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(string file in project.Files) - { - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); - ss.WriteLine(" " ); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - if (!String.IsNullOrEmpty(conf.Options.OutputPath)) - { - string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - break; - } - } - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating NAnt build files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using(ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - foreach(ConfigurationNode conf in solution.Configurations) - { - // Set the project.config to a non-debug configuration - if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) - { - ss.WriteLine(" ", conf.Name); - } - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "nant"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs deleted file mode 100644 index bc84b96..0000000 --- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs +++ /dev/null @@ -1,90 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev2")] - public class SharpDevelop2Target : VS2005Target - { - #region Private Methods - private void SetSharpDevelop2() - { - this.VersionName = "SharpDevelop2"; - } - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - SetSharpDevelop2(); - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - SetSharpDevelop2(); - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "sharpdev2"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs deleted file mode 100644 index c725730..0000000 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ /dev/null @@ -1,437 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ - * $Revision: 205 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; -using System.Reflection; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev")] - public class SharpDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\" refto=\""; - try - { - //Assembly assem = Assembly.Load(refr.Name); - ret += refr.Name;// assem.FullName; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Csc"; - string netRuntime = "MsNet"; - if(project.Runtime == ClrRuntime.Mono) - { - csComp = "Mcs"; - netRuntime = "Mono"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - ss.Write(" "); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.Write(" "); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using(ss) - { - ss.WriteLine("", solution.Name); - - int count = 0; - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "prjx")); - } - ss.WriteLine(" "); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs deleted file mode 100644 index 66216dc..0000000 --- a/Prebuild/src/Core/Targets/VS2002Target.cs +++ /dev/null @@ -1,96 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2002")] - public class VS2002Target : VS2003Target - { - #region Private Methods - - private void SetVS2002() - { - this.SolutionVersion = "7.00"; - this.ProductVersion = "7.0.9254"; - this.SchemaVersion = "1.0"; - this.VersionName = "2002"; - this.Version = VSVersion.VS70; - } - - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - SetVS2002(); - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - SetVS2002(); - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "vs2002"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs deleted file mode 100644 index b3236a8..0000000 --- a/Prebuild/src/Core/Targets/VS2003Target.cs +++ /dev/null @@ -1,633 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-09-29 21:11:40 +0200 (fr, 29 sep 2006) $ - * $Revision: 177 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public enum VSVersion - { - /// - /// - /// - VS70, - /// - /// - /// - VS71, - /// - /// - /// - VS80 - } - - /// - /// - /// - [Target("vs2003")] - public class VS2003Target : ITarget - { - - #region Fields - - string solutionVersion = "8.00"; - string productVersion = "7.10.3077"; - string schemaVersion = "2.0"; - string versionName = "2003"; - VSVersion version = VSVersion.VS71; - - Hashtable m_Tools; - Kernel m_Kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - protected string SolutionVersion - { - get - { - return this.solutionVersion; - } - set - { - this.solutionVersion = value; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - protected string ProductVersion - { - get - { - return this.productVersion; - } - set - { - this.productVersion = value; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - protected string SchemaVersion - { - get - { - return this.schemaVersion; - } - set - { - this.schemaVersion = value; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - protected string VersionName - { - get - { - return this.versionName; - } - set - { - this.versionName = value; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - protected VSVersion Version - { - get - { - return this.version; - } - set - { - this.version = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2003Target() - { - m_Tools = new Hashtable(); - - m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); - m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach(ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if(ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch(ArgumentException) - { - m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - IEnumerator enumerator; - //ConfigurationNode scripts; - - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}", toolInfo.XmlTag); - ps.WriteLine("\t\t\t\tProjectType = \"Local\""); - ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); - ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); - ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); - ps.WriteLine("\t\t>"); - - ps.WriteLine("\t\t\t\t"); - ps.WriteLine(" "); - - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine("\t\t\t\t "); - } - - ps.WriteLine(" "); - - ps.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach(string file in project.Files) - { - string fileName = file.Replace(".\\", ""); - ps.WriteLine(" "); - - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ps.WriteLine(" "); - - } - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - ps = new StreamWriter(projectFile + ".user"); - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}>", toolInfo.XmlTag); - ps.WriteLine(" "); - - ps.WriteLine(" ", MakeRefPath(project)); - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false - // { - // return string.Empty; - // } - - //default to "AssemblyName.xml" - //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - //return (string)conf.Options["XmlDocFile", defaultValue]; - - //default to no XmlDocFile file - return (string)conf.Options["XmlDocFile", ""]; - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); - - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using(ss) - { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - foreach(ProjectNode project in solution.Projects) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", - toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, - toolInfo.FileExtension), project.Guid.ToString().ToUpper()); - - ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); - ss.WriteLine("\tEndProjectSection"); - - ss.WriteLine("EndProject"); - } - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - for(int i = 0; i < project.References.Count; i++) - { - ReferenceNode refr = (ReferenceNode)project.References[i]; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; - ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", - project.Guid.ToString().ToUpper() - , i, - refProject.Guid.ToString().ToUpper() - ); - } - } - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - } - } - ss.WriteLine("\tEndGlobalSection"); - - if(solution.Files != null) - { - ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); - foreach(string file in solution.Files) - { - ss.WriteLine("\t\t{0} = {0}", file); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("EndGlobal"); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - WriteSolution(sol); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public virtual string Name - { - get - { - return "vs2003"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs deleted file mode 100644 index 23b6116..0000000 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ /dev/null @@ -1,883 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: robloach $ - * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ - * $Revision: 207 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public struct ToolInfo - { - string name; - string guid; - string fileExtension; - string xmlTag; - string importProject; - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - /// - /// Gets or sets the GUID. - /// - /// The GUID. - public string Guid - { - get - { - return guid; - } - set - { - guid = value; - } - } - - /// - /// Gets or sets the file extension. - /// - /// The file extension. - public string FileExtension - { - get - { - return fileExtension; - } - set - { - fileExtension = value; - } - } - /// - /// Gets or sets the XML tag. - /// - /// The XML tag. - public string XmlTag - { - get - { - return xmlTag; - } - set - { - xmlTag = value; - } - } - - /// - /// Gets or sets the import project property. - /// - /// The ImportProject tag. - public string ImportProject - { - get - { - return importProject; - } - set - { - importProject = value; - } - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - /// The import project. - public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = importProject; - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - public ToolInfo(string name, string guid, string fileExtension, string xml) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// true if toolInfos are equal - public override bool Equals(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - if (obj.GetType() != typeof(ToolInfo)) - return false; - - ToolInfo c = (ToolInfo)obj; - return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are equal - public static bool operator ==(ToolInfo c1, ToolInfo c2) - { - return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); - } - - /// - /// Not equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are not equal - public static bool operator !=(ToolInfo c1, ToolInfo c2) - { - return !(c1 == c2); - } - - /// - /// Hash Code - /// - /// Hash code - public override int GetHashCode() - { - return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); - - } - } - - /// - /// - /// - [Target("vs2005")] - public class VS2005Target : ITarget - { - #region Inner Classes - - #endregion - - #region Fields - - string solutionVersion = "9.00"; - string productVersion = "8.0.50727"; - string schemaVersion = "2.0"; - string versionName = "Visual C# 2005"; - VSVersion version = VSVersion.VS80; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - protected string SolutionVersion - { - get - { - return this.solutionVersion; - } - set - { - this.solutionVersion = value; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - protected string ProductVersion - { - get - { - return this.productVersion; - } - set - { - this.productVersion = value; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - protected string SchemaVersion - { - get - { - return this.schemaVersion; - } - set - { - this.schemaVersion = value; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - protected string VersionName - { - get - { - return this.versionName; - } - set - { - this.versionName = value; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - protected VSVersion Version - { - get - { - return this.version; - } - set - { - this.version = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2005Target() - { - this.tools = new Hashtable(); - - this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if (ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch (ArgumentException) - { - this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - #region Project File - using (ps) - { - ps.WriteLine(""); - //ps.WriteLine(" <{0}", toolInfo.XMLTag); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" {0}", this.SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); - - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - //ps.WriteLine(" "); - - //ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); - break; - } - } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - - //if(m_Version == VSVersion.VS70) - // ps.WriteLine(" NoStandardLibraries = \"false\""); - - ps.WriteLine(" {0}", project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - //ps.WriteLine(" >"); - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" ", conf.Name); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); - ps.WriteLine(" {0}", conf.Options["XmlDocFile"]); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - // ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" "); - } - - //ps.WriteLine(" "); - - // Assembly References - ps.WriteLine(" "); - string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; - - foreach (ReferenceNode refr in project.References) - { - if (!solution.ProjectsTable.ContainsKey(refr.Name)) - { - ps.Write(" "); - - string path; - - if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) - { - path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); - } - else - { - path = refr.Name + ".dll"; - } - - // TODO: Allow reference to *.exe files - ps.WriteLine(" {0}", path ); - ps.WriteLine(" {0}", refr.LocalCopy); - ps.WriteLine(" "); - } - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; - // TODO: Allow reference to visual basic projects - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); - ps.WriteLine(" ", path ); - // - ps.WriteLine(" {0}", refProject.Name); - // RealmForge.Utility - ps.WriteLine(" {{{0}}}", refProject.Guid.ToString().ToUpper()); - // {6880D1D3-69EE-461B-B841-5319845B20D3} - ps.WriteLine(" {0}", toolInfo.Guid.ToString().ToUpper()); - // {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - ps.WriteLine("\t\t\t{0}", refr.LocalCopy); - ps.WriteLine(" "); - // - } - else - { - } - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ArrayList list = new ArrayList(); - foreach (string file in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - int slash = file.LastIndexOf('\\'); - if (slash == -1) - { - ps.WriteLine(" {0}", file); - } - else - { - ps.WriteLine(" {0}", file.Substring(slash + 1, file.Length - slash - 1)); - } - ps.WriteLine(" Designer"); - ps.WriteLine(" "); - // - } - - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" " + project.Files.GetSubType(file) + ""); - ps.WriteLine(" ResXFileCodeGenerator"); - ps.WriteLine(" Resources.Designer.cs"); - ps.WriteLine(" "); - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - ps.WriteLine(" Resources.resx"); - ps.WriteLine(" "); - list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); - } - if (project.Files.GetSubType(file).ToString() == "Settings") - { - //Console.WriteLine("File: " + file); - //Console.WriteLine("Last index: " + file.LastIndexOf('.')); - //Console.WriteLine("Length: " + file.Length); - ps.Write(" <{0} ", project.Files.GetBuildAction(file)); - ps.WriteLine("Include=\"{0}\">", file); - int slash = file.LastIndexOf('\\'); - string fileName = file.Substring(slash + 1, file.Length - slash - 1); - if (project.Files.GetBuildAction(file) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - - //Console.WriteLine("FileName: " + fileName); - //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); - //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); - if (slash == -1) - { - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - } - else - { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", fileNameShorter + ".settings"); - } - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - else if (project.Files.GetSubType(file) != SubType.Designer) - { - if (!list.Contains(file)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(file)); - ps.WriteLine("Include=\"{0}\">", file); - - - if (file.Contains("Designer.cs")) - { - ps.WriteLine(" {0}", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); - } - - if (project.Files.GetIsLink(file)) - { - ps.WriteLine(" {0}", Path.GetFileName(file)); - } - else if (project.Files.GetBuildAction(file) != BuildAction.None) - { - if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) - { - ps.WriteLine(" {0}", project.Files.GetSubType(file)); - } - } - if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - } - } - // ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - // ps.WriteLine(" ", toolInfo.XMLTag); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - - - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - - if (projectFile.Contains( "OpenSim.csproj" )) - { - ps.WriteLine(" -loginserver -sandbox -accounts"); - } - - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution) - { - kernel.Log.Write("Creating {0} solution and project files", this.VersionName); - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using (ss) - { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - ss.WriteLine("# Visual Studio 2005"); - foreach (ProjectNode project in solution.Projects) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", - toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, - toolInfo.FileExtension), project.Guid.ToString().ToUpper()); - - //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); - //ss.WriteLine(" EndProjectSection"); - - ss.WriteLine("EndProject"); - } - - if (solution.Files != null) - { - ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); - ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); - foreach (string file in solution.Files) - ss.WriteLine("\t\t{0} = {0}", file); - ss.WriteLine("\tEndProjectSection"); - ss.WriteLine("EndProject"); - } - - ss.WriteLine("Global"); - - ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); - } - ss.WriteLine(" EndGlobalSection"); - - if (solution.Projects.Count > 1) - { - ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); - } - foreach (ProjectNode project in solution.Projects) - { - for (int i = 0; i < project.References.Count; i++) - { - ReferenceNode refr = (ReferenceNode)project.References[i]; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; - ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", - project.Guid.ToString().ToUpper() - , i, - refProject.Guid.ToString().ToUpper() - ); - } - } - } - if (solution.Projects.Count > 1) - { - ss.WriteLine(" EndGlobalSection"); - } - ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", - project.Guid.ToString().ToUpper(), - conf.Name); - - ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", - project.Guid.ToString().ToUpper(), - conf.Name); - } - } - ss.WriteLine(" EndGlobalSection"); - ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); - ss.WriteLine(" HideSolutionNode = FALSE"); - ss.WriteLine(" EndGlobalSection"); - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public virtual string Name - { - get - { - return "vs2005"; - } - } - - #endregion - } -} -- cgit v1.1