public void Setup()
        {
            var data = new StringBuilder();

            data.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");

            data.AppendLine("<project name=\"IglooCoder Commons\" default=\"basic\">");
            data.AppendLine("   <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
            data.AppendLine("   <property name=\"variable1\" value=\"hahaha\" />");

            data.AppendLine("   <echo value=\"something that is not a property or target\"/>");

            data.AppendLine("   <target name=\"test.run\">");
            data.AppendLine("       <exec basedir=\"${dir.base}\" workingdir=\"${dir.base}\" program=\"${tools.nunit.console}\" commandline=\"${dir.compile}\\${name.commons.tests} /xml:${dir.results.unittests}\\${output.results.unittests.name}\"/>");
            data.AppendLine("   </target>");
            data.AppendLine("   <target name=\"compile\">");
            data.AppendLine("       <exec basedir=\"${dir.base}\" workingdir=\"${dir.base}\" program=\"${tools.nunit.console}\" commandline=\"${dir.compile}\\${name.commons.tests} /xml:${dir.results.unittests}\\${output.results.unittests.name}\"/>");
            data.AppendLine("   </target>");

            data.AppendLine("</project>");

            XDocument doc = XDocument.Parse(data.ToString());

            _subject      = new NantBuildFileParser();
            _buildProject = _subject.ParseDocument(doc);
        }
Beispiel #2
0
        public void Generate()
        {
            var parser = new NantBuildFileParser();
            var mainDocument = XDocument.Load(_pathToNantFile);
            var rootDir = Path.GetDirectoryName(_pathToNantFile);

            foreach(var includes in mainDocument.Root.Elements("include"))
            {
                var xdocToInclude = XDocument.Load(rootDir + "\\" + includes.Attribute("buildfile").Value);
                foreach (var includeElement in xdocToInclude.Root.Elements())
                {
                    mainDocument.Root.AddFirst(includeElement);
                }
            }

            BuildProject buildProject = parser.ParseDocument(mainDocument);
            var outputGenerator = new OutputGenerator(buildProject);
            string output = outputGenerator.CreateOutput();
            using (var fs = new StreamWriter(_pathToOutputFile + "\\default.cs"))
            {
                fs.Write(output);
            }
        }
        public void Setup()
        {
            var data = new StringBuilder();
            data.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");

            data.AppendLine("<project name=\"IglooCoder Commons\" default=\"basic\">");
            data.AppendLine("   <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
            data.AppendLine("   <property name=\"variable1\" value=\"hahaha\" />");

            data.AppendLine("   <echo value=\"something that is not a property or target\"/>");

            data.AppendLine("   <target name=\"test.run\">");
            data.AppendLine("       <exec basedir=\"${dir.base}\" workingdir=\"${dir.base}\" program=\"${tools.nunit.console}\" commandline=\"${dir.compile}\\${name.commons.tests} /xml:${dir.results.unittests}\\${output.results.unittests.name}\"/>");
            data.AppendLine("   </target>");
            data.AppendLine("   <target name=\"compile\">");
            data.AppendLine("       <exec basedir=\"${dir.base}\" workingdir=\"${dir.base}\" program=\"${tools.nunit.console}\" commandline=\"${dir.compile}\\${name.commons.tests} /xml:${dir.results.unittests}\\${output.results.unittests.name}\"/>");
            data.AppendLine("   </target>");

            data.AppendLine("</project>");

            XDocument doc = XDocument.Parse(data.ToString());
            _subject = new NantBuildFileParser();
            _buildProject = _subject.ParseDocument(doc);
        }