internal MFComponentDescriptor(MFComponent cmp, string desc, string docs, string projPath, Processor processor) { Component = cmp; Description = desc; Documentation = docs; ProjectPath = projPath; SolutionProcessor = processor; }
public void LoadProcessors(string procRootDirectory) { string fullpath = ExpandEnvVars(procRootDirectory, ""); foreach (string subdir in Directory.GetDirectories(fullpath)) { bool fFoundProc = false; foreach (string file in Directory.GetFiles(subdir, "*.settings")) { //Console.WriteLine("ProcessorFile: " + file); LoadProcessorProj(file, fullpath); fFoundProc = true; } if (!fFoundProc) { Processor proc = new Processor(); proc.Name = Path.GetFileName(subdir); proc.Guid = System.Guid.NewGuid().ToString("B"); proc.ProjectPath = ConvertPathToEnv( Path.Combine(subdir, proc.Name + ".settings" )); m_helper.DefaultInventory.Processors.Add(proc); } } }
internal Processor LoadProcessorProj(string procProjFile, string path) { Processor proc = new Processor(); Project proj; string fullpath = ExpandEnvVars(procProjFile, path); try { proj = LoadProject(fullpath); path = Path.GetDirectoryName(fullpath); proc.BuildToolOptions = LoadBuildToolFlags(proj); Dictionary<string, string> tbl = new Dictionary<string, string>(); tbl["PLATFORM_FAMILY"] = "PlatformFamily"; tbl["INSTRUCTION_SET"] = "DefaultISA"; LoadStringProps(proj, proc, tbl); Processor dbProc = m_helper.FindProcessorByName(proc.Name); if (null == dbProc) { m_helper.DefaultInventory.Processors.Add(proc); } else { proc = dbProc; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error: loading processor file: " + fullpath + "\r\n", e.Message); proc = null; } return proc; }
internal void SaveProcessorProj(Processor proc) { if (!string.IsNullOrEmpty(proc.ProjectPath)) { try { string fullpath = ExpandEnvVars(proc.ProjectPath, ""); Project proj = LoadProject(fullpath); proj.ProjectCollection.UnloadProject(proj); proj = new Project(); proj.Xml.DefaultTargets = "Build"; Dictionary<string, string> tbl = new Dictionary<string, string>(); tbl["PlatformFamily"] = "PLATFORM_FAMILY"; ProjectPropertyGroupElement bpg = SaveStringProps(proj, proc, tbl); if (!string.IsNullOrEmpty(proc.DefaultISA)) { ProjectPropertyElement bp = bpg.AddProperty("INSTRUCTION_SET", proc.DefaultISA); bp.Condition = "'$(INSTRUCTION_SET)'==''"; } foreach (MFProperty prop in proc.Properties) { ProjectPropertyElement bp = bpg.AddProperty(prop.Name, prop.Value); bp.Condition = prop.Condition; } bpg.AddProperty("TARGETPROCESSOR", proc.Name); bpg.AddProperty("TARGETCODEBASE", proc.Name); bpg.AddProperty("TARGETCODEBASETYPE", "Native"); SaveBuildToolRef(proc.BuildToolOptions, proj); ProjectItemGroupElement big = proj.Xml.AddItemGroup(); big.AddItem("IncludePaths", RemoveSpoClient(Path.GetDirectoryName(proc.ProjectPath))); //ProjectPropertyGroupElement bpg = proj.Xml.AddPropertyGroup(); //bpg.AddProperty("PKUI_Processor", SerializeXml(proc)); proj.Save(fullpath); } catch(Exception e) { System.Diagnostics.Debug.WriteLine("Error: Unable to save procesor file " + proc.ProjectPath + "\r\n" + e.Message); } } }
public bool ValidateLibrary(Library lib, MFSolution solution, Processor proc, InventoryHelper helper) { try { if (!lib.IsSolutionWizardVisible) { return false; } // don't show processor specific libraries if ((lib.ProcessorSpecific != null) && !string.IsNullOrEmpty(lib.ProcessorSpecific.Guid) && (0 != string.Compare(lib.ProcessorSpecific.Guid, solution.Processor.Guid, true))) { return false; } if (!string.IsNullOrEmpty(lib.CustomFilter)) { bool OK = false; // don't show custom specific libraries foreach (string libFilter in lib.CustomFilter.Split(';')) { string[] customAttribs = proc.CustomFilter.Split(';'); foreach (string attrib in customAttribs) { if (string.Compare(attrib, libFilter, true) == 0) { OK = true; break; } } if (!OK) { foreach (string attrib in solution.CustomFilter.Split(';')) { if (0 == string.Compare(attrib, libFilter, true)) { OK = true; break; } } } /// /// Now lets check to see if one of the selected features contains this filter. /// This is used for Network (LWIP) to enable the libraries to be auto selected /// based on which Network feature was choosen /// if (!OK) { MFProject defProj = null; foreach(MFProject proj in solution.Projects) { if(proj.IsClrProject) { defProj = proj; break; } } foreach (MFComponent feat in defProj.Features) { Feature f = helper.FindFeature(feat.Guid); if (f != null && 0 == string.Compare(f.Filter, libFilter, true)) { OK = true; break; } } } if (!OK) { OK = (0 == string.Compare(lib.CustomFilter, solution.Name, true)); } if (OK) break; } if (!OK) return false; } if (!IsBootloaderProject() && lib.IsBootloaderLibrary()) { return false; } // only add CLR libraries to a CLR project if (lib.Level == LibraryLevel.CLR && !this.IsClrProject) { return false; } string projPath = lib.ProjectPath.ToLower(); if (projPath.Contains(@"\devicecode\drivers\sample\")) { return false; } if (projPath.Contains("\\solutions\\") && !projPath.Contains("\\solutions\\" + solution.Name.ToLower() + "\\")) { return false; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Exception validating solution libraries: " + e.ToString()); return false; } return true; }
public void CopyTo(Processor dest) { CopyHelper.CopyTo(this, dest); }
private void addProcessorToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode parent = treeViewInventory.Nodes[0].Nodes["Processors"]; Processor newProcType = new Processor(); newProcType.Guid = Guid.NewGuid().ToString("B").ToUpper(); TreeNode newNode = AddTreeElement(parent, "<New Processor>", newProcType, true, DefaultInventory.Processors, c_defaultInventoryKey); DefaultInventory.Processors.Add(newProcType); treeViewInventory.SelectedNode = newNode; newNode.BeginEdit(); }
/// <summary> /// Moving to this page from the previous page. The user can move back from here, so we /// may already be initialized. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void wpChooseLibraries_ShowFromNext(object sender, EventArgs e) { if (!m_worker.IsBusy) { // If we have a new solution guid then we need to rebuild the list if (0 != string.Compare(m_prevSolutionGuid, m_solution.Guid)) { // we use the solution's processor to filter library nodes m_solutionProc = m_helper.FindProcessor(m_solution.Processor.Guid); m_prevSolutionGuid = m_solution.Guid; if (tv_LibraryView.Nodes.Count != 0) { tv_LibraryView.Nodes.Clear(); } // disable forward/back while we process the libraries Wiz.NextEnabled = false; Wiz.BackEnabled = false; cbShowAllLibCatChoices.Enabled = false; cbProjectSelect_Library.Enabled = false; rtb_LibraryDescription.Text = Properties.Resources.LoadingLibraries; this.UseWaitCursor = true; // load all MF libraries m_worker.RunWorkerAsync(BackgroundWorkerType.LoadLibraries); } else if (!m_fResolving) { tv_LibraryView.Nodes.Clear(); LoadAllProjectLibraryData(); ShowLibraryCategories(cbShowAllLibCatChoices.Checked); //LoadProjectLibraryData(); if (cbProjectSelect_Library.SelectedIndex == -1 && cbProjectSelect_Library.Items.Count > 0) { if (m_prevLibraryProjectIndex < cbProjectSelect_Library.Items.Count) { cbProjectSelect_Library.SelectedItem = cbProjectSelect_Library.Items[m_prevLibraryProjectIndex]; } else { cbProjectSelect_Library.SelectedIndex = 0; } } } m_fResolving = false; } }