Esempio n. 1
0
        public override void ParseBuildResult(Project parentProject)
        {
            base.ParseBuildResult(parentProject);

            ParseProjectFile(FullProjectConfiguration, parentProject);

            if (string.IsNullOrEmpty(TargetPath))
            {
                return;
            }

            if (IsAssembly)
            {
                Assembly asm = AssemblyUtils.GetCachedReflectionAssembly(GetFullPath(TargetPath));
                TargetAssembly = new AssemblyReference(asm.FullName, ProjectOutput[TargetPath]);

                foreach (Module m in asm.GetModules(true))
                {
                    string file = EnsureRelativePath(m.FullyQualifiedName);

                    if (!ProjectOutput.Contains(file))
                    {
                        ProjectOutput.Add(new TargetItem(file, file, TargetType.Item));
                    }
                }

                ResolveAdditionalOutput(asm);
            }
        }
Esempio n. 2
0
        private void AddItem(bool local, TargetType type, ITaskItem item)
        {
            string path = item.ItemSpec;

            string src    = EnsureRelativePath(path);
            string target = (item != null) ? EnsureRelativePath(CalculateTarget(item)) : src;

            if (!ProjectOutput.ContainsKey(target))
            {
                ProjectOutput.Add(new TargetItem(target, src, local ? type : (TargetType)((int)type | 0x10)));
            }
        }
        public async Task <IActionResult> PostProjectOutput([FromBody] ProjectOutput projectOutput)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var editedProjectOutput = projectOutput;

            editedProjectOutput.CreatedUserId = 1;
            editedProjectOutput.IsActual      = true;
            editedProjectOutput.Remark        = "remark";

            var workFlowId = projectOutput.workFlowId;

            if (workFlowId.HasValue)
            {
                projectOutput.IsActual = false;

                var serviceWorkflow = _context.ServiceWorkflow.First(s => s.ServiceWorkflowId == workFlowId);
                serviceWorkflow.NextStepId            = 18;
                _context.Entry(serviceWorkflow).State = EntityState.Modified;
            }

            var projectId = projectOutput.ProjectId;
            var project   = _context.Project.First(p => p.ProjectId == projectId);

            //project.IsActive = true;
            _context.Entry(project).State = EntityState.Modified;

            _context.ProjectOutput.Add(editedProjectOutput);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProjectOutput", projectOutput));
            //ProjectOutput output = projectOutput;
            //output.CreatedUserId = 1;
            //output.IsActual = true;

            //int projectId = projectOutput.ProjectId;
            //Project project = _context.Project.First(p => p.ProjectId == projectId);
            //project.IsActive = true;
            //_context.Entry(project).State = EntityState.Modified;

            //_context.ProjectOutput.Add(output);
            //await _context.SaveChangesAsync();

            //return CreatedAtAction("GetProjectOutput", new { id = projectOutput.ProjectOutputId }, projectOutput);
        }
Esempio n. 4
0
        public virtual void PostParseBuildResult()
        {
            if (string.IsNullOrEmpty(TargetPath) || string.IsNullOrEmpty(ProjectPath))
            {
                return;
            }

            if ((DebugSrc == null) || (DebugId == null))
            {
                string targetFile = GetFullPath(TargetPath);

                if (QQnPath.IsAssemblyFile(targetFile) && File.Exists(targetFile))
                {
                    DebugReference reference = AssemblyUtils.GetDebugReference(targetFile);

                    if (reference != null)
                    {
                        string   pdbSrc    = EnsureRelativePath(QQnPath.Combine(ProjectPath, Path.GetDirectoryName(TargetPath), reference.PdbFile));
                        FileInfo pdbTarget = new FileInfo(Path.GetFullPath(QQnPath.Combine(ProjectPath, Path.GetDirectoryName(TargetPath), Path.GetFileName(pdbSrc))));

                        if (pdbTarget.Exists)
                        {
                            FileInfo pdbFrom = new FileInfo(GetFullPath(pdbSrc));

                            if (!pdbFrom.Exists || ((pdbFrom.Length == pdbTarget.Length) && (pdbFrom.LastWriteTime == pdbTarget.LastWriteTime)))
                            {
                                pdbSrc = EnsureRelativePath(pdbTarget.FullName);
                            }
                        }

                        DebugSrc = pdbSrc;
                        DebugId  = reference.DebugId;
                    }
                    else
                    {
                        string pdbFile = Path.ChangeExtension(targetFile, ".pdb");

                        if (ProjectOutput.ContainsKey(pdbFile) && File.Exists(pdbFile))
                        {
                            pdbFile = EnsureRelativePath(pdbFile);

                            DebugSrc = pdbFile;
                        }
                    }
                }
            }
        }
        public async Task <IActionResult> PutProjectOutput([FromRoute] int id, [FromBody] ProjectOutput projectOutput)
        {
            //if (!ModelState.IsValid)
            //{
            //  return BadRequest(ModelState);
            //}

            //if (id != projectOutput.ProjectOutputId)
            //{
            //  return BadRequest();
            //}

            var output = projectOutput;

            output.CreatedUserId   = 1;
            output.IsActual        = false;
            output.IsActive        = true;
            output.ProjectOutputId = id;

            var projectId = projectOutput.ProjectId;
            var project   = _context.Project.First(p => p.ProjectId == projectId);

            project.IsActive = true;
            _context.Entry(project).State = EntityState.Modified;

            _context.Entry(output).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetProjectOutput", output));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectOutputExists(id))
                {
                    return(NotFound());
                }
                throw;
            }

            return(NoContent());
        }
Esempio n. 6
0
        public FileMapping([NotNull] ProjectOutput projectOutput, [NotNull] ObservableCollection <ProjectOutput> allUnmappedProjectOutputs, [NotNull] WixProject wixProject, [NotNull] ObservableCollection <UnmappedFile> allUnmappedFiles)
        {
            Contract.Requires(projectOutput != null);
            Contract.Requires(wixProject != null);
            Contract.Requires(allUnmappedFiles != null);

            _projectOutput             = projectOutput;
            _allUnmappedProjectOutputs = allUnmappedProjectOutputs;
            _wixProject       = wixProject;
            _allUnmappedFiles = allUnmappedFiles;

            _id = wixProject.GetFileId(TargetName);

            MappedNode = wixProject.FileNodes.FirstOrDefault(node => node.Id == _id);

            _unmappedProjectOutputs = new ObservableFilteredCollection <ProjectOutput>(_allUnmappedProjectOutputs, item => string.Equals(item.FileName, DisplayName, StringComparison.OrdinalIgnoreCase));
            _unmappedProjectOutputs.CollectionChanged += UnmappedProjectOutputs_CollectionChanged;

            _unmappedFiles = new ObservableFilteredCollection <UnmappedFile>(allUnmappedFiles, item => string.Equals(item.Node.Name, DisplayName, StringComparison.OrdinalIgnoreCase));
            _unmappedFiles.CollectionChanged += UnmappedNodes_CollectionChanged;

            UpdateMappingState();
        }
Esempio n. 7
0
 /// <summary>
 /// Writes the project output.
 /// </summary>
 /// <param name="xw">The xw.</param>
 /// <param name="forReadability">if set to <c>true</c> [for readability].</param>
 protected virtual void WriteProjectOutput(XmlWriter xw, bool forReadability)
 {
     ProjectOutput.WriteProjectOutput(xw, forReadability);
 }
Esempio n. 8
0
        private void ParseProjectFile(string fullConfiguration, Project parentProject)
        {
            if (_parsed)
            {
                return;
            }

            _parsed = true;
            TagPropertyCollection tpc = new TagPropertyCollection();

            string[] items = fullConfiguration.Split('|');
            ProjectConfiguration = items[0];
            ProjectPlatform      = items[1];

            tpc.Set("PlatformName", ProjectPlatform);
            tpc.Set("ConfigurationName", ProjectConfiguration);

            Solution solution = parentProject as Solution;

            if (solution != null)
            {
                tpc.Set("SolutionDir", QQnPath.NormalizePath(solution.ProjectPath, true));
                tpc.Set("SolutionPath", QQnPath.NormalizePath(solution.ProjectFile));
                tpc.Set("SolutionName", solution.ProjectName);
                tpc.Set("SolutionFileName", Path.GetFileName(ProjectFile));
            }

            tpc.Set("ProjectDir", QQnPath.NormalizePath(ProjectPath, true));
            tpc.Set("ProjectPath", QQnPath.NormalizePath(ProjectFile));
            tpc.Set("ProjectName", ProjectName);
            tpc.Set("ProjectFileName", Path.GetFileName(ProjectFile));
            tpc.Set("ProjectExt", Path.GetExtension(ProjectFile));

            using (StreamReader sr = File.OpenText(ProjectFile))
            {
                XPathDocument doc = new XPathDocument(sr);

                XPathNavigator dn = doc.CreateNavigator();

                TargetName = dn.SelectSingleNode("/VisualStudioProject").GetAttribute("Name", "");
                tpc.Set("TargetName", TargetName);
                tpc.Set("ProjectName", TargetName);

                XPathNavigator config   = dn.SelectSingleNode("//Configurations/Configuration[@Name='" + FullProjectConfiguration + "']");
                XPathNavigator compiler = config.SelectSingleNode("Tool[@Name='VCCLCompilerTool']");
                XPathNavigator linker   = config.SelectSingleNode("Tool[@Name='VCLinkerTool']");

                if (string.IsNullOrEmpty(TargetName) || config == null || compiler == null)
                {
                    TargetName = null;
                    return;                     // No .Net assembly output
                }

                OutputPath = tpc.ExpandProperties(config.GetAttribute("OutputDirectory", ""));
                tpc.Set("OutDir", QQnPath.NormalizePath(GetFullPath(OutputPath), true));

                string intPath = tpc.ExpandProperties(config.GetAttribute("IntermediateDirectory", ""));
                intPath = GetFullPath(intPath);
                tpc.Set("IntDir", QQnPath.NormalizePath(intPath, true));

                ProjectOutput.BaseDirectory = ProjectPath;

                switch (int.Parse(config.GetAttribute("ConfigurationType", "").Trim(), NumberStyles.None))
                {
                case 1:
                    TargetExt = ".exe";
                    break;

                case 4:
                    TargetExt = ".lib";
                    linker    = config.SelectSingleNode("Tool[@Name='VCLibrarianTool']");
                    break;

                case 2:
                default:
                    TargetExt = ".dll";
                    break;
                }

                tpc.Set("TargetExt", TargetExt);

                string tp = linker.GetAttribute("OutputFile", "");

                if (!string.IsNullOrEmpty(tp))
                {
                    tp = tpc.ExpandProperties(tp);

                    if (!string.IsNullOrEmpty(tp))
                    {
                        tp = EnsureRelativePath(tp);

                        TargetName = Path.GetFileNameWithoutExtension(tp);
                        TargetExt  = Path.GetExtension(tp);
                        tpc.Set("TargetExt", TargetExt);

                        if (!string.Equals(TargetPath, tp, StringComparison.OrdinalIgnoreCase))
                        {
                            TargetPath = tp;                             // Only set the override if the construction was not ok
                        }
                    }
                }

                if (!File.Exists(GetFullPath(TargetPath)) || linker == null)
                {
                    TargetName = null;
                    return;                     // Something went wrong.. Check project format
                }

                string mc = config.GetAttribute("ManagedExtensions", "");
                if (!string.IsNullOrEmpty(mc))
                {
                    switch (int.Parse(mc.Trim(), NumberStyles.None))
                    {
                    case 0:
                        break;                                 // No clr?

                    case 1:
                    default:
                        IsAssembly = QQnPath.IsAssemblyFile(TargetPath);
                        break;
                    }
                }

                string value = TargetPath;
                ProjectOutput.Add(new TargetItem(value, value, TargetType.Item));

                if (string.Equals(compiler.GetAttribute("GenerateXMLDocumentationFiles", ""), "true", StringComparison.OrdinalIgnoreCase))
                {
                    string xmlFile = Path.ChangeExtension(value, ".xml");

                    if (File.Exists(GetFullPath(xmlFile)))
                    {
                        ProjectOutput.Add(new TargetItem(xmlFile, xmlFile, TargetType.Item));
                    }
                }

                if (string.Equals(linker.GetAttribute("GenerateDebugInformation", ""), "true", StringComparison.OrdinalIgnoreCase))
                {
                    string pdbFile = Path.ChangeExtension(value, ".pdb");

                    if (File.Exists(GetFullPath(pdbFile)))
                    {
                        ProjectOutput.Add(new TargetItem(pdbFile, pdbFile, TargetType.Item));
                    }
                }

                if (!string.IsNullOrEmpty(value = linker.GetAttribute("KeyFile", "")))
                {
                    KeyFile = EnsureRelativePath(tpc.ExpandProperties(value));
                }

                if (!string.IsNullOrEmpty(value = linker.GetAttribute("KeyContainer", "")))
                {
                    KeyContainer = value;
                }

                FindContentAndScripts(doc);
            }
        }