private async void OnBuildV8() { try { EnableButtons(false); if (!CheckSourceFolder(false)) { return; } var buildFolder = string.IsNullOrEmpty(Config.BuildFolder) ? Config.BuildConfiguration : Config.BuildFolder; var batch = new BatchFile { WorkingDirectory = Path.Combine(Config.SourceFolder, "v8"), Model = this, Title = $"running Ninja to build V8 with configuration {Config.BuildConfiguration} in \"{buildFolder}\"", }; batch.Commands.Add($"ninja -C out.gn\\{buildFolder}"); StatusText = batch.Title; StatusText = await batch.Run(); //StatusText = $"running Ninja to build V8 with configuration {Config.BuildConfiguration} in \"{buildFolder}\""; //installer.WorkingDirectory = Path.Combine(Config.SourceFolder, "v8"); //installer.Arguments = $"/k title Ninja is building V8 - if all is well, this is likely to take several minutes & ninja -C \"out.gn\\{buildFolder}\""; //await Task.Run(() => Process.Start(installer).WaitForExit()); //StatusText = "Ready"; } finally { EnableButtons(true); } }
private async void OnDownloadSource() { try { EnableButtons(false); if (!CheckSourceFolder(false)) { return; } if (Directory.Exists(Config.SourceFolder)) { try { FileSystem.DeleteDirectory(Config.SourceFolder, UIOption.AllDialogs, RecycleOption.SendToRecycleBin); } catch (Exception) { MessageBox.Show($"Cannot delete the existing V8 source folder '{Config.SourceFolder}'; is that folder open in another program?" , $"Downloading V8 source failed"); StatusText = $"failed to delete existing source folder '{Config.SourceFolder}'"; return; } } Directory.CreateDirectory(Config.SourceFolder); var batch = new BatchFile { WorkingDirectory = Config.SourceFolder, Model = this, Title = "Fetching v8 source code", }; if (!CheckPython(batch.PythonFileName)) { return; } batch.Commands.Add($"\"{batch.PythonFileName}\" \"{Path.Combine(Config.DepotToolsFolder, "fetch.py")}\" v8"); StatusText = batch.Title; StatusText = await batch.Run(); //var installer = CreateInstaller(); //StatusText = "Fetching v8 source code"; //installer.WorkingDirectory = Config.SourceFolder; //installer.Arguments = "/k title Fetching v8 source code & fetch v8"; //await Task.Run(() => Process.Start(installer).WaitForExit()); //StatusText = "Ready"; } finally { EnableButtons(true); } }
private async void OnConfigureBuild() { try { EnableButtons(false); if (!CheckSourceFolder(false)) { return; } if (string.IsNullOrEmpty(Config.BuildConfiguration)) { MessageBox.Show("Please select a build configuration from the list box in the bottom-left", "No build configuration set"); return; } var buildFolder = string.IsNullOrEmpty(Config.BuildFolder) ? Config.BuildConfiguration : Config.BuildFolder; var buildFolderFullPath = Path.IsPathRooted(buildFolder) ? buildFolder : Path.Combine(Config.SourceFolder, "v8", "out.gn", buildFolder); if (Directory.Exists(buildFolderFullPath)) { try { FileSystem.DeleteDirectory(buildFolderFullPath, UIOption.AllDialogs, RecycleOption.SendToRecycleBin); } catch (Exception) { MessageBox.Show($"Cannot delete the existing build folder '{buildFolderFullPath}'; is that folder open in another program?" , $"Building V8 failed"); StatusText = $"failed to delete existing build folder '{buildFolderFullPath}'"; return; } } var batch = new BatchFile { WorkingDirectory = Path.Combine(Config.SourceFolder, "v8"), Model = this, Title = $"running v8gen.py to configure a build of {Config.BuildConfiguration} in \"{buildFolder}\"", }; if (!CheckPython(batch.PythonFileName)) { return; } batch.Commands.Add(GetCommandLine()); StatusText = batch.Title; StatusText = await batch.Run(); } finally { EnableButtons(true); } }
private async void OnUpdateDepotTools() { try { EnableButtons(false); var batch = new BatchFile { WorkingDirectory = Config.DepotToolsFolder, Model = this, Title = $"running CIPD and gclient to install the toolkits", }; batch.Commands.Add("call cipd"); batch.Commands.Add("call gclient"); StatusText = batch.Title; StatusText = await batch.Run(); } finally { EnableButtons(true); } }
private async void OnUpdateOptions() { try { EnableButtons(false); var workingFolder = Path.Combine(Config.SourceFolder, "v8"); var configFolder = (Application.Current as App).ConfigFolder; var genFolder = Path.Combine(configFolder, "Downloads", "out.gn", "defaults"); var argsFileName = Path.Combine(configFolder, "Downloads", "gn_defaults.txt"); if (!Directory.Exists(workingFolder)) { MessageBox.Show($"You must select an existing V8 source folder for the depot_tools to be able to produce a list " + "of available compiler options", $"V8 folder not found - '{workingFolder}'"); StatusText = "Updating build options failed"; return; } if (Directory.Exists(genFolder)) { try { FileSystem.DeleteDirectory(genFolder, UIOption.AllDialogs, RecycleOption.SendToRecycleBin); } catch (Exception) { MessageBox.Show($"Cannot delete '{genFolder}'; is that folder open in another program?" , $"Building V8 failed"); StatusText = $"failed to delete '{genFolder}'"; return; } } var batch = new BatchFile { WorkingDirectory = workingFolder, Model = this, Title = $"retrieving the list of available build options", }; if (!CheckPython(batch.PythonFileName)) { return; } // batch.Commands.Add($"call python tools\\dev\\v8gen.py gen -b {Config.BuildConfiguration} \"{genFolder}\" --no-goma"); var gnFileName = Path.Combine(Config.DepotToolsFolder, "gn.py"); batch.Commands.Add($"\"{batch.PythonFileName}\" \"{gnFileName}\" gen \"{genFolder}\""); batch.Commands.Add($"\"{batch.PythonFileName}\" \"{gnFileName}\" args \"{genFolder}\" --list >{argsFileName}"); StatusText = batch.Title; StatusText = await batch.Run(); //var installer = CreateInstaller(); //StatusText = "Extracting build options"; //installer.WorkingDirectory = Path.Combine(Config.SourceFolder, "v8"); //installer.Arguments = $"/k title Generating a list of build options & gn gen \"{genFolder}\" & gn args \"{genFolder}\" --list >{argsFileName}"; //await Task.Run(() => Process.Start(installer).WaitForExit()); var existingOptions = new Dictionary <string, BuildOption>(StringComparer.OrdinalIgnoreCase); foreach (var option in Config.BuildOptions) { existingOptions[option.Name] = option; } AvailableOptions.Clear(); SelectedOptions.Clear(); StatusText = "Parsing build options"; Config.BuildOptions.Clear(); var lines = File.ReadAllLines(argsFileName); BuildOption currentOption = null; OptionParserState state = OptionParserState.None; StringBuilder descriptionBuilder = null; for (var ii = 0; ii < lines.Length; ++ii) { var line = lines[ii]; switch (state) { case OptionParserState.None: case OptionParserState.Name: descriptionBuilder = new StringBuilder(); var name = line.Trim(); if (existingOptions.TryGetValue(name, out currentOption)) { existingOptions.Remove(name); } else { currentOption = new Configuration.BuildOption { Name = line }; } if (currentOption.Selected) { SelectedOptions.Add(currentOption); } else { AvailableOptions.Add(currentOption); } Config.BuildOptions.Add(currentOption); state = OptionParserState.Current; break; case OptionParserState.Current: currentOption.Default = line.Split('=')[1].Trim(); state = OptionParserState.From; break; case OptionParserState.From: state = OptionParserState.Blank; break; case OptionParserState.Blank: state = OptionParserState.Description; break; case OptionParserState.Description: if (!string.IsNullOrEmpty(line) && line[0] != ' ') { --ii; // Reparse this line, it's the next name currentOption.Description = descriptionBuilder.ToString().Trim(); state = OptionParserState.Name; } else { descriptionBuilder.Append(' '); descriptionBuilder.Append(line.Trim()); } break; } } if (currentOption != null && descriptionBuilder != null && (descriptionBuilder.Length > 0)) { currentOption.Description = descriptionBuilder.ToString(); } StatusText = "Ready"; } finally { EnableButtons(true); } }
private async void OnUpdateSource() { try { EnableButtons(false); if (!CheckSourceFolder(true)) { return; } var v8Folder = Path.Combine(Config.SourceFolder, "v8"); if (!Directory.Exists(v8Folder)) { MessageBox.Show($"There is no V8 source to update in folder '{Config.SourceFolder}'; please select a different folder or " + "use the DOWNLOAD button to download a new copy", "Updating V8 source failed"); StatusText = "Failed to update V8 source"; return; } var configFolder = (Application.Current as App).ConfigFolder; var configurationsFile = new FileInfo(Path.Combine(configFolder, "Downloads", "configurations.txt")); if (configurationsFile.Exists) { FileSystem.DeleteFile(configurationsFile.FullName, UIOption.AllDialogs, RecycleOption.SendToRecycleBin); } var batch = new BatchFile { WorkingDirectory = Path.Combine(Config.SourceFolder, "v8"), Model = this, Title = $"updating the v8 build configurations and source code", }; if (!CheckPython(batch.PythonFileName)) { return; } batch.Commands.Add($"\"{batch.PythonFileName}\" tools\\dev\\v8gen.py list >{configurationsFile.FullName}"); batch.Commands.Add($"call gclient sync"); StatusText = batch.Title; StatusText = await batch.Run(); //var installer = CreateInstaller(); //StatusText = "running v8gen to get a list of the available configurations"; //installer.WorkingDirectory = $"{Config.SourceFolder}\\v8"; //installer.Arguments = "/k title v8gen - downloading a list of configurations & " // + $"python tools\\dev\\v8gen.py list >{configurationsFile.FullName}"; //await Task.Run(() => Process.Start(installer).WaitForExit()); var configurations = File.ReadAllLines(configurationsFile.FullName) .Select(cc => cc.Trim()) .Where(cc => !string.IsNullOrEmpty(cc)) ; var existingBuild = Config.BuildConfiguration; Config.BuildConfiguration = null; Config.BuildConfigurations.Clear(); foreach (var configuration in configurations) { if (configuration == existingBuild) { Config.BuildConfiguration = configuration; } Config.BuildConfigurations.Add(configuration); } InvokePropertyChanged(nameof(Config)); //StatusText = "Updating v8 source code - this may take a few minutes"; //installer.WorkingDirectory = v8Folder; //installer.Arguments = "/k title Updating v8 source code & gclient sync"; //await Task.Run(() => Process.Start(installer).WaitForExit()); //StatusText = "Ready"; } finally { EnableButtons(true); } }