static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string arg = args.Length > 0 ? args[0] : null; if (Control.ModifierKeys == Keys.Shift || arg == "ffo") { if (Environment.OSVersion.ToString().Contains("Windows")) { AllocConsole(); Exe.Main(null); FreeConsole(); } else { Exe.Main(null); } } else if (Control.ModifierKeys == Keys.Control || arg == "log") { Application.Run(new Form1(true)); } else { Application.Run(new Form1(false)); } }
/// <summary> /// Prepares for execution. /// </summary> void Prepare() { if (string.IsNullOrWhiteSpace(Exe)) { throw new InvalidOperationException("Invalid VB6 executable."); } if (string.IsNullOrWhiteSpace(Vbp)) { throw new InvalidOperationException("Invalid VB6 project file."); } if (string.IsNullOrWhiteSpace(Out)) { throw new InvalidOperationException("Invalid output path."); } Exe = Exe.Trim().TrimEnd(new[] { '/', '\\' }); Vbp = Vbp.Trim().TrimEnd(new[] { '/', '\\' }); Out = Out.Trim().TrimEnd(new[] { '/', '\\' }); if (File.Exists(Exe) == false) { throw new FileNotFoundException("Missing VB6 executable.", Exe); } if (File.Exists(Vbp) == false) { throw new FileNotFoundException("Missing VB6 project file.", Vbp); } if (Def == null) { Def = new Dictionary <string, string>(); } }
public Command(string name, string discription, string useage, Exe action) { Name = name; Discription = discription; Useage = useage; Action = action; }
public static void Main() { int arg1 = 5; int arg2 = 8; Debug.Print(Resources.GetString(Resources.StringResources.String1)); Exe testExe = new Exe(); Debug.Print("One plus two = " + testExe.OnePlusTwo()); Debug.Print("Two plus four = " + testExe.TwoPlusFour()); Debug.Print("Addition with args: " + arg1 + " plus " + arg2 + " = " + testExe.Arg1PlusArg2(arg1, arg2)); Debug.Print("Addition with args (internal non-stub function call): " + arg1 + " plus " + arg2 + " = " + testExe.Arg1PlusArg2_IntFunc(arg1, arg2)); Debug.Print("Exponentiation with cmath library: " + arg1 + "^" + arg2 + " = " + testExe.IntExp_Lib(arg1, arg2)); Exe.Arg struct_in = new Exe.Arg(); struct_in.size = 5; struct_in.array = new UInt16[] { 1, 2, 3, 4, 5 }; Exe.Arg struct_out = new Exe.Arg(); struct_out.array = new UInt16[struct_in.size]; testExe.CustomArgsIO(struct_in, out struct_out.size, struct_out.array); Debug.Print("Input struct: size = " + struct_in.size + "; array: "); foreach (var item in struct_in.array) { Debug.Print(item.ToString()); } Debug.Print("Output struct: size = " + struct_out.size + "; array: "); foreach (var item in struct_out.array) { Debug.Print(item.ToString()); } }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { string AppBundlePath = ""; if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); StageAppBundle(SC, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); StageAppBundle(SC, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } if (!string.IsNullOrEmpty(AppBundlePath)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Build/Mac"), "Application.icns", false, null, CombinePaths(AppBundlePath, "Contents/Resources"), true); } } // Copy the splash screen, Mac specific SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); }
public override bool SignExecutables(DeploymentContext SC, ProjectParams Params) { if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac) { // Sign everything we built List <FileReference> FilesToSign = GetExecutableNames(SC); LogInformation("RuntimeProjectRootDir: " + SC.RuntimeProjectRootDir); foreach (var Exe in FilesToSign) { LogInformation("Signing: " + Exe); string AppBundlePath = ""; if (Exe.IsUnderDirectory(DirectoryReference.Combine(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { LogInformation("Starts with Binaries"); AppBundlePath = CombinePaths(SC.RuntimeProjectRootDir.FullName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe.FullName) + ".app"); } else if (Exe.IsUnderDirectory(DirectoryReference.Combine(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { LogInformation("Starts with Engine/Binaries"); AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe.FullName) + ".app"); } LogInformation("Signing: " + AppBundlePath); CodeSign.SignMacFileOrFolder(AppBundlePath); } } return(true); }
List <ImportStmt> ParseImportStmt( ) { var importList = new List <ImportStmt>(); while (CurrTokenType == TokenType.Import && CurrTokenType != TokenType.EOF) { var defpos = CurrTokenPos; Expect(TokenType.Import); var tk = Expect(TokenType.QuotedString); var pkgName = new BasicLit(tk.Value, (TokenType)tk.MatcherID, tk.Pos); var n = new ImportStmt(pkgName, defpos); importList.Add(n); ScopeManager.Declare(n, ScopeMgr.PackageScope, tk.Value, defpos, SymbolUsage.Package); // 如果包存在, 就不会在定义 var pkg = Exe.GetPackageByName(tk.Value); if (pkg == null) { Compiler.Import(_exe, _loader, tk.Value, tk.Value, ImportMode.Directory); } } return(importList); }
public int Execute() { //add deps and runtime config to params var targetPath = Path.GetFullPath(AssemblyPath !); var targetDirectory = Path.GetDirectoryName(targetPath) !; var assemblyName = Path.GetFileNameWithoutExtension(targetPath); var depsFile = Path.Combine(targetDirectory, assemblyName + ".deps.json"); var runtimeConfig = Path.Combine(targetDirectory, assemblyName + ".runtimeconfig.json"); var args = new List <string> { "exec", "--depsfile", depsFile }; if (File.Exists(runtimeConfig)) { args.Add("--runtimeconfig"); args.Add(runtimeConfig); } //we want to run run PostgreSql.Exec var currentAssembly = Path.GetFullPath(Assembly.GetExecutingAssembly().Location) !; args.Add(currentAssembly); //pass the arguments args.AddRange(TemplateCreator.GetArgs(this)); return(Exe.Run("dotnet", args, targetDirectory)); }
/// <exception cref="ArgumentNullException"><paramref name="execute" /> is <c>null</c>.</exception> public RelayCommand(Exe execute, Func<bool> canExecute) { if (execute == null) { throw new ArgumentNullException("execute"); } this.execute = execute; this.canExecute = canExecute; }
private string SettingsPath() { #if DEBUG return(Exe.Relative(Exe.Filename() + ".xml")); #else var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); Directory.CreateDirectory(Path.Combine(path, Exe.Filename())); return(Path.Combine(path, Exe.Filename(), "config.xml")); #endif }
/// <exception cref="ArgumentNullException"><paramref name="execute" /> is <c>null</c>.</exception> public RelayCommand(Exe execute, Func <bool> canExecute) { if (execute == null) { throw new ArgumentNullException("execute"); } this.execute = execute; this.canExecute = canExecute; }
public override int GetHashCode() { // Overflow is fine, just wrap unchecked { int hash = 17; hash = hash * 23 + Exe.GetHashCode(); hash = hash * 23 + Version.GetHashCode(); return(hash); } }
void ResolveSelectorElement(Expr x, Ident sel, TokenPos dotpos) { var xident = x as Ident; if (xident == null) { return; } if (xident.Symbol == null) { throw new CompileException(string.Format("{0} not defined", xident.Name), dotpos); } switch (xident.Symbol.Usage) { // 包.函数名 case SymbolUsage.Package: { var pkg = Exe.GetPackageByName(xident.Name); if (pkg == null) { throw new CompileException("package not found: " + xident.Name, dotpos); } // 包必须有一个顶级作用域 if (pkg.TopScope == null) { throw new CompileException("package should have a scope: " + xident.Name, dotpos); } ScopeMgr.Resolve(sel, pkg.TopScope); } break; // 实例.函数名 case SymbolUsage.Variable: case SymbolUsage.Parameter: case SymbolUsage.SelfParameter: { } break; default: throw new CompileException("unknown usage", dotpos); } }
/// <summary> /// Executes a generic ADB command. /// </summary> /// <param name="device">Optional if there is only one device attached</param> /// <param name="command"></param> /// <param name="timeoutMilliseconds">Timeout (in milliseconds) before the method to end in any case. If null, there is no timeout.</param> /// <param name="arguments"></param> /// <returns></returns> public ExeResponse Execute(Device device, string command, int?timeoutMilliseconds, params string[] arguments) { if (String.IsNullOrEmpty(command)) { return(null); } if (arguments == null) { arguments = new string[] { } } ; arguments = new[] { command }.Concat(arguments).ToArray(); return(Exe.Adb(device, timeoutMilliseconds, arguments)); }
public static string Run(this Exe e, string args) { var p = System.Diagnostics.Process.Start( new System.Diagnostics.ProcessStartInfo { FileName = e, Arguments = args, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true } ); var stdout = p.StandardOutput.ReadToEnd(); p.WaitForExit(); return(stdout); }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { string AppBundlePath = ""; if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); StageAppBundle(SC, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); string AbsoluteBundlePath = CombinePaths(SC.LocalRoot, AppBundlePath); // ensure the ue4game binary exists, if applicable if (!SC.IsCodeBasedProject && !Directory.Exists(AbsoluteBundlePath)) { Log("Failed to find app bundle " + AbsoluteBundlePath); AutomationTool.ErrorReporter.Error("Stage Failed.", (int)AutomationTool.ErrorCodes.Error_MissingExecutable); throw new AutomationException("Could not find app bundle {0}. You may need to build the UE4 project with your target configuration and platform.", AbsoluteBundlePath); } StageAppBundle(SC, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } if (!string.IsNullOrEmpty(AppBundlePath)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Build/Mac"), "Application.icns", false, null, CombinePaths(AppBundlePath, "Contents/Resources"), true); } } // Copy the splash screen, Mac specific SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); // CEF3 files if (Params.bUsesCEF3) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/CEF3/Mac/"), "*", true, null, null, true); string UnrealCEFSubProcessPath = CombinePaths("Engine/Binaries", SC.PlatformDir, "UnrealCEFSubProcess.app"); StageAppBundle(SC, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UnrealCEFSubProcess.app"), UnrealCEFSubProcessPath); } }
public static bool RunTest(string toolchainName, Compiler compile, Exe runner, File source) { var destPath = tests_results.Combine(source); var sourcePath = tests.Combine(source); var expected = sourcePath.DropExtension().Combine(Ext(".o")); Console.Write($"\x1b[KRunning test {source} ({toolchainName}) "); destPath.DirName().Create(); UserErrorException exception = null; try { CompileToFile(compile, sourcePath, destPath); } catch (UserErrorException e) { exception = e; } if (exception != null) { Console.WriteLine(""); Console.WriteLine("\x1b[1;31mFail\x1b[m"); Console.WriteLine($"\x1b[1;33m{exception.Message}\x1b[m\n"); return(false); } else { var actualStr = runner.Run(destPath); var expectedStr = expected.Read(); if (actualStr != expectedStr) { Console.WriteLine("\x1b[1;31mFail\x1b[m"); Console.WriteLine($"\x1b[1;33m{source}: expected {expectedStr} but got {actualStr}.\x1b[m\n"); return(false); } else { Console.Write("\x1b[1;32mOK\x1b[m\n"); // \r at the end for quiet return(true); } } }
public void Load(Device device) { if (PropsList.Count > 0) { return; } var raw = Exe.Adb(device, new[] { "shell", "cat /system/build.prop" }); if (ExeResponse.IsNullOrAbnormalExit(raw)) { return; } var lines = raw.Output.Split(new[] { Environment.NewLine }, StringSplitOptions.None); PropsList.Clear(); foreach (var matches in lines.Select(line => Regex.Match(line, PropRegex, RegexOptions.IgnoreCase)).Where(matches => matches.Success)) { PropsList.Add(matches.Groups["prop"].Value, matches.Groups["value"].Value); } }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { StageAppBundle(SC, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), CombinePaths(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app")); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { StageAppBundle(SC, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app")); } } // Copy the splash screen, Mac specific SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); SC.StageFiles(StagedFileType.UFS, CombinePaths(SC.LocalRoot, "Engine/Content/Localization/ICU"), "*", true, null, null, false, !Params.UsePak(SC.StageTargetPlatform)); }
public void Build() { var args = new List <string> { "build" }; if (_file != null) { args.Add(_file); } // TODO: Only build for the first framework when unspecified if (_framework != null) { args.Add("--framework"); args.Add(_framework); } if (_configuration != null) { args.Add("--configuration"); args.Add(_configuration); } if (_runtime != null) { args.Add("--runtime"); args.Add(_runtime); } args.Add("/verbosity:quiet"); args.Add("/nologo"); var exitCode = Exe.Run("dotnet", args, interceptOutput: true); if (exitCode != 0) { throw new CommandException(Resources.BuildFailed); } }
public override bool SignExecutables(DeploymentContext SC, ProjectParams Params) { if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac) { // Sign everything we built List <string> FilesToSign = GetExecutableNames(SC); foreach (var Exe in FilesToSign) { string AppBundlePath = ""; if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); } CodeSign.SignMacFileOrFolder(AppBundlePath); } } return(true); }
/// <summary> /// Retrieves a list of currently connected <see cref="Device"/>s (in debug mode). /// Drivers must be correctly installed to let ADB see the devices. /// </summary> /// <returns></returns> public List <Device> GetDevicesList() { var output = Exe.Adb(null, new[] { "devices" }); if (ExeResponse.IsNullOrAbnormalExit(output)) { return(null); } var cursor = output.Output.Split(new[] { Environment.NewLine }, StringSplitOptions.None).GetEnumerator(); var devices = new List <Device>(); while (cursor.MoveNext()) { var current = cursor.Current as string; if (String.IsNullOrEmpty(current)) { continue; } var matches = Regex.Match(current, "^(?<serial>[a-z|0-9]+)[\\s]+(?<state>[a-z|0-9]+)$"); if (!matches.Success) { continue; } devices.Add(new Device { Build = new Build(matches.Groups["serial"].Value), SerialNumber = matches.Groups["serial"].Value }); } return(devices); }
protected override int Execute() { var thisPath = Path.GetFullPath(Path.GetDirectoryName(typeof(InvokeCommand).Assembly.Location)); var projectName = _projectOptions.ProjectName.Value(); var assemblyPath = _projectOptions.AssemblyPath.Value(); var targetDirectory = Path.GetDirectoryName(assemblyPath); string executable = null; var cleanupExecutable = false; try { string toolsDirectory; var args = new List <string>(); var targetFramework = new FrameworkName(_projectOptions.TargetFramework.Value()); switch (targetFramework.Identifier) { case ".NETFramework": cleanupExecutable = true; toolsDirectory = Path.Combine( thisPath, _projectOptions.Platform.Value() == "x86" ? "net461-x86" : "net461"); var executableSource = Path.Combine(toolsDirectory, InsideManName + ".exe"); executable = Path.Combine(targetDirectory, InsideManName + ".exe"); File.Copy(executableSource, executable, overwrite: true); var configPath = assemblyPath + ".config"; if (File.Exists(configPath)) { File.Copy(configPath, executable + ".config", overwrite: true); } break; case ".NETCoreApp": if (targetFramework.Version < new Version(2, 1)) { throw new CommandException(Resources.FormatOldNETCoreAppProject( projectName, targetFramework.Version)); } executable = DotNetMuxer.MuxerPathOrDefault(); toolsDirectory = Path.Combine(thisPath, "netcoreapp2.1"); args.Add("exec"); args.Add("--depsFile"); args.Add(Path.ChangeExtension(assemblyPath, ".deps.json")); var projectAssetsFile = _projectOptions.AssetsFile.Value(); if (!string.IsNullOrEmpty(projectAssetsFile) && File.Exists(projectAssetsFile)) { using var reader = new JsonTextReader(File.OpenText(projectAssetsFile)); var projectAssets = JToken.ReadFrom(reader); var packageFolders = projectAssets["packageFolders"] .Children <JProperty>() .Select(p => p.Name); foreach (var packageFolder in packageFolders) { args.Add("--additionalProbingPath"); args.Add(packageFolder.TrimEnd(Path.DirectorySeparatorChar)); } } var runtimeConfigPath = Path.ChangeExtension(assemblyPath, ".runtimeconfig.json"); if (File.Exists(runtimeConfigPath)) { args.Add("--runtimeConfig"); args.Add(runtimeConfigPath); } else { var runtimeFrameworkVersion = _projectOptions.RuntimeFrameworkVersion.Value(); if (!string.IsNullOrEmpty(runtimeFrameworkVersion)) { args.Add("--fx-version"); args.Add(runtimeFrameworkVersion); } } args.Add(Path.Combine(toolsDirectory, InsideManName + ".dll")); break; case ".NETStandard": throw new CommandException(Resources.FormatNETStandardProject(projectName)); default: throw new CommandException( Resources.FormatUnsupportedFramework(projectName, targetFramework.Identifier)); } args.AddRange(_args); args.Add("--assembly"); args.Add(assemblyPath); args.Add("--project"); args.Add(projectName); args.Add("--tools-directory"); args.Add(toolsDirectory); if (ReporterExtensions.PrefixOutput) { args.Add("--prefix-output"); } if (IsQuiet) { args.Add("--quiet"); } if (IsVerbose) { args.Add("--verbose"); } return(Exe.Run(executable, args, Reporter)); } finally { if (cleanupExecutable && !string.IsNullOrEmpty(executable)) { // Ignore errors about in-use files. Should still be marked for delete after process cleanup. try { File.Delete(executable); } catch (UnauthorizedAccessException) { } try { File.Delete(executable + ".config"); } catch (UnauthorizedAccessException) { } } } }
public HttpResponseMessage varredura() { try { ArrayList arrayList = new ArrayList(); Exe exe = new Exe(); exe.clearArrayList(); exe.exeSpeed("https://dentalspeed.com/grupo/motor-p-endodontia"); //exe.exeCremer("https://www.dentalcremer.com.br/departamento/854748/motor-para-clinica"); arrayList = exe.getArrayList(); int categoriaId = 4; foreach (Verificacao v in arrayList) { var produtos = db.Produtos.ToArray(); Produto res = null; for (int i = 0; i < produtos.Length; i++) { Produto p = produtos[i]; if (Distance.Similarity(p.Titulo, v.ProdutoNome)) { res = p; i = produtos.Length; } } if (res != null) { Consulta consulta = new Consulta(); consulta.ProdutoId = res.Id; consulta.Site = v.Site; consulta.Caminho = v.Caminho; consulta.Descricao = v.Descricao; consulta.Titulo = v.Titulo; consulta.PesquisarPreco(); if (consulta.RespostaString != null) { db.Consulta.Add(consulta); } } else { Produto produto = new Produto(); produto.Titulo = Distance.RemoveAdjetivoCor(v.ProdutoNome); produto.CategoriaId = categoriaId; produto.imagem = v.Imagem; db.Produtos.Add(produto); Consulta consulta = new Consulta(); consulta.ProdutoId = produto.Id; consulta.Site = v.Site; consulta.Caminho = v.Caminho; consulta.Descricao = v.Descricao; consulta.Titulo = v.Titulo; consulta.PesquisarPreco(); if (consulta.RespostaString != null) { db.Consulta.Add(consulta); produto.Economia = 0; produto.MelhorConsulta = consulta.Id; produto.PiorConsulta = consulta.Id; } db.Produtos.Add(produto); } db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.InternalServerError, "ok")); } catch { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "falha ao add produto")); } }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { // the first app is the "main" one, the rest are marked as debug files for exclusion from chunking/distribution StagedFileType WorkingFileType = StagedFileType.NonUFS; List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { string AppBundlePath = ""; if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); StageAppBundle(SC, WorkingFileType, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); string AbsoluteBundlePath = CombinePaths(SC.LocalRoot, AppBundlePath); // ensure the ue4game binary exists, if applicable if (!SC.IsCodeBasedProject && !Directory.Exists(AbsoluteBundlePath) && !SC.bIsCombiningMultiplePlatforms) { LogError("Failed to find app bundle " + AbsoluteBundlePath); throw new AutomationException(ExitCode.Error_MissingExecutable, "Could not find app bundle {0}. You may need to build the UE4 project with your target configuration and platform.", AbsoluteBundlePath); } StageAppBundle(SC, WorkingFileType, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } if (!string.IsNullOrEmpty(AppBundlePath)) { SC.StageFiles(WorkingFileType, CombinePaths(SC.ProjectRoot, "Build/Mac"), "Application.icns", false, null, CombinePaths(AppBundlePath, "Contents/Resources"), true); if (Params.bUsesSteam) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Source/ThirdParty/Steamworks/Steamv132/sdk/redistributable_bin/osx32"), "libsteam_api.dylib", false, null, CombinePaths(AppBundlePath, "Contents/MacOS"), true); } } // the first app is the "main" one, the rest are marked as debug files for exclusion from chunking/distribution WorkingFileType = StagedFileType.DebugNonUFS; } if (SC.bStageCrashReporter) { string CrashReportClientPath = CombinePaths("Engine/Binaries", SC.PlatformDir, "CrashReportClient.app"); StageAppBundle(SC, StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "CrashReportClient.app"), CrashReportClientPath); } // Copy the splash screen, Mac specific SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); // CEF3 files if (Params.bUsesCEF3) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/CEF3/Mac/"), "*", true, null, null, true); string UnrealCEFSubProcessPath = CombinePaths("Engine/Binaries", SC.PlatformDir, "UnrealCEFSubProcess.app"); StageAppBundle(SC, StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UnrealCEFSubProcess.app"), UnrealCEFSubProcessPath); } // Stage the bootstrap executable if (!Params.NoBootstrapExe) { foreach (StageTarget Target in SC.StageTargets) { BuildProduct Executable = Target.Receipt.BuildProducts.FirstOrDefault(x => x.Type == BuildProductType.Executable); if (Executable != null) { // only create bootstraps for executables if (SC.NonUFSStagingFiles.ContainsKey(Executable.Path) && Executable.Path.Replace("\\", "/").Contains("/" + TargetPlatformType.ToString() + "/")) { string BootstrapArguments = ""; if (!SC.IsCodeBasedProject && !ShouldStageCommandLine(Params, SC)) { BootstrapArguments = String.Format("../../../{0}/{0}.uproject", SC.ShortProjectName); } string BootstrapExeName; if (SC.StageTargetConfigurations.Count > 1) { BootstrapExeName = Path.GetFileName(Executable.Path) + ".app"; } else if (Params.IsCodeBasedProject) { BootstrapExeName = Target.Receipt.TargetName + ".app"; } else { BootstrapExeName = SC.ShortProjectName + ".app"; } string AppPath = Executable.Path.Substring(0, Executable.Path.LastIndexOf(".app/") + 4); object Dest = SC.NonUFSStagingFiles[Executable.Path]; foreach (var DestPath in SC.NonUFSStagingFiles[Executable.Path]) { string AppRelativePath = DestPath.Substring(0, DestPath.LastIndexOf(".app/") + 4); StageBootstrapExecutable(SC, BootstrapExeName, AppPath, AppRelativePath, BootstrapArguments); } } } } } // Copy the ShaderCache files, if they exist SC.StageFiles(StagedFileType.UFS, CombinePaths(SC.ProjectRoot, "Content"), "ShaderCache.ushadercache", false, null, null, true); SC.StageFiles(StagedFileType.UFS, CombinePaths(SC.ProjectRoot, "Content"), "ShaderCodeCache.ushadercode", false, null, null, true); }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { if (Params.StageNonMonolithic) { if (SC.DedicatedServer) { if (SC.StageTargetConfigurations.Contains(UnrealTargetConfiguration.Development)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UE4Server.app")); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "UE4Server-" + SC.ShortProjectName + ".dylib"); } if (SC.StageTargetConfigurations.Contains(UnrealTargetConfiguration.Test)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UE4Server-Mac-Test.app")); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "UE4Server-" + SC.ShortProjectName + "-Mac-Test.dylib"); } if (SC.StageTargetConfigurations.Contains(UnrealTargetConfiguration.Shipping)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UE4Server-Mac-Shipping.app")); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "UE4Server-" + SC.ShortProjectName + "-Mac-Shipping.dylib"); } SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Plugins"), "UE4Server-*.dylib", true); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Plugins"), "UE4Server-*.dylib", true); } else { if (SC.StageTargetConfigurations.Contains(UnrealTargetConfiguration.Development)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UE4.app")); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "UE4-" + SC.ShortProjectName + ".dylib"); } if (SC.StageTargetConfigurations.Contains(UnrealTargetConfiguration.Test)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UE4-Mac-Test.app")); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "UE4-" + SC.ShortProjectName + "-Mac-Test.dylib"); } if (SC.StageTargetConfigurations.Contains(UnrealTargetConfiguration.Shipping)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UE4-Mac-Shipping.app")); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "UE4-" + SC.ShortProjectName + "-Mac-Shipping.dylib"); } SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Plugins"), "UE4-*.dylib", true); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Plugins"), "UE4-*.dylib", true, null, null, true); } } else { // the first app is the "main" one, the rest are marked as debug files for exclusion from chunking/distribution StagedFileType WorkingFileType = StagedFileType.NonUFS; List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { string AppBundlePath = ""; if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); StageAppBundle(SC, WorkingFileType, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); string AbsoluteBundlePath = CombinePaths(SC.LocalRoot, AppBundlePath); // ensure the ue4game binary exists, if applicable if (!SC.IsCodeBasedProject && !Directory.Exists(AbsoluteBundlePath) && !SC.bIsCombiningMultiplePlatforms) { Log("Failed to find app bundle " + AbsoluteBundlePath); AutomationTool.ErrorReporter.Error("Stage Failed.", (int)AutomationTool.ErrorCodes.Error_MissingExecutable); throw new AutomationException("Could not find app bundle {0}. You may need to build the UE4 project with your target configuration and platform.", AbsoluteBundlePath); } StageAppBundle(SC, WorkingFileType, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"), AppBundlePath); } if (!string.IsNullOrEmpty(AppBundlePath)) { SC.StageFiles(WorkingFileType, CombinePaths(SC.ProjectRoot, "Build/Mac"), "Application.icns", false, null, CombinePaths(AppBundlePath, "Contents/Resources"), true); if (Params.bUsesSteam) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Source/ThirdParty/Steamworks/Steamv132/sdk/redistributable_bin/osx32"), "libsteam_api.dylib", false, null, CombinePaths(AppBundlePath, "Contents/MacOS"), true); } } // the first app is the "main" one, the rest are marked as debug files for exclusion from chunking/distribution WorkingFileType = StagedFileType.DebugNonUFS; } } // Copy the splash screen, Mac specific SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); // CEF3 files if (Params.bUsesCEF3) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/CEF3/Mac/"), "*", true, null, null, true); string UnrealCEFSubProcessPath = CombinePaths("Engine/Binaries", SC.PlatformDir, "UnrealCEFSubProcess.app"); StageAppBundle(SC, StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "UnrealCEFSubProcess.app"), UnrealCEFSubProcessPath); } }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { // Stage all the build products foreach (StageTarget Target in SC.StageTargets) { SC.StageBuildProductsFromReceipt(Target.Receipt, Target.RequireFilesExist, Params.bTreatNonShippingBinariesAsDebugFiles); } if (SC.bStageCrashReporter) { string CrashReportClientPath = CombinePaths("Engine/Binaries", SC.PlatformDir, "CrashReportClient.app"); StageAppBundle(SC, StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "CrashReportClient.app"), CrashReportClientPath); } // Find the app bundle path List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { string AppBundlePath = ""; if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = CombinePaths("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe) + ".app"); } // Copy the custom icon and Steam dylib, if needed if (!string.IsNullOrEmpty(AppBundlePath)) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Build/Mac"), "Application.icns", false, null, CombinePaths(AppBundlePath, "Contents/Resources"), true); } } // Copy the splash screen, Mac specific SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); // Stage the bootstrap executable if (!Params.NoBootstrapExe) { foreach (StageTarget Target in SC.StageTargets) { BuildProduct Executable = Target.Receipt.BuildProducts.FirstOrDefault(x => x.Type == BuildProductType.Executable); if (Executable != null) { // only create bootstraps for executables if (SC.NonUFSStagingFiles.ContainsKey(Executable.Path) && Executable.Path.Replace("\\", "/").Contains("/" + TargetPlatformType.ToString() + "/")) { string BootstrapArguments = ""; if (!ShouldStageCommandLine(Params, SC)) { if (!SC.IsCodeBasedProject) { BootstrapArguments = String.Format("../../../{0}/{0}.uproject", SC.ShortProjectName); } else { BootstrapArguments = SC.ShortProjectName; } } string BootstrapExeName; if (SC.StageTargetConfigurations.Count > 1) { BootstrapExeName = Path.GetFileName(Executable.Path) + ".app"; } else if (Params.IsCodeBasedProject) { BootstrapExeName = Target.Receipt.TargetName + ".app"; } else { BootstrapExeName = SC.ShortProjectName + ".app"; } string AppPath = Executable.Path.Substring(0, Executable.Path.LastIndexOf(".app/") + 4); object Dest = SC.NonUFSStagingFiles[Executable.Path]; foreach (var DestPath in SC.NonUFSStagingFiles[Executable.Path]) { string AppRelativePath = DestPath.Substring(0, DestPath.LastIndexOf(".app/") + 4); StageBootstrapExecutable(SC, BootstrapExeName, AppPath, AppRelativePath, BootstrapArguments); } } } } } // Copy the ShaderCache files, if they exist SC.StageFiles(StagedFileType.UFS, CombinePaths(SC.ProjectRoot, "Content"), "DrawCache.ushadercache", false, null, null, true); SC.StageFiles(StagedFileType.UFS, CombinePaths(SC.ProjectRoot, "Content"), "ByteCodeCache.ushadercode", false, null, null, true); }
public RelayCommand(Exe execute) : this(execute, null) { }
protected override int Execute(string[] _) { var commands = _args !.TakeWhile(a => a[0] != '-').ToList(); if (_help !.HasValue() || ShouldHelp(commands)) { return(ShowHelp(_help.HasValue(), commands)); } var(projectFile, startupProjectFile) = ResolveProjects( _project !.Value(), _startupProject !.Value()); Reporter.WriteVerbose(Resources.UsingProject(projectFile)); Reporter.WriteVerbose(Resources.UsingStartupProject(startupProjectFile)); var project = Project.FromFile(projectFile, _msbuildprojectextensionspath !.Value()); var startupProject = Project.FromFile( startupProjectFile, _msbuildprojectextensionspath.Value(), _framework !.Value(), _configuration !.Value(), _runtime !.Value()); if (!_noBuild !.HasValue()) { Reporter.WriteInformation(Resources.BuildStarted); startupProject.Build(); Reporter.WriteInformation(Resources.BuildSucceeded); } string executable; var args = new List <string>(); var toolsPath = Path.Combine( Path.GetDirectoryName(typeof(Program).Assembly.Location) !, "tools"); var targetDir = Path.GetFullPath(Path.Combine(startupProject.ProjectDir !, startupProject.OutputPath !)); var targetPath = Path.Combine(targetDir, project.TargetFileName !); var startupTargetPath = Path.Combine(targetDir, startupProject.TargetFileName !); var depsFile = Path.Combine( targetDir, startupProject.AssemblyName + ".deps.json"); var runtimeConfig = Path.Combine( targetDir, startupProject.AssemblyName + ".runtimeconfig.json"); var projectAssetsFile = startupProject.ProjectAssetsFile; var targetFramework = new FrameworkName(startupProject.TargetFrameworkMoniker !); if (targetFramework.Identifier == ".NETFramework") { executable = Path.Combine( toolsPath, "net461", startupProject.PlatformTarget == "x86" ? "win-x86" : "any", "ef.exe"); } else if (targetFramework.Identifier == ".NETCoreApp") { if (targetFramework.Version < new Version(2, 0)) { throw new CommandException( Resources.NETCoreApp1StartupProject(startupProject.ProjectName, targetFramework.Version)); } var targetPlatformIdentifier = startupProject.TargetPlatformIdentifier !; if (targetPlatformIdentifier.Length != 0 && !string.Equals(targetPlatformIdentifier, "Windows", StringComparison.OrdinalIgnoreCase)) { throw new CommandException(Resources.UnsupportedPlatform(startupProject.ProjectName, targetPlatformIdentifier)); } executable = "dotnet"; args.Add("exec"); args.Add("--depsfile"); args.Add(depsFile); if (!string.IsNullOrEmpty(projectAssetsFile)) { using var file = File.OpenRead(projectAssetsFile); using var reader = JsonDocument.Parse(file); var projectAssets = reader.RootElement; var packageFolders = projectAssets.GetProperty("packageFolders").EnumerateObject().Select(p => p.Name); foreach (var packageFolder in packageFolders) { args.Add("--additionalprobingpath"); args.Add(packageFolder.TrimEnd(Path.DirectorySeparatorChar)); } } if (File.Exists(runtimeConfig)) { args.Add("--runtimeconfig"); args.Add(runtimeConfig); } else if (startupProject.RuntimeFrameworkVersion !.Length != 0) { args.Add("--fx-version"); args.Add(startupProject.RuntimeFrameworkVersion); } args.Add(Path.Combine(toolsPath, "netcoreapp2.0", "any", "ef.dll")); } else if (targetFramework.Identifier == ".NETStandard") { throw new CommandException(Resources.NETStandardStartupProject(startupProject.ProjectName)); } else { throw new CommandException( Resources.UnsupportedFramework(startupProject.ProjectName, targetFramework.Identifier)); } args.AddRange(_args !); args.Add("--assembly"); args.Add(targetPath); args.Add("--project"); args.Add(projectFile); args.Add("--startup-assembly"); args.Add(startupTargetPath); args.Add("--startup-project"); args.Add(startupProjectFile); args.Add("--project-dir"); args.Add(project.ProjectDir !); args.Add("--root-namespace"); args.Add(project.RootNamespace !); args.Add("--language"); args.Add(project.Language !); args.Add("--framework"); args.Add(startupProject.TargetFramework !); if (_configuration.HasValue()) { args.Add("--configuration"); args.Add(_configuration.Value() !); } if (string.Equals(project.Nullable, "enable", StringComparison.OrdinalIgnoreCase) || string.Equals(project.Nullable, "annotations", StringComparison.OrdinalIgnoreCase)) { args.Add("--nullable"); } args.Add("--working-dir"); args.Add(Directory.GetCurrentDirectory()); if (Reporter.IsVerbose) { args.Add("--verbose"); } if (Reporter.NoColor) { args.Add("--no-color"); } if (Reporter.PrefixOutput) { args.Add("--prefix-output"); } if (_applicationArgs !.Any()) { args.Add("--"); args.AddRange(_applicationArgs !); } return(Exe.Run(executable, args, startupProject.ProjectDir)); }
public static Project FromFile( string file, string?buildExtensionsDir, string?framework = null, string?configuration = null, string?runtime = null) { Debug.Assert(!string.IsNullOrEmpty(file), "file is null or empty."); buildExtensionsDir ??= Path.Combine(Path.GetDirectoryName(file) !, "obj"); Directory.CreateDirectory(buildExtensionsDir); var efTargetsPath = Path.Combine( buildExtensionsDir, Path.GetFileName(file) + ".EntityFrameworkCore.targets"); using (var input = typeof(Resources).Assembly.GetManifestResourceStream( "Microsoft.EntityFrameworkCore.Tools.Resources.EntityFrameworkCore.targets") !) using (var output = File.OpenWrite(efTargetsPath)) { // NB: Copy always in case it changes Reporter.WriteVerbose(Resources.WritingFile(efTargetsPath)); input.CopyTo(output); } IDictionary <string, string> metadata; var metadataFile = Path.GetTempFileName(); try { var propertyArg = "/property:EFProjectMetadataFile=" + metadataFile; if (framework != null) { propertyArg += ";TargetFramework=" + framework; } if (configuration != null) { propertyArg += ";Configuration=" + configuration; } if (runtime != null) { propertyArg += ";RuntimeIdentifier=" + runtime; } var args = new List <string> { "msbuild", "/target:GetEFProjectMetadata", propertyArg, "/verbosity:quiet", "/nologo" }; args.Add(file); var exitCode = Exe.Run("dotnet", args); if (exitCode != 0) { throw new CommandException(Resources.GetMetadataFailed); } metadata = File.ReadLines(metadataFile).Select(l => l.Split(new[] { ':' }, 2)) .ToDictionary(s => s[0], s => s[1].TrimStart()); } finally { File.Delete(metadataFile); } var platformTarget = metadata["PlatformTarget"]; if (platformTarget.Length == 0) { platformTarget = metadata["Platform"]; } return(new Project(file, framework, configuration, runtime) { AssemblyName = metadata["AssemblyName"], Language = metadata["Language"], OutputPath = metadata["OutputPath"], PlatformTarget = platformTarget, ProjectAssetsFile = metadata["ProjectAssetsFile"], ProjectDir = metadata["ProjectDir"], RootNamespace = metadata["RootNamespace"], RuntimeFrameworkVersion = metadata["RuntimeFrameworkVersion"], TargetFileName = metadata["TargetFileName"], TargetFrameworkMoniker = metadata["TargetFrameworkMoniker"], Nullable = metadata["Nullable"], TargetFramework = metadata["TargetFramework"], TargetPlatformIdentifier = metadata["TargetPlatformIdentifier"] }); }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { // Stage all the build products foreach (StageTarget Target in SC.StageTargets) { SC.StageBuildProductsFromReceipt(Target.Receipt, Target.RequireFilesExist, Params.bTreatNonShippingBinariesAsDebugFiles); } if (SC.bStageCrashReporter) { StagedDirectoryReference CrashReportClientPath = StagedDirectoryReference.Combine("Engine/Binaries", SC.PlatformDir, "CrashReportClient.app"); StageAppBundle(SC, DirectoryReference.Combine(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir, "CrashReportClient.app"), CrashReportClientPath); } // Find the app bundle path List <FileReference> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { StagedDirectoryReference AppBundlePath = null; if (Exe.IsUnderDirectory(DirectoryReference.Combine(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { AppBundlePath = StagedDirectoryReference.Combine(SC.ShortProjectName, "Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe.FullName) + ".app"); } else if (Exe.IsUnderDirectory(DirectoryReference.Combine(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { AppBundlePath = StagedDirectoryReference.Combine("Engine/Binaries", SC.PlatformDir, Path.GetFileNameWithoutExtension(Exe.FullName) + ".app"); } // Copy the custom icon and Steam dylib, if needed if (AppBundlePath != null) { FileReference AppIconsFile = FileReference.Combine(SC.ProjectRoot, "Build", "Mac", "Application.icns"); if (FileReference.Exists(AppIconsFile)) { SC.StageFile(StagedFileType.NonUFS, AppIconsFile, StagedFileReference.Combine(AppBundlePath, "Contents", "Resources", "Application.icns")); } } } // Copy the splash screen, Mac specific FileReference SplashImage = FileReference.Combine(SC.ProjectRoot, "Content", "Splash", "Splash.bmp"); if (FileReference.Exists(SplashImage)) { SC.StageFile(StagedFileType.NonUFS, SplashImage); } // Stage the bootstrap executable if (!Params.NoBootstrapExe) { foreach (StageTarget Target in SC.StageTargets) { BuildProduct Executable = Target.Receipt.BuildProducts.FirstOrDefault(x => x.Type == BuildProductType.Executable); if (Executable != null) { // only create bootstraps for executables List <StagedFileReference> StagedFiles = SC.FilesToStage.NonUFSFiles.Where(x => x.Value == Executable.Path).Select(x => x.Key).ToList(); if (StagedFiles.Count > 0 && Executable.Path.FullName.Replace("\\", "/").Contains("/" + TargetPlatformType.ToString() + "/")) { string BootstrapArguments = ""; if (!ShouldStageCommandLine(Params, SC)) { if (!SC.IsCodeBasedProject) { BootstrapArguments = String.Format("../../../{0}/{0}.uproject", SC.ShortProjectName); } else { BootstrapArguments = SC.ShortProjectName; } } string BootstrapExeName; if (SC.StageTargetConfigurations.Count > 1) { BootstrapExeName = Path.GetFileName(Executable.Path.FullName) + ".app"; } else if (Params.IsCodeBasedProject) { BootstrapExeName = Target.Receipt.TargetName + ".app"; } else { BootstrapExeName = SC.ShortProjectName + ".app"; } string AppSuffix = ".app" + Path.DirectorySeparatorChar; string AppPath = Executable.Path.FullName.Substring(0, Executable.Path.FullName.LastIndexOf(AppSuffix) + AppSuffix.Length); foreach (var DestPath in StagedFiles) { string AppRelativePath = DestPath.Name.Substring(0, DestPath.Name.LastIndexOf(AppSuffix) + AppSuffix.Length); StageBootstrapExecutable(SC, BootstrapExeName, AppPath, AppRelativePath, BootstrapArguments); } } } } } // Copy the ShaderCache files, if they exist FileReference DrawCacheFile = FileReference.Combine(SC.ProjectRoot, "Content", "DrawCache.ushadercache"); if (FileReference.Exists(DrawCacheFile)) { SC.StageFile(StagedFileType.UFS, DrawCacheFile); } FileReference ByteCodeCacheFile = FileReference.Combine(SC.ProjectRoot, "Content", "ByteCodeCache.ushadercode"); if (FileReference.Exists(ByteCodeCacheFile)) { SC.StageFile(StagedFileType.UFS, ByteCodeCacheFile); } { // Stage any *.metallib files as NonUFS. // Get the final output directory for cooked data DirectoryReference CookOutputDir; if (!String.IsNullOrEmpty(Params.CookOutputDir)) { CookOutputDir = DirectoryReference.Combine(new DirectoryReference(Params.CookOutputDir), SC.CookPlatform); } else if (Params.CookInEditor) { CookOutputDir = DirectoryReference.Combine(SC.ProjectRoot, "Saved", "EditorCooked", SC.CookPlatform); } else { CookOutputDir = DirectoryReference.Combine(SC.ProjectRoot, "Saved", "Cooked", SC.CookPlatform); } if (DirectoryReference.Exists(CookOutputDir)) { List <FileReference> CookedFiles = DirectoryReference.EnumerateFiles(CookOutputDir, "*.metallib", SearchOption.AllDirectories).ToList(); foreach (FileReference CookedFile in CookedFiles) { SC.StageFile(StagedFileType.NonUFS, CookedFile, new StagedFileReference(CookedFile.MakeRelativeTo(CookOutputDir))); } } } }
public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC) { // FIXME: use build architecture string BuildArchitecture = "x86_64-unknown-linux-gnu"; if (SC.bStageCrashReporter) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "CrashReportClient", false, null, null, true); } { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/ICU/icu4c-53_1/", SC.PlatformDir, BuildArchitecture), Params.bDebugBuildsActuallyUseDebugCRT ? "*d.so*" : "*.so*", false, new[] { Params.bDebugBuildsActuallyUseDebugCRT ? "*.so*" : "*d.so*" }, CombinePaths("Engine/Binaries", SC.PlatformDir)); } // assume that we always have to deploy Steam (FIXME: should be automatic - UEPLAT-807) { string SteamVersion = "Steamv132"; // Check if the Steam directory exists. We need it for Steam controller support, so we include it whenever we can. if (Directory.Exists(CommandUtils.CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/Steamworks/" + SteamVersion))) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/Steamworks/" + SteamVersion, SC.PlatformDir), "libsteam_api.so", false, null, CombinePaths("Engine/Binaries", SC.PlatformDir)); } SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Config"), "controller.vdf", false, null, CommandUtils.CombinePaths(SC.RelativeProjectRootForStage, "Saved/Config")); // copy optional perfcounters definition file SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Config"), "PerfCounters.json", false, null, CommandUtils.CombinePaths(SC.RelativeProjectRootForStage, "Saved/Config"), true); } // stage libLND (omit it for dedservers and Rocket - proper resolution is to use build receipts, see UEPLAT-807) if (!SC.DedicatedServer && !GlobalCommandLine.Rocket) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/LinuxNativeDialogs/", SC.PlatformDir, BuildArchitecture), "libLND*.so"); } // assume that we always have to deploy OpenAL (FIXME: should be automatic - UEPLAT-807) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries/ThirdParty/OpenAL/", SC.PlatformDir), "libopenal.so.1", false, null, CombinePaths("Engine/Binaries", SC.PlatformDir)); } SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true); if (Params.StageNonMonolithic) { if (SC.DedicatedServer) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "UE4Server*"); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "libUE4Server-*.so"); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Plugins"), "libUE4Server-*.so", true, null, null, true); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "libUE4Server-*.so"); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Plugins"), "libUE4Server-*.so", true, null, null, true); } else { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "UE4*"); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "libUE4-*.so"); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Plugins"), "libUE4-*.so", true, null, null, true); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "libUE4-*.so"); SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Plugins"), "libUE4-*.so", true, null, null, true); } } else { List <string> Exes = GetExecutableNames(SC); foreach (var Exe in Exes) { if (Exe.StartsWith(CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir))) { // remap the project root. For content-only projects, rename the executable to the project name. if (!Params.IsCodeBasedProject && Exe == Exes[0]) { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), Path.GetFileNameWithoutExtension(Exe), true, null, CommandUtils.CombinePaths(SC.RelativeProjectRootForStage, "Binaries", SC.PlatformDir), false, true, SC.ShortProjectName); } else { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), Path.GetFileNameWithoutExtension(Exe), true, null, CommandUtils.CombinePaths(SC.RelativeProjectRootForStage, "Binaries", SC.PlatformDir), false); } } else if (Exe.StartsWith(CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir))) { // Move the executable for content-only projects into the project directory, using the project name, so it can figure out the UProject to look for and is consistent with code projects. if (!Params.IsCodeBasedProject && Exe == Exes[0]) { // ensure the ue4game binary exists, if applicable if (!SC.IsCodeBasedProject && !FileExists_NoExceptions(Params.ProjectGameExeFilename) && !SC.bIsCombiningMultiplePlatforms) { Log("Failed to find game binary " + Params.ProjectGameExeFilename); AutomationTool.ErrorReporter.Error("Stage Failed.", (int)AutomationTool.ErrorCodes.Error_MissingExecutable); throw new AutomationException("Could not find game binary {0}. You may need to build the UE4 project with your target configuration and platform.", Params.ProjectGameExeFilename); } SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), Path.GetFileNameWithoutExtension(Exe), true, null, CommandUtils.CombinePaths(SC.RelativeProjectRootForStage, "Binaries", SC.PlatformDir), false, true, SC.ShortProjectName); } else { SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), Path.GetFileNameWithoutExtension(Exe), true, null, null, false); } } else { throw new AutomationException("Can't stage the exe {0} because it doesn't start with {1} or {2}", Exe, CombinePaths(SC.RuntimeProjectRootDir, "Binaries", SC.PlatformDir), CombinePaths(SC.RuntimeRootDir, "Engine/Binaries", SC.PlatformDir)); } } } }