public override void ScanStarted() { base.ScanStarted(); folders.Clear(); fileMaps.Clear(); projectMaps.Clear(); // Locate all add-in folders foreach (DotNetProject p in solution.GetAllSolutionItems <DotNetProject> ()) { foreach (DotNetProjectConfiguration conf in p.Configurations) { FilePath asmFile = p.GetOutputFileName(conf.Selector); AddProjectMap(asmFile, p); // Map support files foreach (var file in p.GetSupportFileList(conf.Selector)) { FilePath tpath = conf.OutputDirectory.Combine(file.Target); if (file.Src != tpath) { AddFileMap(tpath, file.Src); } } // Map references to other projects foreach (ProjectReference pref in p.References) { if (pref.ReferenceType == ReferenceType.Project) { DotNetProject refProject = solution.FindProjectByName(pref.Reference) as DotNetProject; if (refProject != null) { FilePath refOutput = refProject.GetOutputFileName(conf.Selector); if (refOutput.IsNull) { refOutput = refProject.GetOutputFileName(ConfigurationSelector.Default); } if (!refOutput.IsNullOrEmpty) { projectMaps [conf.OutputDirectory.Combine(refOutput.FileName)] = refProject; } } } } } } }
string GetReferenceLibraryPath(ProjectReference pref) { string path = null; if (pref.ReferenceType == ReferenceType.Project) { DotNetProject p = project.ParentSolution.FindProjectByName(pref.Reference) as DotNetProject; if (p != null) { path = p.GetOutputFileName(IdeApp.Workspace.ActiveConfiguration); } } else if (pref.ReferenceType == ReferenceType.Assembly) { path = pref.Reference; } else if (pref.ReferenceType == ReferenceType.Package) { path = pref.Reference; } if (path != null && GuiBuilderService.SteticApp.IsWidgetLibrary(path)) { return(path); } else { return(null); } }
static void Swizzle(DotNetProject project, ConfigurationSelector configSelector) { var appdir = Path.ChangeExtension( project.GetOutputFileName(configSelector), "app"); var appAssemblyDirs = GetAppBundleAssemblyDirectories(appdir).ToArray(); var mscorlib = project .AssemblyContext .GetAssemblies(project.TargetFramework) .FirstOrDefault(asm => asm.Name == "mscorlib"); var targetFrameworkPath = Path.Combine( Path.GetDirectoryName(mscorlib.Location), "repl"); foreach (var asm in Directory.EnumerateFiles(targetFrameworkPath, "*.dll")) { foreach (var appAssemblyDir in appAssemblyDirs) { File.Copy(asm, Path.Combine(appAssemblyDir, Path.GetFileName(asm)), true); var mdb = asm + ".mdb"; if (File.Exists(mdb)) { File.Copy(mdb, Path.Combine(appAssemblyDir, Path.GetFileName(mdb)), true); } } } }
protected override BuildResult OnClean(IProgressMonitor monitor, ConfigurationSelector configuration) { DotNetProject project = Project; DotNetProjectConfiguration conf = (DotNetProjectConfiguration)project.GetConfiguration(configuration); // Delete the generated debug info string file = project.GetOutputFileName(configuration); if (file != null) { string mdb = conf.TargetRuntime.GetAssemblyDebugInfoFile(file); if (File.Exists(mdb)) { FileService.DeleteFile(mdb); } } List <string> cultures = new List <string> (); monitor.Log.WriteLine(GettextCatalog.GetString("Removing all .resources files")); foreach (ProjectFile pfile in project.Files) { if (pfile.BuildAction == BuildAction.EmbeddedResource && Path.GetExtension(pfile.Name) == ".resx") { string resFilename = Path.ChangeExtension(pfile.Name, ".resources"); if (File.Exists(resFilename)) { FileService.DeleteFile(resFilename); } } string culture = GetCulture(pfile.Name); if (culture != null) { cultures.Add(culture); } } if (cultures.Count > 0 && conf != null && project.DefaultNamespace != null) { monitor.Log.WriteLine(GettextCatalog.GetString("Removing all satellite assemblies")); string outputDir = ((DotNetProjectConfiguration)conf).OutputDirectory; string satelliteAsmName = Path.GetFileNameWithoutExtension(((DotNetProjectConfiguration)conf).OutputAssembly) + ".resources.dll"; foreach (string culture in cultures) { string path = String.Format("{0}{3}{1}{3}{2}", outputDir, culture, satelliteAsmName, Path.DirectorySeparatorChar); if (File.Exists(path)) { FileService.DeleteFile(path); string dir = Path.GetDirectoryName(path); if (Directory.GetFiles(dir).Length == 0) { FileService.DeleteDirectory(dir); } } } } return(null); }
/// <summary> /// Determines which analyzers to run, which rule sets to use (TODO) /// and invokes the runners. /// </summary> static IEnumerable <IViolation> RunAnalyzers(DotNetProject project, double work) { string dll = project.GetOutputFileName(ConfigurationSelector.Default); if (!File.Exists(dll)) { yield break; } LoadAnalyzersIfNeccessary(); if (analyzers.Count == 0) { yield break; } double analyzerWork = work / analyzers.Count; foreach (IAnalyzer analyzer in analyzers) { IEnumerable <IRule> ruleSet = GetRuleSet(project, analyzer.GetRuleLoader()); IRunner runner = analyzer.GetRunner(); IEnumerable <IViolation> violations = runner.Run(dll, ruleSet); foreach (IViolation vio in violations) { yield return(vio); } ResultsReporter.WorkComplete += analyzerWork; } }
protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration) { BuildResult res = base.Build(monitor, entry, configuration); if (res.ErrorCount > 0 || !(entry is DotNetProject)) { return(res); } DotNetProject project = (DotNetProject)entry; AddinData data = AddinData.GetAddinData(project); if (data == null) { return(res); } monitor.Log.WriteLine(AddinManager.CurrentLocalizer.GetString("Verifying add-in description...")); string fileName = data.AddinManifestFileName; ProjectFile file = data.Project.Files.GetFile(fileName); if (file == null) { return(res); } string addinFile; if (file.BuildAction == BuildAction.EmbeddedResource) { addinFile = project.GetOutputFileName(ConfigurationSelector.Default); } else { addinFile = file.FilePath; } AddinDescription desc = data.AddinRegistry.GetAddinDescription(new ProgressStatusMonitor(monitor), addinFile); StringCollection errors = desc.Verify(); foreach (string err in errors) { res.AddError(data.AddinManifestFileName, 0, 0, "", err); monitor.Log.WriteLine("ERROR: " + err); } return(res); }
void SetCustomLauncherText() { customLauncherEntry.IsEditable = launcherCombo.Active == 3; // custom var outputFileName = project.GetOutputFileName(project.DefaultConfiguration.Selector); switch (launcherCombo.Active) { case 0: // auto detect var version = project.GetRhinoVersion() ?? Helpers.DefaultRhinoVersion; var appPath = project.DetectApplicationPath(outputFileName, version); customLauncherEntry.Text = appPath; break; case 1: customLauncherEntry.Text = Helpers.StandardInstallPath; break; case 2: customLauncherEntry.Text = Helpers.StandardInstallWipPath; break; case 3: var currentLauncherIndex = GetLauncherComboIndex(); if (currentLauncherIndex == 3) // custom { customLauncherEntry.Text = project.ProjectProperties.GetValue(Helpers.RhinoLauncherProperty); } else { customLauncherEntry.Text = string.Empty; } break; case 4: customLauncherEntry.Text = Helpers.GetXcodeDerivedDataPath(outputFileName); break; } }
static void CheckProjectOutput(DotNetProject project, bool autoUpdate) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (IsOutputTrackedProject(project)) { var fileName = project.GetOutputFileName(IdeApp.Workspace.ActiveConfiguration); if (!File.Exists(fileName)) { return; } FileService.NotifyFileChanged(fileName); if (autoUpdate) { // update documents foreach (var openDocument in IdeApp.Workbench.Documents) { openDocument.ReparseDocument(); } } } }
public void UpdateLibraries() { if (hasError || disposed || gproject == null) { return; } bool needsSave = false; librariesUpdated = true; string[] oldLibs = gproject.WidgetLibraries; ArrayList libs = new ArrayList(); string[] internalLibs; foreach (ProjectReference pref in project.References) { string wref = GetReferenceLibraryPath(pref); if (wref != null) { libs.Add(wref); } } ReferenceManager refmgr = new ReferenceManager(project); string target_version = refmgr.TargetGtkVersion; refmgr.Dispose(); // Make sure the target gtk version is properly set if (gproject.TargetGtkVersion != target_version) { gproject.TargetGtkVersion = target_version; needsSave = true; } string outLib = project.GetOutputFileName(IdeApp.Workspace.ActiveConfiguration); if (!string.IsNullOrEmpty(outLib)) { internalLibs = new string [] { outLib } } ; else { internalLibs = new string [0]; } string[] newLibs = (string[])libs.ToArray(typeof(string)); // See if something has changed if (LibrariesChanged(oldLibs, internalLibs, newLibs)) { gproject.SetWidgetLibraries(newLibs, internalLibs); needsSave = true; } else { GuiBuilderService.SteticApp.UpdateWidgetLibraries(false); } if (needsSave) { SaveAll(true); } }
private async Task <bool> UpdateInternal() { using (var monitor = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor(false)) { monitor.BeginTask(1); try { var solution = IdeApp.Workspace.CurrentSelectedSolution; if (solution == null) { return(false); } DotNetProject reactorUIProject = null; foreach (var project in solution.GetAllProjects() .OfType <DotNetProject>() .Where(_ => _.TargetFramework.Id.Identifier == ".NETStandard")) { var packages = await project.GetPackageDependencies(ConfigurationSelector.Default, CancellationToken.None); if (packages.Any(_ => _.Name == "XamarinReactorUI") && packages.Any(_ => _.Name == "XamarinReactorUI.HotReload")) { reactorUIProject = project; break; } } if (reactorUIProject == null) { await monitor.Log.WriteLineAsync("Solution doesn't contain a Xamarin Forms project referencing BOTH XamarinReactorUI and XamarinReactorUI.HotReload"); return(false); } var startupProject = solution.StartupItem as DotNetProject; if (startupProject == null) { await monitor.Log.WriteLineAsync("Solution hasn't a valid startup project"); return(false); } OS os = OS.None; if (startupProject.TargetFramework.Id.Identifier == "Xamarin.iOS") { os = OS.iOS; } else if (startupProject.TargetFramework.Id.Identifier == "MonoAndroid") { os = OS.Android; } if (os == OS.None) { await monitor.Log.WriteLineAsync($"Unable to find an valid Xamarin Android or iOS project in the solution"); return(false); } IdeApp.Workbench.SaveAll(); var buildResult = await reactorUIProject.Build(monitor, ConfigurationSelector.Default); if (buildResult.Failed) { return(false); } if (os == OS.Android) { if (!ExecutePortForwardCommmand(monitor)) { return(false); } } if (!await SendAssemblyToEmulatorAsync(monitor, reactorUIProject.GetOutputFileName(ConfigurationSelector.Default).FullPath, true)) { return(false); } return(true); } finally { monitor.EndTask(); } } }
public BasicOptionPanelWidget(Project entry, bool creatingProject) { this.Build(); WidgetFlags |= Gtk.WidgetFlags.NoShowAll; this.entry = entry; if (entry is DotNetProject) { DotNetProject project = (DotNetProject)entry; boxExe.Visible = (project.CompileTarget == CompileTarget.Exe || project.CompileTarget == CompileTarget.WinExe); boxLibrary.Visible = (project.CompileTarget == CompileTarget.Library || project.GetOutputFileName(ConfigurationSelector.Default).FileName.EndsWith(".dll")); } else { boxExe.Visible = boxLibrary.Visible = false; } LinuxDeployData data = LinuxDeployData.GetLinuxDeployData(entry); checkScript.Active = data.GenerateScript; entryScript.Text = data.ScriptName; checkPcFile.Active = data.GeneratePcFile; entryScript.Sensitive = checkScript.Active; if (!creatingProject) { checkDesktop.Visible = false; } }
string GetAssemblyFileName() { return(project.GetOutputFileName(IdeApp.Workspace.ActiveConfiguration)); }
protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration) { DotNetProject project = entry as DotNetProject; AddinData data = project != null?AddinData.GetAddinData(project) : null; if (data != null) { monitor.BeginTask(null, buildingSolution ? 2 : 3); } BuildResult res = base.Build(monitor, entry, configuration); if (res.ErrorCount > 0 || data == null) { return(res); } monitor.Step(1); monitor.Log.WriteLine(AddinManager.CurrentLocalizer.GetString("Verifying add-in description...")); string fileName = data.AddinManifestFileName; ProjectFile file = data.Project.Files.GetFile(fileName); if (file == null) { return(res); } string addinFile; if (file.BuildAction == BuildAction.EmbeddedResource) { addinFile = project.GetOutputFileName(ConfigurationSelector.Default); } else { addinFile = file.FilePath; } AddinDescription desc = data.AddinRegistry.GetAddinDescription(new ProgressStatusMonitor(monitor), addinFile); StringCollection errors = desc.Verify(); foreach (string err in errors) { res.AddError(data.AddinManifestFileName, 0, 0, "", err); monitor.Log.WriteLine("ERROR: " + err); } if (!buildingSolution && project.ParentSolution != null) { monitor.Step(1); SolutionAddinData sdata = project.ParentSolution.GetAddinData(); if (sdata != null && sdata.Registry != null) { sdata.Registry.Update(new ProgressStatusMonitor(monitor)); DispatchService.GuiDispatch(delegate { sdata.NotifyChanged(); }); } } monitor.EndTask(); return(res); }