Beispiel #1
0
        public void WriteStartSolution(Solution solution)
        {
            this.solution = solution;

            //writer.WriteStartDocument();

            writer.WriteComment(" Generated by SLiNgshoT <http://injektilo.org/> ");
            if (isReplaceRefs)
            {
                writer.WriteComment(string.Format(" with parameter replacerefs={0} ", parameters[REPLACEREFS]));
            }

            writer.WriteStartElement("project");
            writer.WriteAttributeString("name", solution.SolutionName);
            writer.WriteAttributeString("default", "Debug");

            WriteProperty("build.basedir", (string)parameters["build.basedir"]);
            //      WriteProperty("reference.path", (string)parameters["reference.path"]);

            foreach (string configurationName in solution.GetConfigurationNames())
            {
                writer.WriteStartElement("target");
                writer.WriteAttributeString("name", Configuration.NantName(configurationName));

                string depends = Configuration.NantName(configurationName) + ".CopyRefs";

                foreach (Project project in solution.GetProjects())
                {
                    Configuration configuration = project.GetConfiguration(configurationName);

                    if (configuration != null)
                    {
                        if (depends != null)
                        {
                            depends += ",";
                        }
                        depends += project.Name + "." + Configuration.NantName(configurationName);
                    }
                }

                writer.WriteAttributeString("depends", depends);

                writer.WriteEndElement(); // target
            }

            WriteSetupTarget();
            WriteCopyRefsTargets(solution);      // 2003-04-18 jean rajotte
        }
        public void WriteStartSolution(Solution solution)
        {
            writer.WriteLine("# Generated by SLiNgshoT <http://injektilo.org/>");
            writer.WriteLine();

            writer.WriteLine("!IFNDEF CFG");
            writer.WriteLine();

            writer.WriteLine("CFG = Debug");

            writer.WriteLine();
            writer.WriteLine("!ENDIF");
            writer.WriteLine();

            bool firstConfig = true;

            foreach (string configurationName in solution.GetConfigurationNames())
            {
                if (firstConfig)
                {
                    writer.Write("!IF");
                    firstConfig = false;
                }
                else
                {
                    writer.Write("!ELSE IF");
                }

                writer.WriteLine(" \"$(CFG)\" == \"{0}\"", configurationName);
                writer.WriteLine();

                foreach (Project project in solution.GetProjects())
                {
                    Configuration configuration = project.GetConfiguration(configurationName);

                    writer.WriteLine(
                        GetProjectName(project) +
                        "_DIRECTORY = " +
                        Path.GetDirectoryName(project.GetRelativeOutputPathForConfiguration(configurationName)));

                    writer.WriteLine(
                        GetProjectName(project) +
                        " = $(" + GetProjectName(project) + "_DIRECTORY)\\" +
                        Path.GetFileName(project.GetRelativeOutputPathForConfiguration(configurationName)));

                    writer.WriteLine(
                        GetProjectName(project) +
                        "_DEBUG = /debug" +
                        (configuration.DebugSymbols ? "+" : "-"));

                    writer.WriteLine(
                        GetProjectName(project) +
                        "_UNSAFE = /unsafe" +
                        (configuration.AllowUnsafeBlocks ? "+" : "-"));

                    writer.Write(GetProjectName(project) + "_DEFINES =");

                    string defineConstants = configuration.DefineConstants;

                    if (defineConstants != null && defineConstants.Length > 0)
                    {
                        writer.Write(" /define:" + defineConstants);
                    }

                    writer.WriteLine();

                    string documentationFile = Path.GetFileName(project.GetRelativePathToDocumentationFile(configurationName));

                    if (documentationFile != null && documentationFile.Length > 0)
                    {
                        writer.WriteLine(
                            GetProjectName(project) +
                            "_DOC = /doc:$(" +
                            GetProjectName(project) +
                            "_DIRECTORY)\\" +
                            documentationFile);
                    }
                    else
                    {
                        writer.WriteLine("{0}_DOC =", GetProjectName(project));
                    }

                    writer.WriteLine();
                }
            }

            writer.WriteLine("!ENDIF");
            writer.WriteLine();

            writer.Write("all:");

            foreach (Project project in solution.GetProjects())
            {
                if (project.CountFiles("Compile") > 0)
                {
                    writer.Write(" $(" + GetProjectName(project) + ")");
                }
            }

            writer.WriteLine();
            writer.WriteLine();
        }