protected virtual void SetupStagingArea() { Directory.CreateDirectory(this.DataFolder); this.CopyNativePlugins(); this.CopyVirtualRealityDependencies(); PostprocessBuildPlayer.InstallStreamingAssets(this.DataFolder); if (this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); string str1 = this.StagingArea + "/Data"; string destinationFolder = this.DataFolder + "/Managed"; string str2 = destinationFolder + "/Resources"; string str3 = destinationFolder + "/Metadata"; IL2CPPUtils.RunIl2Cpp(str1, this.GetPlatformProvider(this.m_PostProcessArgs.target), (System.Action <string>)(s => {}), this.m_PostProcessArgs.usedClassRegistry, this.Development); FileUtil.CreateOrCleanDirectory(str2); IL2CPPUtils.CopyEmbeddedResourceFiles(str1, str2); FileUtil.CreateOrCleanDirectory(str3); IL2CPPUtils.CopyMetadataFiles(str1, str3); IL2CPPUtils.CopySymmapFile(str1 + "/Native", destinationFolder); } if (this.InstallingIntoBuildsFolder) { this.CopyDataForBuildsFolder(); } else { if (!this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); } this.RenameFilesInStagingArea(); } }
protected virtual void SetupStagingArea() { Directory.CreateDirectory(this.DataFolder); this.CopyNativePlugins(); this.CopyVirtualRealityDependencies(); PostprocessBuildPlayer.InstallStreamingAssets(this.DataFolder); if (this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); string text = this.StagingArea + "/Data"; string text2 = this.DataFolder + "/Managed"; string text3 = text2 + "/Resources"; string text4 = text2 + "/Metadata"; IL2CPPUtils.RunIl2Cpp(text, this.GetPlatformProvider(this.m_PostProcessArgs.target), delegate(string s) { }, this.m_PostProcessArgs.usedClassRegistry, this.Development); FileUtil.CreateOrCleanDirectory(text3); IL2CPPUtils.CopyEmbeddedResourceFiles(text, text3); FileUtil.CreateOrCleanDirectory(text4); IL2CPPUtils.CopyMetadataFiles(text, text4); IL2CPPUtils.CopySymmapFile(text + "/Native", text2); } if (this.InstallingIntoBuildsFolder) { this.CopyDataForBuildsFolder(); return; } if (!this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); } this.RenameFilesInStagingArea(); }
private void SetupStagingArea(BuildPostProcessArgs args, HashSet <string> filesToNotOverwrite) { List <string> cppPlugins; if (GetCreateSolution(args) && (args.target == BuildTarget.StandaloneWindows || args.target == BuildTarget.StandaloneWindows64)) { // For Windows Standalone player solution build, we want to copy plugins for all architectures as // the ultimate CPU architecture choice can be made from Visual Studio CopyNativePlugins(args, BuildTarget.StandaloneWindows, out cppPlugins); CopyNativePlugins(args, BuildTarget.StandaloneWindows64, out cppPlugins); } else { CopyNativePlugins(args, args.target, out cppPlugins); } CreateApplicationData(args); PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report); if (GetInstallingIntoBuildsFolder(args)) { CopyDataForBuildsFolder(args); } else { CopyVariationFolderIntoStagingArea(args, filesToNotOverwrite); if (UseIl2Cpp) { var il2cppPlatformProvider = GetPlatformProvider(args); IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, il2cppPlatformProvider, (cppOutputDir) => CopyCppPlugins(args, cppOutputDir, cppPlugins), args.usedClassRegistry); if (GetCreateSolution(args)) { ProcessIl2CppOutputForSolution(args, il2cppPlatformProvider, cppPlugins); } else { ProcessIl2CppOutputForBinary(args); } } else { var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(args.target); var managedStrippingLevel = PlayerSettings.GetManagedStrippingLevel(buildTargetGroup); AssemblyStripper.StripForMonoBackend(args.target, args.usedClassRegistry, managedStrippingLevel, args.report); } RenameFilesInStagingArea(args); } }
public void Execute(PostProcessorContext context) { if (((ScriptingImplementation)context.Get <ScriptingImplementation>("ScriptingBackend")) == ScriptingImplementation.IL2CPP) { if (this.OnProgress != null) { this.OnProgress(this, "Generating native assemblies"); } BuildTarget target = context.Get <BuildTarget>("BuildTarget"); string str = context.Get <string>("StagingArea"); string[] components = new string[] { str, "assets", "bin", "Data" }; string stagingAreaData = Paths.Combine(components); string[] textArray2 = new string[] { BuildPipeline.GetBuildToolsDirectory(target), "AndroidNativeLink.xml" }; string[] textArray3 = new string[] { stagingAreaData, "platform_native_link.xml" }; FileUtil.CopyFileOrDirectory(Paths.Combine(textArray2), Paths.Combine(textArray3)); AndroidTargetDevice device = context.Get <AndroidTargetDevice>("TargetDevice"); AndroidTargetDeviceType deviceType = new AndroidTargetDeviceARMv7(); if (device == AndroidTargetDevice.x86) { deviceType = new AndroidTargetDevicex86(); } if (this.OnProgress != null) { this.OnProgress(this, "Compiling native assemblies for " + deviceType.Architecture); } string tempFolder = Path.Combine(str, "Il2Cpp"); bool isDevelopmentBuild = context.Get <bool>("DevelopmentPlayer"); RuntimeClassRegistry runtimeClassRegistry = context.Get <RuntimeClassRegistry>("UsedClassRegistry"); AndroidIl2CppPlatformProvider platformProvider = new AndroidIl2CppPlatformProvider(target, deviceType, isDevelopmentBuild); IL2CPPUtils.RunIl2Cpp(tempFolder, stagingAreaData, platformProvider, null, runtimeClassRegistry, isDevelopmentBuild); AndroidTargetDeviceType type2 = null; if (device == AndroidTargetDevice.FAT) { type2 = new AndroidTargetDevicex86(); if (this.OnProgress != null) { this.OnProgress(this, "Compiling native assemblies for " + type2.Architecture); } platformProvider = new AndroidIl2CppPlatformProvider(target, type2, isDevelopmentBuild); IL2CPPUtils.RunCompileAndLink(tempFolder, stagingAreaData, platformProvider, null, runtimeClassRegistry, false); } this.FinalizeAndCleanup(str, stagingAreaData, tempFolder); this.CopySymbolMap(str, stagingAreaData, deviceType); if (type2 != null) { this.CopySymbolMap(str, stagingAreaData, type2); } } }
private void SetupStagingArea(BuildPostProcessArgs args, HashSet <string> filesToNotOverwrite) { List <string> cppPlugins; CopyNativePlugins(args, out cppPlugins); CreateApplicationData(args); PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report); if (GetInstallingIntoBuildsFolder(args)) { CopyDataForBuildsFolder(args); } else { CopyVariationFolderIntoStagingArea(args); if (GetCreateSolution(args)) { CopyPlayerSolutionIntoStagingArea(args, filesToNotOverwrite); } if (UseIl2Cpp) { var il2cppPlatformProvider = GetPlatformProvider(args); IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, il2cppPlatformProvider, (cppOutputDir) => CopyCppPlugins(args, cppOutputDir, cppPlugins), args.usedClassRegistry); if (GetCreateSolution(args)) { ProcessIl2CppOutputForSolution(args, il2cppPlatformProvider, cppPlugins); } else { ProcessIl2CppOutputForBinary(args); } } else { var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(args.target); var managedStrippingLevel = PlayerSettings.GetManagedStrippingLevel(buildTargetGroup); AssemblyStripper.StripForMonoBackend(args.target, args.usedClassRegistry, managedStrippingLevel, args.report); } RenameFilesInStagingArea(args); } }
private void SetupStagingArea(BuildPostProcessArgs args, HashSet <string> filesToNotOverwrite) { Directory.CreateDirectory(args.stagingAreaData); List <string> cppPlugins; CopyNativePlugins(args, out cppPlugins); if (args.target == BuildTarget.StandaloneWindows || args.target == BuildTarget.StandaloneWindows64) { CreateApplicationData(args); } PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report); if (GetInstallingIntoBuildsFolder(args)) { CopyDataForBuildsFolder(args); } else { CopyVariationFolderIntoStagingArea(args); if (GetCreateSolution(args)) { CopyPlayerSolutionIntoStagingArea(args, filesToNotOverwrite); } if (UseIl2Cpp) { var il2cppPlatformProvider = GetPlatformProvider(args); IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, il2cppPlatformProvider, (cppOutputDir) => CopyCppPlugins(args, cppOutputDir, cppPlugins), args.usedClassRegistry); if (GetCreateSolution(args)) { ProcessIl2CppOutputForSolution(args, il2cppPlatformProvider, cppPlugins); } else { ProcessIl2CppOutputForBinary(args); } } RenameFilesInStagingArea(args); } }
protected virtual void SetupStagingArea() { Directory.CreateDirectory(this.DataFolder); this.CopyNativePlugins(); if (this.m_PostProcessArgs.target == BuildTarget.StandaloneWindows || this.m_PostProcessArgs.target == BuildTarget.StandaloneWindows64) { this.CreateApplicationData(); } PostprocessBuildPlayer.InstallStreamingAssets(this.DataFolder); if (this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); string text = this.StagingArea + "/Data"; string text2 = this.DataFolder + "/Managed"; string text3 = text2 + "/Resources"; string text4 = text2 + "/Metadata"; IL2CPPUtils.RunIl2Cpp(text, this.GetPlatformProvider(this.m_PostProcessArgs.target), delegate(string s) { }, this.m_PostProcessArgs.usedClassRegistry, this.Development); FileUtil.CreateOrCleanDirectory(text3); IL2CPPUtils.CopyEmbeddedResourceFiles(text, text3); FileUtil.CreateOrCleanDirectory(text4); IL2CPPUtils.CopyMetadataFiles(text, text4); IL2CPPUtils.CopySymmapFile(text + "/Native/Data", text2); } if (this.InstallingIntoBuildsFolder) { this.CopyDataForBuildsFolder(); } else { if (!this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); } this.RenameFilesInStagingArea(); this.m_PostProcessArgs.report.AddFilesRecursive(this.StagingArea, ""); this.m_PostProcessArgs.report.RelocateFiles(this.StagingArea, ""); } }
protected virtual void SetupStagingArea() { Directory.CreateDirectory(this.DataFolder); this.CopyNativePlugins(); PostprocessBuildPlayer.InstallStreamingAssets(this.DataFolder); if (this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); IL2CPPUtils.RunIl2Cpp(this.StagingArea + "/Data", this.GetPlatformProvider(this.m_PostProcessArgs.target), delegate(string s) { }, this.m_PostProcessArgs.usedClassRegistry); } if (this.InstallingIntoBuildsFolder) { return; } if (!this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(); } this.RenameFilesInStagingArea(); }
private void SetupStagingArea(BuildPostProcessArgs args) { if (UseIl2Cpp && GetCreateSolution()) { throw new Exception("CreateSolution is not supported with IL2CPP build"); } Directory.CreateDirectory(args.stagingAreaData); List <string> cppPlugins; CopyNativePlugins(args, out cppPlugins); if (args.target == BuildTarget.StandaloneWindows || args.target == BuildTarget.StandaloneWindows64) { CreateApplicationData(args); } PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report); if (UseIl2Cpp) { CopyVariationFolderIntoStagingArea(args); IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, GetPlatformProvider(args), (cppOutputDir) => CopyCppPlugins(cppOutputDir, cppPlugins), args.usedClassRegistry); // Move GameAssembly next to game executable var il2cppOutputNativeDirectory = Path.Combine(args.stagingAreaData, "Native"); var gameAssemblyDirectory = GetDirectoryForGameAssembly(args); foreach (var file in Directory.GetFiles(il2cppOutputNativeDirectory)) { var fileName = Path.GetFileName(file); if (fileName.StartsWith(".")) { continue; // Skip files starting with ., as they weren't output by our tools and potentially belong to the OS (like .DS_Store on macOS) } FileUtil.MoveFileOrDirectory(file, Path.Combine(gameAssemblyDirectory, fileName)); } if (PlaceIL2CPPSymbolMapNextToExecutable()) { // Move symbol map to be next to game executable FileUtil.MoveFileOrDirectory(Paths.Combine(il2cppOutputNativeDirectory, "Data", "SymbolMap"), Path.Combine(args.stagingArea, "SymbolMap")); } // Move il2cpp data directory one directory up FileUtil.MoveFileOrDirectory(Path.Combine(il2cppOutputNativeDirectory, "Data"), Path.Combine(args.stagingAreaData, "il2cpp_data")); // Native directory is supposed to be empty at this point FileUtil.DeleteFileOrDirectory(il2cppOutputNativeDirectory); var dataBackupFolder = Path.Combine(args.stagingArea, GetIl2CppDataBackupFolderName(args)); FileUtil.CreateOrCleanDirectory(dataBackupFolder); // Move generated C++ code out of Data directory FileUtil.MoveFileOrDirectory(Path.Combine(args.stagingAreaData, "il2cppOutput"), Path.Combine(dataBackupFolder, "il2cppOutput")); if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(args.target))) { // Are we using IL2CPP code generation with the Mono runtime? If so, strip the assemblies so we can use them for metadata. StripAssembliesToLeaveOnlyMetadata(args.target, args.stagingAreaDataManaged); } else { // Otherwise, move them to temp data directory as il2cpp does not need managed assemblies to run FileUtil.MoveFileOrDirectory(args.stagingAreaDataManaged, Path.Combine(dataBackupFolder, "Managed")); } ProcessPlatformSpecificIL2CPPOutput(args); } if (GetInstallingIntoBuildsFolder(args)) { CopyDataForBuildsFolder(args); } else { if (!UseIl2Cpp) { CopyVariationFolderIntoStagingArea(args); } if (GetCreateSolution()) { CopyPlayerSolutionIntoStagingArea(args); } RenameFilesInStagingArea(args); } }
private void SetupStagingArea(BuildPostProcessArgs args) { if (this.UseIl2Cpp && this.GetCreateSolution()) { throw new Exception("CreateSolution is not supported with IL2CPP build"); } Directory.CreateDirectory(args.stagingAreaData); this.CopyNativePlugins(args); if (args.target == BuildTarget.StandaloneWindows || args.target == BuildTarget.StandaloneWindows64) { this.CreateApplicationData(args); } PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report); if (this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(args); IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, this.GetPlatformProvider(args), null, args.usedClassRegistry); string text = Path.Combine(args.stagingAreaData, "Native"); string directoryForGameAssembly = this.GetDirectoryForGameAssembly(args); string[] files = Directory.GetFiles(text); for (int i = 0; i < files.Length; i++) { string text2 = files[i]; string fileName = Path.GetFileName(text2); if (!fileName.StartsWith(".")) { FileUtil.MoveFileOrDirectory(text2, Path.Combine(directoryForGameAssembly, fileName)); } } if (this.PlaceIL2CPPSymbolMapNextToExecutable()) { FileUtil.MoveFileOrDirectory(Paths.Combine(new string[] { text, "Data", "SymbolMap" }), Path.Combine(args.stagingArea, "SymbolMap")); } FileUtil.MoveFileOrDirectory(Path.Combine(text, "Data"), Path.Combine(args.stagingAreaData, "il2cpp_data")); FileUtil.DeleteFileOrDirectory(text); string text3 = Path.Combine(args.stagingArea, this.GetIl2CppDataBackupFolderName(args)); FileUtil.CreateOrCleanDirectory(text3); FileUtil.MoveFileOrDirectory(Path.Combine(args.stagingAreaData, "il2cppOutput"), Path.Combine(text3, "il2cppOutput")); if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(args.target))) { DesktopStandalonePostProcessor.StripAssembliesToLeaveOnlyMetadata(args.target, args.stagingAreaDataManaged); } else { FileUtil.MoveFileOrDirectory(args.stagingAreaDataManaged, Path.Combine(text3, "Managed")); } this.ProcessPlatformSpecificIL2CPPOutput(args); } if (this.GetInstallingIntoBuildsFolder(args)) { this.CopyDataForBuildsFolder(args); } else { if (!this.UseIl2Cpp) { this.CopyVariationFolderIntoStagingArea(args); } if (this.GetCreateSolution()) { this.CopyPlayerSolutionIntoStagingArea(args); } this.RenameFilesInStagingArea(args); } }