Example #1
0
        /// <summary>
        /// Create the targets that copy 'local copy' references to the build dir
        /// </summary>
        /// <param name="solution">the solution being analyzed</param>
        private void WriteCopyRefsTargets(Solution solution)
        {
            // copy the 'copy local' references to the build directory
            ArrayList referenceNames = new ArrayList();

            // get a unique list
            foreach (Project project in solution.GetProjects())
            {
                if (project.CountFiles("Compile") > 0)
                {
                    foreach (Reference reference in project.GetReferences())
                    {
                        if (!referenceNames.Contains(reference.Value))
                        {
                            referenceNames.Add(reference.Value);
                        }
                    }
                }
            }
            // create the copy targets
            foreach (string configurationName in solution.GetConfigurationNames())
            {
                writer.WriteStartElement("target");
                writer.WriteAttributeString("name", string.Concat(Configuration.NantName(configurationName), ".CopyRefs"));
                WriteProperty("build.dir", "${build.basedir}\\" + Configuration.NantName(configurationName));
                foreach (string referenceName in referenceNames)
                {
                    writeCopyRef(referenceName, configurationName);
                }
                writer.WriteEndElement(); // target
            }
        }
Example #2
0
 public void WriteStartCleanTarget()
 {
     foreach (string referenceName in solution.GetConfigurationNames())
     {
         writeCleanup("Clean." + referenceName, referenceName, "dynamically created from configurations");
     }
     writeCleanup("DebugClean", "Debug", "hardcoded for backwards compatibility");
     writeCleanup("ReleaseClean", "Release", "hardcoded for backwards compatibility");
     writer.WriteStartElement("target");
     writer.WriteAttributeString("name", "Clean");
 }
Example #3
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
        }
Example #4
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
        }
Example #5
0
        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();
        }
Example #6
0
        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();
        }
Example #7
0
 /// <summary>
 /// Create the targets that copy 'local copy' references to the build dir
 /// </summary>
 /// <param name="solution">the solution being analyzed</param>
 private void WriteCopyRefsTargets( Solution solution ) {
     // copy the 'copy local' references to the build directory
     ArrayList referenceNames = new ArrayList();
     // get a unique list
     foreach (Project project in solution.GetProjects()) {
         if (project.CountFiles("Compile") > 0) {
             foreach (Reference reference in project.GetReferences()) {
                 if ( !referenceNames.Contains( reference.Value ) ) {
                     referenceNames.Add( reference.Value );
                 }
             }
         }
     }
     // create the copy targets
     foreach (string configurationName in solution.GetConfigurationNames()) {
         writer.WriteStartElement("target");
         writer.WriteAttributeString("name", string.Concat( Configuration.NantName( configurationName), ".CopyRefs")  );
         WriteProperty("build.dir", "${build.basedir}\\" + Configuration.NantName( configurationName ));
         foreach ( string referenceName in referenceNames ) {
             writeCopyRef( referenceName, configurationName );
         }
         writer.WriteEndElement(); // target
     }
 }