Beispiel #1
0
 public void WriteCleanProject(Project project) {
     writer.WriteLine("\trd /s /q $({0}_DIRECTORY)", GetProjectName(project));
 }
Beispiel #2
0
 private string GetProjectName(Project project) {
     return project.Name.Replace('.', '_').ToUpper();
 }
Beispiel #3
0
 public void WriteReference(Project project) {
     writer.Write(" /reference:$(" + GetProjectName(project) + ")");
 }
Beispiel #4
0
 public void WriteCopyProjectAssembly(Project project) {
     writer.WriteLine(
         "\tcopy $({0}) $({1}_DIRECTORY)",
         GetProjectName(project),
         GetProjectName(this.project));
 }
Beispiel #5
0
        /// <summary>Gets all the dependencies of the specified
        /// <paramref name="source"/> project including referenced
        /// projects.</summary>
        /// <param name="source">The source project.</param>
        /// <returns>An ArrayList of projects.</returns>
        public ArrayList GetAllDependencies(Project source) {
            ArrayList dependencies = GetDependencies(source);

            foreach (Reference reference in source.GetReferences()) {
                if (reference.Type == "Project") {
                    Project target = GetProject(reference.Value);

                    if (!dependencies.Contains(target)) {
                        dependencies.Add(target);
                    }
                }
            }

            return dependencies;
        }
Beispiel #6
0
 public void WriteStartProjectNonResXResourceFiles(Project project) {
 }
Beispiel #7
0
 internal File(Project project, XPathNavigator navigator) {
     _Project = project;
     _Navigator = navigator.Clone();
 }
Beispiel #8
0
        /// <summary>Returns <see langword="true"/> if the specified
        /// <paramref name="source"/> project depends on the
        /// specified <paramref name="target"/> project.</summary>
        /// <param name="source">The source project.</param>
        /// <param name="target">The target project.</param>
        /// <returns><see langword="true"/> or <see langword="false"/>.</returns>
        public bool IsDependant(Project source, Project target) {
            bool result = false;

            ArrayList dependencies = _Dependencies[source.ID] as ArrayList;

            if (dependencies != null && dependencies.Contains(target)) {
                result = true;
            }
            else if (dependencies != null) {
                foreach (Project project in dependencies) {
                    if (IsDependant(source, project)) {
                        result = true;
                        break;
                    }
                }
            }

            return result;
        }
Beispiel #9
0
 public void WriteCopyProjectAssembly(Project project) {
     //writer.WriteStartElement("includes");
     //writer.WriteAttributeString("name", project.Name);
     //writer.WriteEndElement(); // includes
 }
Beispiel #10
0
        public void WriteCleanProject(Project project) {
            writer.WriteStartElement("delete");
            writer.WriteAttributeString("file", "${build.dir}\\" + project.OutputFile);
            writer.WriteAttributeString("failonerror", "false");
            writer.WriteEndElement(); // delete

            writer.WriteStartElement("delete");
            writer.WriteAttributeString("file", "${build.dir}\\" + project.AssemblyName + ".pdb");
            writer.WriteAttributeString("failonerror", "false");
            writer.WriteEndElement(); // delete

            foreach (File file in project.GetResXResourceFiles()) {
                string path =
                    project.RootNamespace +
                    "." +
                    Path.GetFileNameWithoutExtension(file.RelativePath) +
                    ".resources";

                writer.WriteStartElement("delete");
                writer.WriteAttributeString("file", "${build.dir}\\" + path);
                writer.WriteAttributeString("failonerror", "false");
                writer.WriteEndElement(); // delete
            }

            foreach (File file in project.GetNonResXResourceFiles()) {
                writer.WriteStartElement("delete");
                writer.WriteAttributeString("file", file.RelativePathFromSolutionDirectory + file.ResourceName);
                writer.WriteAttributeString("failonerror", "false");
                writer.WriteEndElement(); // delete
            }
        }
Beispiel #11
0
 public void WriteReference(Project project) {
     writer.WriteStartElement("includes");
     writer.WriteAttributeString("name", "${build.dir}\\" + project.OutputFile);
     writer.WriteEndElement(); // includes
 }
Beispiel #12
0
 public void WriteProjectDependency(Project project) {
     //depends += "," + project.Name;
 }
Beispiel #13
0
        public void WriteStartProject(Project project) {
            this.project = project;

            foreach (Configuration configuration in project.GetConfigurations()) {
                writer.WriteStartElement("target");
                writer.WriteAttributeString("name", project.Name + "." + Configuration.NantName( configuration.Name ));
                depends = null;
                foreach (Project dependency in solution.GetDependencies(project)) {
                    if (depends != null) {
                        depends += ",";
                    }
                    depends += dependency.Name + "." + Configuration.NantName( configuration.Name );
                }
                foreach (Project projectReference in project.GetReferencedProjects()) {
                    if (depends != null) {
                        depends += ",";
                    }
                    depends += projectReference.Name + "." + Configuration.NantName( configuration.Name );
                }
                if (depends != null) {
                    writer.WriteAttributeString("depends", depends);
                }

                WriteProperty("project.name", project.Name);
                WriteProperty("build.dir", "${build.basedir}\\" + Configuration.NantName( configuration.Name ));
                WriteProperty( "slingshot.config", configuration.Name );

                //WriteProperty("directory", Path.GetDirectoryName(project.GetRelativeOutputPathForConfiguration(configuration.Name)));
                WriteProperty("output", "${build.dir}\\" + Path.GetFileName(project.GetRelativeOutputPathForConfiguration(configuration.Name)));
                WriteProperty("debug", configuration.DebugSymbols ? "true" : "false");


                WriteProperty("unsafe", configuration.AllowUnsafeBlocks ? "true" : "false");
                WriteProperty("checked", configuration.CheckForOverflowUnderflow ? "true" : "false");

                WriteProperty("define", configuration.DefineConstants);

                string documentationFile = Path.GetFileName(project.GetRelativePathToDocumentationFile(configuration.Name));

                if (documentationFile != null && documentationFile.Length != 0) {
                    WriteProperty("doc", "${build.dir}\\" + Path.GetFileName(project.GetRelativePathToDocumentationFile(configuration.Name)));
                }
                WriteProperty( "warninglevel", configuration.WarningLevel );
                writer.WriteStartElement("call");
                writer.WriteAttributeString("target", project.Name);
                writer.WriteEndElement(); // call

                writer.WriteEndElement(); // target
            }

            writer.WriteStartElement("target");
            writer.WriteAttributeString("name", project.Name);
        }
Beispiel #14
0
        private void AddProject(string projectLine) {
            string pattern = @"^Project\(""(?<unknown>\S+)""\) = ""(?<name>\S+)"", ""(?<path>\S+)"", ""(?<id>\S+)""";
            Regex regex = new Regex(pattern);
            Match match = regex.Match(projectLine);

            if (match.Success) {
                string unknown = match.Groups["unknown"].Value;
                string name = match.Groups["name"].Value;
                string path = match.Groups["path"].Value;
                string id = match.Groups["id"].Value;

                path = ResolvePath(path);

                if (unknown == commonProjectId) {
                    Project project = new Project(this, new Guid(id), name);

                    string absoluteProjectPath = Path.Combine(SolutionDirectory, path);
                    project.Read(absoluteProjectPath);

                    string relativeProjectPath = Path.GetDirectoryName(path);
                    project.RelativePath = relativeProjectPath;

                    if (project.ProjectType == "C# Local" ||
                        project.ProjectType == "C# Web" ||
                        project.ProjectType == "VB Local" ||
                        project.ProjectType == "VB Web") {
                        _Projects.Add(project.ID, project);
                    }
                } 
                else if (unknown == enterproseProjectId) {
                    EnterpriseProject etpProject = new EnterpriseProject(this, new Guid(id), name);
                    string absoluteProjectPath = Path.Combine(SolutionDirectory, path);
                    etpProject.Read(absoluteProjectPath);

                    // get the list of projects from enterprise projects
                    foreach(Project project in etpProject.GetProjects()) {
                        _Projects.Add(project.ID, project);
                    }
                }
            }
        }
Beispiel #15
0
        public void WriteStartProjectNonResXResourceFiles(Project project) {
            this.project = project;

            writer.Write("{0}_RESOURCE_FILES =", GetProjectName(project));
        }
Beispiel #16
0
        private void AddDependency(Project source, Project target) {
            ArrayList dependencies = _Dependencies[source.ID] as ArrayList;

            if (dependencies == null) {
                dependencies = new ArrayList();
                _Dependencies.Add(source.ID, dependencies);
            }
            else if (!dependencies.Contains(target)) {
                dependencies.Add(target);
            }
        }
Beispiel #17
0
        public void WriteStartProject(Project project) {
            this.project = project;

            writer.Write("$(" + GetProjectName(project) + "):");
        }
Beispiel #18
0
        /// <summary>Gets a list of the projects that the
        /// <paramref name="source"/> project depends on.</summary>
        /// <param name="source">The source project.</param>
        /// <returns>An ArrayList of projects.</returns>
        public ArrayList GetDependencies(Project source) {
            ArrayList result = null;

            ArrayList dependencies = _Dependencies[source.ID] as ArrayList;

            if (dependencies == null) {
                result = new ArrayList();
            }
            else {
                result = dependencies;
            }

            return result;
        }
Beispiel #19
0
 public void WriteProjectDependency(Project project) {
     writer.Write(" $(" + GetProjectName(project) + ")");
 }
Beispiel #20
0
        public IList GetProjects() {
            if (_Projects == null) {
                _Projects = new ArrayList();

                foreach (string file in GetFiles()) {
                    string extension = Path.GetExtension(file);

                    if (extension == ".csproj" || extension == ".vcproj") {
                        string name = Path.GetFileNameWithoutExtension(file);
                        string id = GetReferenceID(file);
                        string path = _Solution.ResolvePath(file);

                        Project project = new Project(_Solution, new Guid(id), name);

                        string absoluteProjectPath = Path.Combine(_RelativePath, path);
                        project.Read(absoluteProjectPath);

                        string relativeProjectPath = Path.GetDirectoryName(absoluteProjectPath);
                        project.RelativePath = relativeProjectPath;

                        if (project.ProjectType == "C# Local" ||
                            project.ProjectType == "C# Web") {
                            _Projects.Add(project);
                        }
                    }
                }

                foreach (EnterpriseProject project in _SubProjects) {
                    _Projects.AddRange(project.GetProjects());
                }
            }

            return _Projects;
        }
Beispiel #21
0
 public void WriteStartProjectSourceFiles(Project project) {
 }