private static void CopyPlayerSolutionIntoStagingArea( BuildPostProcessArgs args, HashSet <string> filesToNotOverwrite, bool useIl2Cpp) { string pathSafeProductName = DesktopStandalonePostProcessor.GetPathSafeProductName(args); string str1 = Paths.Combine(new string[3] { (string)args.playerPackage, "Source", "WindowsPlayer" }); string str2 = Path.Combine((string)args.stagingArea, "UnityPlayerStub"); string str3 = Path.Combine((string)args.stagingArea, pathSafeProductName); FileUtil.DeleteFileOrDirectory(str2); FileUtil.DeleteFileOrDirectory(str3); FileUtil.CopyDirectory(Paths.Combine(new string[2] { str1, "UnityPlayerStub" }), str2, true); FileUtil.CopyDirectory(Paths.Combine(new string[2] { str1, "WindowsPlayer" }), str3, true); WindowsDesktopStandalonePostProcessor.RenameWindowsPlayerProject((string)args.stagingArea, pathSafeProductName, filesToNotOverwrite); WindowsDesktopStandalonePostProcessor.WriteProjectPropsFile((string)args.stagingArea, pathSafeProductName, useIl2Cpp); WindowsDesktopStandalonePostProcessor.WriteSolutionFile((string)args.stagingArea, pathSafeProductName, DesktopStandalonePostProcessor.IsHeadlessMode(args), filesToNotOverwrite, useIl2Cpp); WindowsDesktopStandalonePostProcessor.CopyPlayerIcon((string)args.stagingArea, pathSafeProductName); }
protected override void CopyVariationFolderIntoStagingArea( BuildPostProcessArgs args, HashSet <string> filesToNotOverwrite) { FileUtil.CopyDirectoryFiltered(this.GetVariationFolder(args) + "/Data", (string)args.stagingAreaData, true, (Func <string, bool>)(f => this.CopyPlayerFilter(f, args)), true); if (base.GetCreateSolution(args)) { string str = this.UseIl2Cpp ? "il2cpp" : "mono"; List <KeyValuePair <string, string> > keyValuePairList = new List <KeyValuePair <string, string> >(8); keyValuePairList.Add(new KeyValuePair <string, string>("win32_development_" + str, "x86/Debug")); keyValuePairList.Add(new KeyValuePair <string, string>("win32_development_" + str, "x86/Release")); keyValuePairList.Add(new KeyValuePair <string, string>("win32_nondevelopment_" + str, "x86/Master")); keyValuePairList.Add(new KeyValuePair <string, string>("win64_development_" + str, "x64/Debug")); keyValuePairList.Add(new KeyValuePair <string, string>("win64_development_" + str, "x64/Release")); keyValuePairList.Add(new KeyValuePair <string, string>("win64_nondevelopment_" + str, "x64/Master")); if (this.UseIl2Cpp) { keyValuePairList.Add(new KeyValuePair <string, string>("win32_nondevelopment_" + str, "x86/MasterWithLTCG")); keyValuePairList.Add(new KeyValuePair <string, string>("win64_nondevelopment_" + str, "x64/MasterWithLTCG")); } foreach (KeyValuePair <string, string> keyValuePair in keyValuePairList) { WindowsDesktopStandalonePostProcessor.CopyVariationNativeBinaries(args, keyValuePair.Key, WindowsDesktopStandalonePostProcessor.kSolutionOutputFolder + "/" + keyValuePair.Value, false, false, true, this.UseIl2Cpp); } WindowsDesktopStandalonePostProcessor.CopyPlayerSolutionIntoStagingArea(args, filesToNotOverwrite, this.UseIl2Cpp); } else { string variationName = this.GetVariationName(args); WindowsDesktopStandalonePostProcessor.CopyVariationNativeBinaries(args, variationName, string.Empty, true, true, false, this.UseIl2Cpp); string str1 = Path.Combine((string)args.stagingArea, DesktopStandalonePostProcessor.IsHeadlessMode(args) ? "WindowsPlayerHeadless.exe" : "WindowsPlayer.exe"); if (!IconUtility.AddIconToWindowsExecutable(str1)) { throw new BuildFailedException("Failed to add a custom icon to the executable."); } ((BuildReport)args.report).RecordFileAdded(str1, CommonRoles.executable); ((BuildReport)args.report).RecordFileAdded((string)args.stagingArea + "/UnityPlayer.dll", CommonRoles.engineLibrary); ((BuildReport)args.report).RecordFileAdded((string)args.stagingArea + "/UnityCrashHandler" + ((int)args.target == 19 ? "64" : "32") + ".exe", CommonRoles.crashHandler); foreach (string file in Directory.GetFiles((string)args.stagingArea, "*.pdb", SearchOption.TopDirectoryOnly)) { ((BuildReport)args.report).RecordFileAdded((string)args.stagingArea + "/" + Path.GetFileName(file), CommonRoles.debugInfo); } string str2 = (string)args.stagingArea + "/" + this.GetDestinationExeName(args); FileUtil.MoveFileOrDirectory(str1, str2); ((BuildReport)args.report).RecordFilesMoved(str1, str2); } DesktopStandalonePostProcessor.RecordCommonFiles(args, this.GetVariationFolder(args), (string)args.stagingArea); }
protected override string GetDestinationFolder(BuildPostProcessArgs args) => WindowsDesktopStandalonePostProcessor.ToWindowsPath(base.GetDestinationFolder(args));
protected override void CheckSafeProjectOverwrite(BuildPostProcessArgs args) { if (DesktopStandalonePostProcessor.GetInstallingIntoBuildsFolder(args)) { return; } string destinationFolder = base.GetDestinationFolder(args); if (base.GetCreateSolution(args)) { if (File.Exists((string)args.installPath)) { throw new UnityException("Build path contains project built without \"Create Visual Studio Solution\" option, which is incompatible with current build settings. Consider building your project into an empty directory."); } if (this.UseIl2Cpp) { string path1 = Path.Combine(destinationFolder, WindowsDesktopStandalonePostProcessor.kSolutionOutputFolder); string[] strArray = new string[6] { "x64/Debug", "x64/Release", "x64/Master", "x86/Debug", "x86/Release", "x86/Master" }; foreach (string path2 in strArray) { if (WindowsDesktopStandalonePostProcessor.IsMonoInFolder(Path.Combine(path1, path2))) { throw new UnityException("Build path contains project built with Mono scripting backend, while current project is using IL2CPP scripting backend. Consider building your project into an empty directory."); } } } else if (Directory.Exists(Path.Combine(destinationFolder, "Il2CppOutputProject"))) { throw new UnityException("Build path contains project built with IL2CPP scripting backend, while current project is using Mono scripting backend. Consider building your project into an empty directory."); } } else { string pathSafeProductName = DesktopStandalonePostProcessor.GetPathSafeProductName(args); string path1 = Path.Combine(destinationFolder, pathSafeProductName + ".sln"); string path2 = Path.Combine(destinationFolder, "UnityCommon.props"); if (File.Exists(path1) || File.Exists(path2)) { throw new UnityException("Build path contains project built with \"Create Visual Studio Solution\" option, which is incompatible with current build settings. Consider building your project into an empty directory."); } if (this.UseIl2Cpp) { if (WindowsDesktopStandalonePostProcessor.IsMonoInFolder(destinationFolder)) { throw new UnityException("Build path contains project built with Mono scripting backend, while current project is using IL2CPP scripting backend. Consider building your project into an empty directory."); } } else if (File.Exists(Path.Combine(destinationFolder, "GameAssembly.dll"))) { throw new UnityException("Build path contains project built with IL2CPP scripting backend, while current project is using Mono scripting backend. Consider building your project into an empty directory."); } } }