public void Download() { using (var client = new WebClient()) { var tempFile = Path.GetTempFileName(); var tempDir = Path.GetTempPath(); var path = String.Format(FRAMEWORK_FMT, version); client.DownloadFile(new Uri(path), tempFile); var result = ExecuteBashCommand( String.Format("cp -R {0}/swift-framework-{1}/Frameworks/* {2}", tempDir, version, "Assets/Plugins/iOS/Frameworks/") ); AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate); PluginImporter[] importers = PluginImporter.GetImporters(BuildTarget.iOS); foreach (var importer in importers) { if (importer.assetPath.StartsWith("Assets/Plugins/iOS/Frameworks/Fritz") && importer.assetPath.EndsWith(".framework")) { importer.SetPlatformData(BuildTarget.iOS, "AddToEmbeddedBinaries", "true"); } } } }
protected Dictionary <string, List <PluginImporter> > GetCompatiblePlugins(string buildTargetName, string[] defines) { var pluginImporters = PluginImporter.GetImporters(buildTargetName); var plugins = pluginImporters .Where(pluginImporter => IsPluginDefinesCompatible(pluginImporter, buildTargetName, defines)); plugins = PluginImporter.FilterAssembliesByAssemblyVersion(plugins); var matchingPlugins = new Dictionary <string, List <PluginImporter> >(); foreach (var plugin in plugins) { string finalPluginPath = CalculateFinalPluginPath(buildTargetName, plugin); if (string.IsNullOrEmpty(finalPluginPath)) { continue; } if (!matchingPlugins.TryGetValue(finalPluginPath, out var pluginsList)) { pluginsList = new List <PluginImporter>(); matchingPlugins[finalPluginPath] = pluginsList; } pluginsList.Add(plugin); } return(matchingPlugins); }
// workaround for https://issuetracker.unity3d.com/issues/plugins-not-copied-to-the-standalone-plugin-folder-when-they-are-marked-to-be-included-in-build private static void CopyPluginsForStandaloneBuildIfRequired(BuildTarget buildTarget) { if (PlatformHelpers.IsStandaloneOSX(buildTarget)) { const string pluginBundle = "StreamAlpha.bundle"; foreach (var pluginImporter in PluginImporter.GetImporters(buildTarget)) { if (pluginImporter.assetPath.EndsWith(pluginBundle)) { var appDirectory = EditorUserBuildSettings.GetBuildLocation(buildTarget); var destination = Path.Combine(appDirectory, Path.Combine("Contents/Plugins/", pluginBundle)); var source = pluginImporter.assetPath; bool shouldCopy = !Directory.Exists(destination) || GetLastSourceWriteTimeUtc(source) > GetLastSourceWriteTimeUtc(destination); if (shouldCopy) { CopyDirectoryRecursive(source, destination); } } } } }
public void Execute(PostProcessorContext context) { if (this.OnProgress != null) { this.OnProgress(this, "Processing native plugins"); } this._stagingArea = context.Get <string>("StagingArea"); string str = context.Get <string>("TargetLibrariesFolder"); context.Set <bool>("HasJarPlugins", false); this._pluginsFolder = Path.Combine(this._stagingArea, "plugins"); Directory.CreateDirectory(this._pluginsFolder); this._aarFolder = Path.Combine(this._stagingArea, "aar"); Directory.CreateDirectory(this._aarFolder); BuildTarget target = context.Get <BuildTarget>("BuildTarget"); foreach (PluginDesc desc in PluginImporter.GetExtensionPlugins(target)) { string pluginTargetCPU = desc.architecture.ToString(); this.ProcessPlugin(context, desc.pluginPath, pluginTargetCPU); } foreach (PluginImporter importer in PluginImporter.GetImporters(target)) { string assetPath = importer.assetPath; if (Directory.Exists(assetPath) && AndroidLibraries.IsAndroidLibraryProject(assetPath)) { FileUtil.CopyDirectoryRecursiveForPostprocess(assetPath, Path.Combine(str, Path.GetFileName(assetPath)), true); } this.UpgradePluginCPU(importer, target); string platformData = importer.GetPlatformData(target, "CPU"); this.ProcessPlugin(context, assetPath, platformData); } }
public override void GenerateCSharpProject(CSharpProject project, string assemblyName, IEnumerable <string> sourceFiles, IEnumerable <string> defines, IEnumerable <CSharpProject> additionalProjectReferences) { MetroAssemblyCSharpCreator.AssemblyCSharpPlugin plugin; string[] strArray2; string[] strArray3; WSASDK wsaSDK = EditorUserBuildSettings.wsaSDK; if (wsaSDK == WSASDK.UniversalSDK81) { wsaSDK = WSASDK.SDK81; } string playbackEngineDirectory = BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.WSAPlayer, BuildOptions.CompressTextures); if (additionalProjectReferences != null) { string directoryName = Path.GetDirectoryName(project.Path); foreach (CSharpProject project2 in additionalProjectReferences) { string strB = Path.GetDirectoryName(project2.Path); if (string.Compare(directoryName, strB, true) == 0) { throw new Exception($"Projects {directoryName} and {strB} should be in different folders."); } } } List <MetroAssemblyCSharpCreator.AssemblyCSharpPlugin> plugins = new List <MetroAssemblyCSharpCreator.AssemblyCSharpPlugin>(); string[] strArray = new string[] { ".dll", ".winmd" }; string fullPath = Path.GetFullPath(Path.Combine(Application.dataPath, "..")); foreach (PluginImporter importer in PluginImporter.GetImporters(BuildTarget.WSAPlayer)) {
public void OnPreprocessBuild(BuildTarget target, string path) { TriLibSettings.UpdateBatchSettings(); var pluginsBasePath = TriLibProjectUtils.FindPathRelativeToProject("Plugins"); var buildTarget = target; #endif if (buildTarget == BuildTarget.iOS) { #if TRILIB_USE_IOS_SIMULATOR var pluginsSuffix = ".debug.a"; #else var pluginsSuffix = "release.a"; #endif #if TRILIB_ENABLE_IOS_FILE_SHARING IOSFileSharingEnabled = true; #else IOSFileSharingEnabled = false; #endif var iOSImporters = PluginImporter.GetImporters(BuildTarget.iOS); foreach (var importer in iOSImporters) { if (importer.isNativePlugin) { if (importer.assetPath.StartsWith(string.Format((string)"{0}/iOS/", (object)pluginsBasePath))) { importer.SetIncludeInBuildDelegate(assetPath => importer.assetPath.EndsWith(pluginsSuffix)); } } } if (!UnityEditorInternal.InternalEditorUtility.inBatchMode) { #if UNITY_EDITOR_OSX EditorUtility.DisplayDialog("TriLib", "Warning: Bitcode is not supported by TriLib and will be disabled.", "Ok"); #else EditorUtility.DisplayDialog("TriLib", "Warning:\nBitcode is not supported. You should disable it on your project settings.", "Ok"); #endif } } var allImporters = PluginImporter.GetImporters(buildTarget); foreach (var importer in allImporters) { if (!importer.isNativePlugin) { if (importer.assetPath == string.Format((string)"{0}/ICSharpCode.SharpZipLib.dll", (object)pluginsBasePath)) { #if TRILIB_USE_ZIP importer.SetIncludeInBuildDelegate(assetPath => PlayerSettings.GetScriptingBackend(BuildPipeline.GetBuildTargetGroup(buildTarget)) != ScriptingImplementation.WinRTDotNET); #else importer.SetIncludeInBuildDelegate(assetPath => false); #endif } } } }
public void OnPreprocessBuild(BuildTarget target, string path) { var pluginsBasePath = TriLibProjectUtils.FindPathRelativeToProject("Plugins"); var buildTarget = target; #endif if (buildTarget == BuildTarget.iOS) { var pluginsLabel = UnityEditorInternal.InternalEditorUtility.inBatchMode || EditorUtility.DisplayDialog("TriLib", "Building to iOS Device (iPhone, iPad) or iOS Simulator?", "release", "debug") ? "_TriLib_iOS_Device_" : "_TriLib_iOS_Simulator_"; #if UNITY_EDITOR_OSX _iosFileSharingEnabled = UnityEditorInternal.InternalEditorUtility.inBatchMode || EditorUtility.DisplayDialog("TriLib", "Enable iOS File Sharing?", "Yes", "No"); #endif var iOSImporters = PluginImporter.GetImporters(BuildTarget.iOS); foreach (var importer in iOSImporters) { if (importer.isNativePlugin) { if (importer.assetPath.StartsWith(string.Format((string)"{0}/iOS/", (object)pluginsBasePath))) { importer.SetIncludeInBuildDelegate(assetPath => importer.assetPath.EndsWith(pluginsLabel)); } } } if (!UnityEditorInternal.InternalEditorUtility.inBatchMode) { #if UNITY_EDITOR_OSX EditorUtility.DisplayDialog("TriLib", "Warning: Bitcode is not supported by TriLib and will be disabled.", "Ok"); #else EditorUtility.DisplayDialog("TriLib", "Warning:\nBitcode is not supported. You should disable it on your project settings.\nZLIB library should be included in your project frameworks.", "Ok"); #endif } } var allImporters = PluginImporter.GetImporters(buildTarget); foreach (var importer in allImporters) { if (!importer.isNativePlugin) { if (importer.assetPath == string.Format((string)"{0}/ICSharpCode.SharpZipLib.dll", (object)pluginsBasePath)) { #if TRILIB_USE_ZIP importer.SetIncludeInBuildDelegate(assetPath => PlayerSettings.GetScriptingBackend(BuildPipeline.GetBuildTargetGroup(buildTarget)) != ScriptingImplementation.WinRTDotNET); #else importer.SetIncludeInBuildDelegate(assetPath => false); #endif } } } }
public void CheckPluginsImported() { bool pluginFound = false; PluginImporter[] importers = PluginImporter.GetImporters(BuildTarget.StandaloneWindows64); foreach (PluginImporter importer in importers) { if (importer.assetPath.Contains("OVRPlugin")) { pluginFound = true; break; } } Assert.IsTrue(pluginFound, "Plugins failed to import."); }
public void CheckPluginsImported() { bool pluginFound = false; PluginImporter[] importers = PluginImporter.GetImporters(BuildTarget.WSAPlayer); foreach (PluginImporter importer in importers) { if (importer.assetPath.Contains("Holographic")) { pluginFound = true; break; } } Assert.IsTrue(pluginFound, "Plugins failed to import."); }
private static bool CheckPlatform(out string Msg) { Msg = string.Empty; #if UNITY_WSA_8_0 Msg = "The Wwise Unity integration does not support the Windows Store 8.0 SDK."; return(false); #else // Start by checking if the integration supports the platform switch (EditorUserBuildSettings.activeBuildTarget) { case BuildTarget.PSM: case BuildTarget.SamsungTV: #if UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 case BuildTarget.BlackBerry: case BuildTarget.StandaloneGLESEmu: case BuildTarget.WebPlayer: case BuildTarget.WebPlayerStreamed: #endif case BuildTarget.Tizen: case BuildTarget.WebGL: Msg = "The Wwise Unity integration does not support this platform."; return(false); } // Then check if the integration is installed for this platform PluginImporter[] importers = PluginImporter.GetImporters(EditorUserBuildSettings.activeBuildTarget); bool found = false; foreach (PluginImporter imp in importers) { if (imp.assetPath.Contains("AkSoundEngine")) { found = true; break; } } if (!found) { Msg = "The Wwise Unity integration for the " + EditorUserBuildSettings.activeBuildTarget.ToString() + " platform is currently not installed."; return(false); } return(true); #endif }
public void OnPreprocessBuild(UnityEditor.BuildTarget target, string path) { StringBuilder warningStringBuilder = new StringBuilder(); PluginImporter[] pluginImporters = PluginImporter.GetImporters(target); foreach (PluginImporter pluginImporter in pluginImporters) { NativePlugin plugin = GetPluginByName(pluginImporter.GetEditorData("PLUGIN_NAME")); if (plugin != null) { string version = pluginImporter.GetEditorData("PLUGIN_VERSION"); if (plugin.Version != version) { warningStringBuilder.AppendFormat(@"Plugin version number mismatch: ""{0}"" is set to ""{1}"", while ""{2}"" was built with ""{3}""" + '\n', plugin.Name, plugin.Version, target.ToString(), version); } string buildNumberStr = pluginImporter.GetEditorData("PLUGIN_BUILD_NUMBER"); int buildNumber; if (int.TryParse(buildNumberStr, out buildNumber)) { if (plugin.BuildNumber != buildNumber) { warningStringBuilder.AppendFormat(@"Plugin build number mismatch: ""{0}"" is set to ""{1}"", while ""{2}"" was built with ""{3}""" + '\n', plugin.Name, plugin.BuildNumber, target.ToString(), buildNumber); } } string buildTypeStr = pluginImporter.GetEditorData("BUILD_TYPE"); BuildType buildType = (BuildType)Enum.Parse(typeof(BuildType), buildTypeStr, true); if ((EditorUserBuildSettings.development && buildType == BuildType.Release) || (!EditorUserBuildSettings.development && buildType == BuildType.Debug)) { warningStringBuilder.AppendFormat(@"Plugin build type mismatch: current build is set to development=""{0}"", while plugin ""{1}"" for ""{2}"" is ""{3}""." + '\n', EditorUserBuildSettings.development, plugin.Name, target, buildType); } } } string warnings = warningStringBuilder.ToString(); if (!string.IsNullOrEmpty(warnings)) { Debug.LogWarning(warnings); } }
static void UpdatePluginImporterVLCData() { Debug.Log("MPMP_VLC_Utils.SetPlatformVLCData"); BuildTarget target = EditorUserBuildSettings.activeBuildTarget; PluginImporter[] PIL = PluginImporter.GetImporters(target); string checkStr = ""; if (target == BuildTarget.StandaloneWindows) { checkStr = "/MPMP/Plugins/x86/plugins"; } else if (target == BuildTarget.StandaloneWindows64) { checkStr = "/MPMP/Plugins/x86_64/plugins"; } PIL.ToList().ForEach((pi) => { if (pi.assetPath.Contains(checkStr)) { // Debug.Log(pi.assetPath); pi.SetCompatibleWithAnyPlatform(false); pi.SetCompatibleWithEditor(true); if (target == BuildTarget.StandaloneWindows) { pi.SetEditorData("CPU", "x86"); pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false); } else if (target == BuildTarget.StandaloneWindows64) { pi.SetEditorData("CPU", "x86_64"); pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false); } pi.SetEditorData("OS", "Windows"); pi.SaveAndReimport(); } }); }
private void CopyNativePlugins() { string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target); IPluginImporterExtension extension = new DesktopPluginImporterExtension(); string stagingAreaPluginsFolder = this.StagingAreaPluginsFolder; string path = Path.Combine(stagingAreaPluginsFolder, "x86"); string str4 = Path.Combine(stagingAreaPluginsFolder, "x86_64"); bool flag = false; bool flag2 = false; bool flag3 = false; foreach (PluginImporter importer in PluginImporter.GetImporters(this.m_PostProcessArgs.target)) { string str6; BuildTarget platform = this.m_PostProcessArgs.target; if (!importer.isNativePlugin) { continue; } if (string.IsNullOrEmpty(importer.assetPath)) { Debug.LogWarning("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString()); continue; } if (!flag) { Directory.CreateDirectory(stagingAreaPluginsFolder); flag = true; } bool flag4 = Directory.Exists(importer.assetPath); string platformData = importer.GetPlatformData(platform, "CPU"); if (platformData != null) { int num2; if (< > f__switch$map16 == null) { Dictionary <string, int> dictionary = new Dictionary <string, int>(3); dictionary.Add("x86", 0); dictionary.Add("x86_64", 1); dictionary.Add("None", 2);
private IEnumerable <Plugin> GetPluginsFor(BuildTarget target) { var buildTargetName = BuildPipeline.GetBuildTargetName(target); var pluginImpExtension = GetPluginImpExtension(); foreach (PluginImporter imp in PluginImporter.GetImporters(target)) { if (!IsPluginCompatibleWithCurrentBuild(target, imp)) { continue; } // Skip managed DLLs. if (!imp.isNativePlugin) { continue; } // HACK: This should never happen. if (string.IsNullOrEmpty(imp.assetPath)) { UnityEngine.Debug.LogWarning("Got empty plugin importer path for " + target); continue; } var destinationPath = pluginImpExtension.CalculateFinalPluginPath(buildTargetName, imp); if (string.IsNullOrEmpty(destinationPath)) { continue; } var plugin = GetPluginFor(imp, target, destinationPath); if (plugin != null) { yield return(plugin); } } }
private static IEnumerable <PluginImporter> GetIncludedPlugins(BuildTargetGroup targetGroup, BuildTarget target) { var list = new List <PluginImporter>(); var importers = PluginImporter.GetImporters(targetGroup, target); foreach (var plugin in importers) { // Skip anything in the /Liminal folder if (plugin.assetPath.IndexOf("Assets/Liminal", StringComparison.OrdinalIgnoreCase) > -1) { continue; } // Skip Unity extensions if (plugin.assetPath.IndexOf("Editor/Data/UnityExtensions", StringComparison.OrdinalIgnoreCase) > -1) { continue; } // Skip anything located in the Packages/ folder of the main project if (plugin.assetPath.IndexOf("Packages/", StringComparison.OrdinalIgnoreCase) == 0) { continue; } // Skip native plugins, and anything that won't normally be included in a build if (plugin.isNativePlugin || !plugin.ShouldIncludeInBuild()) { continue; } list.Add(plugin); } return(list); }
private static void GetAssemblies() { var list = new List <PluginImporter>(); var importers = PluginImporter.GetImporters(BuildTargetGroup.Android, BuildTarget.Android); foreach (var plugin in importers) { // Skip Unity extensions if (plugin.assetPath.IndexOf("Editor/Data/UnityExtensions", StringComparison.OrdinalIgnoreCase) > -1) { continue; } // Skip native plugins, and anything that won't normally be included in a build if (plugin.isNativePlugin || !plugin.ShouldIncludeInBuild()) { continue; } list.Add(plugin); } _assemblies.Clear(); var assemblycs = GetAssemblyByName("Assembly-CSharp"); _assemblies.Add(assemblycs); foreach (var plugin in list) { var assembly = Assembly.Load(AssemblyName.GetAssemblyName(plugin.assetPath)); if (!assembly.GetName().FullName.Contains("Liminal.SDK")) { _assemblies.Add(assembly); } } }
public void OnPreprocessBuild(BuildTarget target, string path) { var buildTarget = target; #endif if (buildTarget == BuildTarget.WebGL) { #if UNITY_2019_1_OR_NEWER var pluginsLabel = "_TriLib_Emscripten_1.38.11_"; #elif UNITY_2018_3_OR_NEWER var pluginsLabel = "_TriLib_Emscripten_1.37.40_"; #elif UNITY_2018_2_OR_NEWER var pluginsLabel = "_TriLib_Emscripten_1.37.33_"; #elif UNITY_2017_4_OR_NEWER var pluginsLabel = "_TriLib_Emscripten_1.37.3_"; #else throw new Exception("Your Unity WebGL version is not supported by TriLib."); #endif var webGLImporters = PluginImporter.GetImporters(BuildTarget.WebGL); foreach (var importer in webGLImporters) { if (importer.isNativePlugin) { var asset = AssetDatabase.LoadMainAssetAtPath(importer.assetPath); var labels = AssetDatabase.GetLabels(asset); if (labels.Contains("_TriLib_WebGL_")) { importer.SetIncludeInBuildDelegate(assetPath => labels.Contains(pluginsLabel)); } } } } else if (buildTarget == BuildTarget.iOS) { var pluginsLabel = EditorUtility.DisplayDialog("TriLib", "Building to iOS Device (iPhone, iPad) or iOS Simulator?", "Device", "Simulator") ? "_TriLib_iOS_Device_" : "_TriLib_iOS_Simulator_"; #if UNITY_EDITOR_OSX _iosFileSharingEnabled = EditorUtility.DisplayDialog("TriLib", "Enable iOS File Sharing?", "Yes", "No"); #endif var iOSImporters = PluginImporter.GetImporters(BuildTarget.iOS); foreach (var importer in iOSImporters) { if (importer.isNativePlugin) { var asset = AssetDatabase.LoadMainAssetAtPath(importer.assetPath); var labels = AssetDatabase.GetLabels(asset); if (labels.Contains("_TriLib_iOS_")) { importer.SetIncludeInBuildDelegate(assetPath => labels.Contains(pluginsLabel)); } } } #if UNITY_EDITOR_OSX EditorUtility.DisplayDialog("TriLib", "Warning: Bitcode is not supported by TriLib and will be disabled.", "Ok"); #else EditorUtility.DisplayDialog("TriLib", "Warning:\nBitcode is not supported. You should disable it on your project settings.\nZLIB library should be included in your project frameworks.", "Ok"); #endif } #if !UNITY_2018_2_OR_NEWER else if (buildTarget == BuildTarget.Android) { var androidImporters = PluginImporter.GetImporters(BuildTarget.Android); foreach (var importer in androidImporters) { if (importer.isNativePlugin) { var asset = AssetDatabase.LoadMainAssetAtPath(importer.assetPath); var labels = AssetDatabase.GetLabels(asset); if (labels.Contains("_TriLib_Android_") && labels.Contains("_TriLib_Android_ARM64_")) { importer.SetIncludeInBuildDelegate(assetPath => false); } } } } #endif var allImporters = PluginImporter.GetImporters(buildTarget); foreach (var importer in allImporters) { if (!importer.isNativePlugin) { var asset = AssetDatabase.LoadMainAssetAtPath(importer.assetPath); var labels = AssetDatabase.GetLabels(asset); if (labels.Contains("_TriLib_ZIP_")) { #if TRILIB_USE_ZIP importer.SetIncludeInBuildDelegate(assetPath => PlayerSettings.GetScriptingBackend(BuildPipeline.GetBuildTargetGroup(buildTarget)) != ScriptingImplementation.WinRTDotNET); #else importer.SetIncludeInBuildDelegate(assetPath => false); #endif } } } }
private void CopyNativePlugins() { string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target); IPluginImporterExtension extension = new DesktopPluginImporterExtension(); string stagingAreaPluginsFolder = this.StagingAreaPluginsFolder; string path = Path.Combine(stagingAreaPluginsFolder, "x86"); string str4 = Path.Combine(stagingAreaPluginsFolder, "x86_64"); bool flag = false; bool flag2 = false; bool flag3 = false; foreach (PluginImporter importer in PluginImporter.GetImporters(this.m_PostProcessArgs.target)) { BuildTarget platform = this.m_PostProcessArgs.target; if (importer.isNativePlugin) { if (string.IsNullOrEmpty(importer.assetPath)) { Debug.LogWarning("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString()); continue; } if (!flag) { Directory.CreateDirectory(stagingAreaPluginsFolder); flag = true; } bool flag4 = Directory.Exists(importer.assetPath); switch (importer.GetPlatformData(platform, "CPU")) { case "x86": switch (platform) { case BuildTarget.StandaloneOSXIntel64: case BuildTarget.StandaloneWindows64: case BuildTarget.StandaloneLinux64: { continue; } } if (!flag2) { Directory.CreateDirectory(path); flag2 = true; } break; case "x86_64": if ((((platform != BuildTarget.StandaloneOSXIntel64) && (platform != BuildTarget.StandaloneOSXUniversal)) && ((platform != BuildTarget.StandaloneWindows64) && (platform != BuildTarget.StandaloneLinux64))) && (platform != BuildTarget.StandaloneLinuxUniversal)) { continue; } if (!flag3) { Directory.CreateDirectory(str4); flag3 = true; } break; case "None": { continue; } } string str6 = extension.CalculateFinalPluginPath(buildTargetName, importer); if (!string.IsNullOrEmpty(str6)) { string target = Path.Combine(stagingAreaPluginsFolder, str6); if (flag4) { FileUtil.CopyDirectoryRecursive(importer.assetPath, target); } else { FileUtil.UnityFileCopy(importer.assetPath, target); } } } } foreach (PluginDesc desc in PluginImporter.GetExtensionPlugins(this.m_PostProcessArgs.target)) { if (!flag) { Directory.CreateDirectory(stagingAreaPluginsFolder); flag = true; } string str8 = Path.Combine(stagingAreaPluginsFolder, Path.GetFileName(desc.pluginPath)); if (!Directory.Exists(str8) && !File.Exists(str8)) { if (Directory.Exists(desc.pluginPath)) { FileUtil.CopyDirectoryRecursive(desc.pluginPath, str8); } else { FileUtil.CopyFileIfExists(desc.pluginPath, str8, false); } } } }
private void CopyNativePlugins(BuildPostProcessArgs args, BuildTarget buildTarget, out List <string> cppPlugins) { string buildTargetName = BuildPipeline.GetBuildTargetName(buildTarget); IPluginImporterExtension pluginImpExtension = new DesktopPluginImporterExtension(); string pluginsFolder = GetStagingAreaPluginsFolder(args); bool haveCreatedPluginsFolder = false; var createdFolders = new HashSet <string>(); cppPlugins = new List <string>(); foreach (PluginImporter imp in PluginImporter.GetImporters(buildTarget)) { // Skip .cpp files. They get copied to il2cpp output folder just before code compilation if (DesktopPluginImporterExtension.IsCppPluginFile(imp.assetPath)) { cppPlugins.Add(imp.assetPath); continue; } // Skip managed DLLs. if (!imp.isNativePlugin) { continue; } // HACK: This should never happen. if (string.IsNullOrEmpty(imp.assetPath)) { UnityEngine.Debug.LogWarning("Got empty plugin importer path for " + buildTarget); continue; } if (!haveCreatedPluginsFolder) { Directory.CreateDirectory(pluginsFolder); haveCreatedPluginsFolder = true; } bool isDirectory = Directory.Exists(imp.assetPath); string destinationPath = pluginImpExtension.CalculateFinalPluginPath(buildTargetName, imp); if (string.IsNullOrEmpty(destinationPath)) { continue; } string finalDestinationPath = Path.Combine(pluginsFolder, destinationPath); var finalDestinationFolder = Path.GetDirectoryName(finalDestinationPath); if (!createdFolders.Contains(finalDestinationFolder)) { Directory.CreateDirectory(finalDestinationFolder); createdFolders.Add(finalDestinationFolder); } if (isDirectory) { // Since we may be copying from Assets make sure to not include .meta files to the build FileUtil.CopyDirectoryRecursive(imp.assetPath, finalDestinationPath, overwrite: false, ignoreMeta: true); } else { FileUtil.UnityFileCopy(imp.assetPath, finalDestinationPath); } } // TODO: Move all plugins using GetExtensionPlugins to GetImporters and remove GetExtensionPlugins foreach (UnityEditorInternal.PluginDesc pluginDesc in PluginImporter.GetExtensionPlugins(buildTarget)) { if (!haveCreatedPluginsFolder) { Directory.CreateDirectory(pluginsFolder); haveCreatedPluginsFolder = true; } string pluginCopyPath = Path.Combine(pluginsFolder, Path.GetFileName(pluginDesc.pluginPath)); // Plugins copied through GetImporters take priority, don't overwrite if (Directory.Exists(pluginCopyPath) || File.Exists(pluginCopyPath)) { continue; } if (Directory.Exists(pluginDesc.pluginPath)) { FileUtil.CopyDirectoryRecursive(pluginDesc.pluginPath, pluginCopyPath); } else { FileUtil.CopyFileIfExists(pluginDesc.pluginPath, pluginCopyPath, false); } } }
public override void CopyPlugins() { string[] strArray = new string[] { ".cpp", ".c", ".h" }; foreach (PluginImporter importer in PluginImporter.GetImporters(base.Target)) {
private void CopyNativePlugins(BuildPostProcessArgs args, out List <string> cppPlugins) { string buildTargetName = BuildPipeline.GetBuildTargetName(args.target); IPluginImporterExtension pluginImpExtension = new DesktopPluginImporterExtension(); string pluginsFolder = GetStagingAreaPluginsFolder(args); string subDir32Bit = Path.Combine(pluginsFolder, "x86"); string subDir64Bit = Path.Combine(pluginsFolder, "x86_64"); bool haveCreatedPluginsFolder = false; bool haveCreatedSubDir32Bit = false; bool haveCreatedSubDir64Bit = false; cppPlugins = new List <string>(); foreach (PluginImporter imp in PluginImporter.GetImporters(args.target)) { BuildTarget t = args.target; // Skip .cpp files. They get copied to il2cpp output folder just before code compilation if (DesktopPluginImporterExtension.IsCppPluginFile(imp.assetPath)) { cppPlugins.Add(imp.assetPath); continue; } // Skip managed DLLs. if (!imp.isNativePlugin) { continue; } // HACK: This should never happen. if (string.IsNullOrEmpty(imp.assetPath)) { UnityEngine.Debug.LogWarning("Got empty plugin importer path for " + args.target.ToString()); continue; } if (!haveCreatedPluginsFolder) { Directory.CreateDirectory(pluginsFolder); haveCreatedPluginsFolder = true; } bool isDirectory = Directory.Exists(imp.assetPath); string cpu = imp.GetPlatformData(t, "CPU"); switch (cpu) { case "x86": if (t == BuildTarget.StandaloneWindows64 || t == BuildTarget.StandaloneLinux64) { continue; } if (!haveCreatedSubDir32Bit) { Directory.CreateDirectory(subDir32Bit); haveCreatedSubDir32Bit = true; } break; case "x86_64": if (t != BuildTarget.StandaloneOSX && t != BuildTarget.StandaloneWindows64 && t != BuildTarget.StandaloneLinux64) { continue; } if (!haveCreatedSubDir64Bit) { Directory.CreateDirectory(subDir64Bit); haveCreatedSubDir64Bit = true; } break; // This is a special case for CPU targets, means no valid CPU is selected case "None": continue; } string destinationPath = pluginImpExtension.CalculateFinalPluginPath(buildTargetName, imp); if (string.IsNullOrEmpty(destinationPath)) { continue; } string finalDestinationPath = Path.Combine(pluginsFolder, destinationPath); if (isDirectory) { FileUtil.CopyDirectoryRecursive(imp.assetPath, finalDestinationPath); } else { FileUtil.UnityFileCopy(imp.assetPath, finalDestinationPath); } } // TODO: Move all plugins using GetExtensionPlugins to GetImporters and remove GetExtensionPlugins foreach (UnityEditorInternal.PluginDesc pluginDesc in PluginImporter.GetExtensionPlugins(args.target)) { if (!haveCreatedPluginsFolder) { Directory.CreateDirectory(pluginsFolder); haveCreatedPluginsFolder = true; } string pluginCopyPath = Path.Combine(pluginsFolder, Path.GetFileName(pluginDesc.pluginPath)); // Plugins copied through GetImporters take priority, don't overwrite if (Directory.Exists(pluginCopyPath) || File.Exists(pluginCopyPath)) { continue; } if (Directory.Exists(pluginDesc.pluginPath)) { FileUtil.CopyDirectoryRecursive(pluginDesc.pluginPath, pluginCopyPath); } else { FileUtil.CopyFileIfExists(pluginDesc.pluginPath, pluginCopyPath, false); } } }
private void CopyNativePlugins() { string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target); IPluginImporterExtension pluginImporterExtension = new DesktopPluginImporterExtension(); string stagingAreaPluginsFolder = this.StagingAreaPluginsFolder; string path = Path.Combine(stagingAreaPluginsFolder, "x86"); string path2 = Path.Combine(stagingAreaPluginsFolder, "x86_64"); bool flag = false; bool flag2 = false; bool flag3 = false; PluginImporter[] importers = PluginImporter.GetImporters(this.m_PostProcessArgs.target); for (int i = 0; i < importers.Length; i++) { PluginImporter pluginImporter = importers[i]; BuildTarget target = this.m_PostProcessArgs.target; if (pluginImporter.isNativePlugin) { if (string.IsNullOrEmpty(pluginImporter.assetPath)) { Debug.LogWarning("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString()); } else { if (!flag) { Directory.CreateDirectory(stagingAreaPluginsFolder); flag = true; } bool flag4 = Directory.Exists(pluginImporter.assetPath); string platformData = pluginImporter.GetPlatformData(target, "CPU"); string text = platformData; switch (text) { case "x86": if (target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneWindows64 || target == BuildTarget.StandaloneLinux64) { goto IL_22F; } if (!flag2) { Directory.CreateDirectory(path); flag2 = true; } break; case "x86_64": if (target != BuildTarget.StandaloneOSXIntel64 && target != BuildTarget.StandaloneOSXUniversal && target != BuildTarget.StandaloneWindows64 && target != BuildTarget.StandaloneLinux64 && target != BuildTarget.StandaloneLinuxUniversal) { goto IL_22F; } if (!flag3) { Directory.CreateDirectory(path2); flag3 = true; } break; case "None": goto IL_22F; } string text2 = pluginImporterExtension.CalculateFinalPluginPath(buildTargetName, pluginImporter); if (!string.IsNullOrEmpty(text2)) { string text3 = Path.Combine(stagingAreaPluginsFolder, text2); if (flag4) { FileUtil.CopyDirectoryRecursive(pluginImporter.assetPath, text3); } else { FileUtil.UnityFileCopy(pluginImporter.assetPath, text3); } } } } IL_22F :; } foreach (PluginDesc current in PluginImporter.GetExtensionPlugins(this.m_PostProcessArgs.target)) { if (!flag) { Directory.CreateDirectory(stagingAreaPluginsFolder); flag = true; } string text4 = Path.Combine(stagingAreaPluginsFolder, Path.GetFileName(current.pluginPath)); if (!Directory.Exists(text4) && !File.Exists(text4)) { if (Directory.Exists(current.pluginPath)) { FileUtil.CopyDirectoryRecursive(current.pluginPath, text4); } else { FileUtil.CopyFileIfExists(current.pluginPath, text4, false); } } } }
internal static void PostProcess(BuildTarget target, string stagingAreaDataUpperCase, string stagingArea, string stagingAreaDataManaged, string playerPackage, string installPath, string companyName, string productName, BuildOptions options) { bool flag = (options & BuildOptions.AutoRunPlayer) != BuildOptions.CompressTextures; bool developmentPlayer = (options & BuildOptions.Development) != BuildOptions.CompressTextures; float numSteps = !flag ? ((float)2) : ((float)5); progress.Reset(numSteps); if (PlayerSettings.Tizen.deploymentTargetType == 2) { flag = false; } Regex regex = new Regex("[^a-zA-Z_-]"); string normalizedProductName = regex.Replace(productName, "").ToLower(); string str2 = Path.Combine(playerPackage, "assets"); if (!IsValidTizenBundleIdentifier(PlayerSettings.bundleIdentifier)) { string message = "Please set the Bundle Identifier in the Player Settings."; message = (message + " The value must follow the convention 'com.YourCompanyName.YourProductName'") + " and can contain alphanumeric characters and underscore." + "\nEach segment must not start with a numeric character or underscore."; Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings"); TizenUtilities.ShowErrDlgAndThrow("Bundle Identifier has not been set up correctly", message); } if (TizenUtilities.ThisIsAUnityTestProject()) { PlayerSettings.Tizen.deploymentTargetType = 0; } if (PlayerSettings.Tizen.deploymentTargetType < 0) { string str4 = "Please select a Tizen deployment target."; str4 = str4 + " Press the Discover button in the Publishing section of Player Settings." + " Then select a type of target to get a list of available targets to select."; Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings"); TizenUtilities.ShowErrDlgAndThrow("Tizen Deployment Target has not been selected.", str4); } TizenUtilities.PrepareToolPaths(); TizenUtilities.ValidateSigningProfile(stagingArea); if (flag) { TizenUtilities.AssertAnyDeviceReady(new Command.WaitingForProcessToExit(new Progress("Tizen Device Detection", "Detecting attached devices", progress.Get()).Show)); } Directory.CreateDirectory(Path.Combine(stagingArea, "lib")); Directory.CreateDirectory(Path.Combine(stagingArea, "res")); Directory.CreateDirectory(Path.Combine(stagingArea, "setting")); string path = Path.Combine(stagingArea, "shared"); Directory.CreateDirectory(path); string str9 = Path.Combine(path, "res"); Directory.CreateDirectory(str9); string destDirName = Path.Combine(str9, "data"); string dst = Path.Combine(str9, "app_icon.png"); FileUtil.MoveFileIfExists(Path.Combine(stagingArea, "app_icon.png"), dst); if (!PlayerSettings.SplashScreen.show) { string str12 = Path.Combine(str9, "app_splash.png"); FileUtil.MoveFileIfExists(Path.Combine(stagingArea, "app_splash.png"), str12); if (!File.Exists(str12)) { FileUtil.CopyFileOrDirectory(playerPackage + "/assets/splash.png", str12); } } Directory.CreateDirectory(Path.Combine(path, "trusted")); Directory.Move(stagingAreaDataUpperCase, destDirName + "2"); Directory.Move(destDirName + "2", destDirName); if (!File.Exists(dst)) { FileUtil.CopyFileOrDirectory(str2 + "/icon.png", dst); } Directory.CreateDirectory(Path.Combine(destDirName, "Managed/mono/2.0")); FileUtil.CopyFileOrDirectory(playerPackage + "/Data/Resources/unity default resources", destDirName + "/unity default resources"); Directory.CreateDirectory(Path.Combine(stagingArea, "data")); string str15 = Path.Combine(stagingArea, "lib"); Directory.CreateDirectory(str15); foreach (PluginImporter importer in PluginImporter.GetImporters(target)) { string fileName = Path.GetFileName(importer.assetPath); FileUtil.UnityFileCopy(importer.assetPath, Path.Combine(str15, fileName)); } if (Directory.Exists("Assets/StreamingAssets")) { FileUtil.CopyDirectoryRecursive("Assets/StreamingAssets", Path.Combine(destDirName, "Raw"), true, true); } AssemblyReferenceChecker checker = new AssemblyReferenceChecker(); bool collectMethods = true; bool ignoreSystemDlls = true; string[] components = new string[] { destDirName, "Managed" }; string str17 = Paths.Combine(components); checker.CollectReferences(str17, collectMethods, 0f, ignoreSystemDlls); string bundleIdentifier = PlayerSettings.bundleIdentifier; CreateManifest(Path.Combine(stagingArea, "tizen-manifest.xml"), companyName, productName, normalizedProductName, bundleIdentifier, checker); CreateProject(stagingArea); PackageTargets(PlayerSettings.Tizen.deploymentTargetType, installPath, playerPackage, stagingArea, developmentPlayer, normalizedProductName); if (flag) { progress.Step("Installing", EditorGUIUtility.TextContent("Installing application on " + TizenUtilities.SelectedDeploymentTarget() + "...").text); if (TizenUtilities.InstallTpkPackage(installPath)) { if (developmentPlayer) { progress.Step("Port Forwarding", EditorGUIUtility.TextContent("Setting up profiler tunnel...").text); TizenUtilities.ForwardPort(ProfilerDriver.directConnectionPort, "55000"); } progress.Step("Launching", EditorGUIUtility.TextContent("Launching application on " + TizenUtilities.SelectedDeploymentTarget() + "...").text); TizenUtilities.LaunchTpkPackage(bundleIdentifier, stagingArea); } } }
private void CopyNativePlugins() { string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target); IPluginImporterExtension importerExtension = (IPluginImporterExtension) new DesktopPluginImporterExtension(); string areaPluginsFolder = this.StagingAreaPluginsFolder; string path1 = Path.Combine(areaPluginsFolder, "x86"); string path2 = Path.Combine(areaPluginsFolder, "x86_64"); bool flag1 = false; bool flag2 = false; bool flag3 = false; foreach (PluginImporter importer in PluginImporter.GetImporters(this.m_PostProcessArgs.target)) { BuildTarget target = this.m_PostProcessArgs.target; if (importer.isNativePlugin) { if (string.IsNullOrEmpty(importer.assetPath)) { Debug.LogWarning((object)("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString())); } else { if (!flag1) { Directory.CreateDirectory(areaPluginsFolder); flag1 = true; } bool flag4 = Directory.Exists(importer.assetPath); string platformData = importer.GetPlatformData(target, "CPU"); if (platformData != null) { // ISSUE: reference to a compiler-generated field if (DesktopStandalonePostProcessor.\u003C\u003Ef__switch\u0024map16 == null) { // ISSUE: reference to a compiler-generated field DesktopStandalonePostProcessor.\u003C\u003Ef__switch\u0024map16 = new Dictionary <string, int>(3) { { "x86", 0 }, { "x86_64", 1 }, { "None", 2 } }; } int num; // ISSUE: reference to a compiler-generated field if (DesktopStandalonePostProcessor.\u003C\u003Ef__switch\u0024map16.TryGetValue(platformData, out num)) { switch (num) { case 0: if (target != BuildTarget.StandaloneOSXIntel64 && target != BuildTarget.StandaloneWindows64 && target != BuildTarget.StandaloneLinux64) { if (!flag2) { Directory.CreateDirectory(path1); flag2 = true; break; } break; } continue; case 1: if (target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSXUniversal || (target == BuildTarget.StandaloneWindows64 || target == BuildTarget.StandaloneLinux64) || target == BuildTarget.StandaloneLinuxUniversal) { if (!flag3) { Directory.CreateDirectory(path2); flag3 = true; break; } break; } continue; case 2: continue; } } } string finalPluginPath = importerExtension.CalculateFinalPluginPath(buildTargetName, importer); if (!string.IsNullOrEmpty(finalPluginPath)) { string str = Path.Combine(areaPluginsFolder, finalPluginPath); if (flag4) { FileUtil.CopyDirectoryRecursive(importer.assetPath, str); } else { FileUtil.UnityFileCopy(importer.assetPath, str); } } } } } }