private bool IsUsableOnOSX(PluginImporter imp) { if (!imp.isNativePlugin) return true; string extension = Path.GetExtension(imp.assetPath); return extension == ".so" || extension == ".bundle"; }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName); bool flag = (buildTargetByName == BuildTarget.StandaloneWindows) || (buildTargetByName == BuildTarget.StandaloneWindows64); bool flag2 = ((buildTargetByName == BuildTarget.StandaloneOSXIntel) || (buildTargetByName == BuildTarget.StandaloneOSXIntel64)) || (buildTargetByName == BuildTarget.StandaloneOSXUniversal); bool flag3 = ((buildTargetByName == BuildTarget.StandaloneLinux) || (buildTargetByName == BuildTarget.StandaloneLinux64)) || (buildTargetByName == BuildTarget.StandaloneLinuxUniversal); if ((!flag3 && !flag2) && !flag) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", platformName, buildTargetByName.ToString())); } if (flag && !this.IsUsableOnWindows(imp)) { return string.Empty; } if (flag2 && !this.IsUsableOnOSX(imp)) { return string.Empty; } if (flag3 && !this.IsUsableOnLinux(imp)) { return string.Empty; } string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) { return string.Empty; } if (!string.IsNullOrEmpty(platformData) && (string.Compare(platformData, "AnyCPU", true) != 0)) { return Path.Combine(platformData, Path.GetFileName(imp.assetPath)); } return Path.GetFileName(imp.assetPath); }
private void ResetCompatability(ref PluginImporterInspector.Compatibility value, PluginImporterInspector.GetComptability getComptability) { value = ((!getComptability(this.importer)) ? PluginImporterInspector.Compatibility.NotCompatible : PluginImporterInspector.Compatibility.Compatible); PluginImporter[] importers = this.importers; for (int i = 0; i < importers.Length; i++) { PluginImporter imp = importers[i]; if (value != ((!getComptability(imp)) ? PluginImporterInspector.Compatibility.NotCompatible : PluginImporterInspector.Compatibility.Compatible)) { value = PluginImporterInspector.Compatibility.Mixed; break; } } }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) { return(string.Empty); } if (!string.IsNullOrEmpty(platformData) && string.Compare(platformData, "AnyCPU", true) != 0) { return(Path.Combine(platformData, Path.GetFileName(imp.assetPath))); } return(Path.GetFileName(imp.assetPath)); }
private void ResetCompatability(ref int value, PluginImporterInspector.GetComptability getComptability) { value = ((!getComptability(this.importer)) ? 0 : 1); PluginImporter[] importers = this.importers; for (int i = 0; i < importers.Length; i++) { PluginImporter imp = importers[i]; if (value != ((!getComptability(imp)) ? 0 : 1)) { value = -1; break; } } }
private bool IsUsableOnOSX(PluginImporter imp) { if (!imp.isNativePlugin) { return(true); } switch (Path.GetExtension(imp.assetPath).ToLower()) { case ".so": case ".bundle": return(true); } return(false); }
private bool IsUsableOnLinux(PluginImporter imp) { bool result; if (!imp.isNativePlugin) { result = true; } else { string a = Path.GetExtension(imp.assetPath).ToLower(); result = (a == ".so"); } return(result); }
public static Error[] ValidateAssemblyDefinitionFiles() { var customScriptAssemblies = EditorCompilationInterface.Instance.GetCustomScriptAssemblies(); if (customScriptAssemblies.Length == 0) { return(null); } var pluginImporters = PluginImporter.GetAllImporters(); if (pluginImporters == null || pluginImporters.Length == 0) { return(null); } var pluginFilenameToAssetPath = new Dictionary <string, string>(); foreach (var pluginImporter in pluginImporters) { var pluginAssetPath = pluginImporter.assetPath; var lowerPluginFilename = AssetPath.GetFileName(pluginAssetPath).ToLower(CultureInfo.InvariantCulture); pluginFilenameToAssetPath[lowerPluginFilename] = pluginAssetPath; } var errors = new List <Error>(); foreach (var customScriptAssembly in customScriptAssemblies) { var lowerAsmdefFilename = $"{customScriptAssembly.Name.ToLower(CultureInfo.InvariantCulture)}.dll"; string pluginPath; if (pluginFilenameToAssetPath.TryGetValue(lowerAsmdefFilename, out pluginPath)) { var error = new Error() { message = $"Plugin '{pluginPath}' has the same filename as Assembly Definition File '{customScriptAssembly.FilePath}'. Rename the assemblies to avoid hard to diagnose issues and crashes.", flags = ErrorFlags.AsmdefPluginConflict, assemblyPath = pluginPath }; errors.Add(error); } } return(errors.ToArray()); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget target = BuildPipeline.GetBuildTargetByName(platformName); bool pluginForWindows = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64; #pragma warning disable 612, 618 bool pluginForOSX = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSX; bool pluginForLinux = target == BuildTarget.StandaloneLinux || target == BuildTarget.StandaloneLinux64 || target == BuildTarget.StandaloneLinuxUniversal; #pragma warning restore 612, 618 if (!pluginForLinux && !pluginForOSX && !pluginForWindows) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", platformName, target.ToString())); } if (pluginForWindows && !IsUsableOnWindows(imp)) { return(string.Empty); } if (pluginForOSX && !IsUsableOnOSX(imp)) { return(string.Empty); } if (pluginForLinux && !IsUsableOnLinux(imp)) { return(string.Empty); } string cpu = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(cpu, "None", true) == 0) { return(string.Empty); } if (pluginForWindows) { // Fix case 1185926: plugins for x86_64 are supposed to be copied to Plugins/x86_64 // Plugins for x86 are supposed to be copied to Plugins/x86 var cpuName = target == BuildTarget.StandaloneWindows ? nameof(DesktopPluginCPUArchitecture.x86) : nameof(DesktopPluginCPUArchitecture.x86_64); return(Path.Combine(cpuName, Path.GetFileName(imp.assetPath))); } // For files this will return filename, for directories, this will return last path component return(Path.GetFileName(imp.assetPath)); }
private static void SetStandalonePlatformData(UnityEditor.PluginImporter pluginImporter, string platformName, string architecture) { var isLinux = platformName == "Linux"; var isWindows = platformName == "Windows"; var isMac = platformName == "Mac"; var isX86 = architecture == "x86"; var isX64 = architecture == "x86_64"; #if !UNITY_2019_2_OR_NEWER pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneLinux, "CPU", isLinux && isX86 ? "x86" : "None"); pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneLinuxUniversal, "CPU", !isLinux ? "None" : isX86 ? "x86" : isX64 ? "x86_64" : "None"); #endif pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneLinux64, "CPU", isLinux && isX64 ? "x86_64" : "None"); pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneWindows, "CPU", isWindows && isX86 ? "AnyCPU" : "None"); pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneWindows64, "CPU", isWindows && isX64 ? "AnyCPU" : "None"); pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneOSX, "CPU", isMac ? "AnyCPU" : "None"); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget target = BuildPipeline.GetBuildTargetByName(platformName); bool pluginForWindows = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64; #pragma warning disable 612, 618 bool pluginForOSX = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSX; #pragma warning restore 612, 618 bool pluginForLinux = target == BuildTarget.StandaloneLinux || target == BuildTarget.StandaloneLinux64 || target == BuildTarget.StandaloneLinuxUniversal; if (!pluginForLinux && !pluginForOSX && !pluginForWindows) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", platformName, target.ToString())); } if (pluginForWindows && !IsUsableOnWindows(imp)) { return(string.Empty); } if (pluginForOSX && !IsUsableOnOSX(imp)) { return(string.Empty); } if (pluginForLinux && !IsUsableOnLinux(imp)) { return(string.Empty); } string cpu = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(cpu, "None", true) == 0) { return(string.Empty); } if (!string.IsNullOrEmpty(cpu) && string.Compare(cpu, "AnyCPU", true) != 0) { return(Path.Combine(cpu, Path.GetFileName(imp.assetPath))); } // For files this will return filename, for directories, this will return last path component return(Path.GetFileName(imp.assetPath)); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName); bool flag = buildTargetByName == BuildTarget.StandaloneWindows || buildTargetByName == BuildTarget.StandaloneWindows64; bool flag2 = buildTargetByName == BuildTarget.StandaloneOSXIntel || buildTargetByName == BuildTarget.StandaloneOSXIntel64 || buildTargetByName == BuildTarget.StandaloneOSXUniversal; bool flag3 = buildTargetByName == BuildTarget.StandaloneLinux || buildTargetByName == BuildTarget.StandaloneLinux64 || buildTargetByName == BuildTarget.StandaloneLinuxUniversal; if (!flag3 && !flag2 && !flag) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", platformName, buildTargetByName.ToString())); } string result; if (flag && !this.IsUsableOnWindows(imp)) { result = string.Empty; } else if (flag2 && !this.IsUsableOnOSX(imp)) { result = string.Empty; } else if (flag3 && !this.IsUsableOnLinux(imp)) { result = string.Empty; } else { string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) { result = string.Empty; } else if (!string.IsNullOrEmpty(platformData) && string.Compare(platformData, "AnyCPU", true) != 0) { result = Path.Combine(platformData, Path.GetFileName(imp.assetPath)); } else { result = Path.GetFileName(imp.assetPath); } } return(result); }
internal override void Apply() { base.Apply(); PluginImporter[] importers = this.importers; for (int i = 0; i < importers.Length; i++) { PluginImporter pluginImporter = importers[i]; if (this.m_CompatibleWithAnyPlatform > -1) { pluginImporter.SetCompatibleWithAnyPlatform(this.m_CompatibleWithAnyPlatform == 1); } if (this.m_CompatibleWithEditor > -1) { pluginImporter.SetCompatibleWithEditor(this.m_CompatibleWithEditor == 1); } foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets()) { if (this.m_CompatibleWithPlatform[(int)current] > -1) { pluginImporter.SetCompatibleWithPlatform(current, this.m_CompatibleWithPlatform[(int)current] == 1); } } } if (!this.IsEditingPlatformSettingsSupported()) { return; } IPluginImporterExtension[] additionalExtensions = this.additionalExtensions; for (int j = 0; j < additionalExtensions.Length; j++) { IPluginImporterExtension pluginImporterExtension = additionalExtensions[j]; pluginImporterExtension.Apply(this); } foreach (BuildTarget current2 in PluginImporterInspector.GetValidBuildTargets()) { IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current2); if (pluginImporterExtension2 != null) { pluginImporterExtension2.Apply(this); } } }
private static bool OnDoubleClick(int instanceID, int line) { string assetPath = AssetDatabase.GetAssetPath(instanceID); if (string.IsNullOrEmpty(assetPath)) { return(false); } //The Asset type of PluginImporter is DefaultAsset, so we need to get the importer instead PluginImporter assetImporter = AssetImporter.GetAtPath(assetPath) as PluginImporter; if (assetImporter == null) { return(false); } Selection.activeObject = assetImporter; return(true); }
private void OnEnable() { IPluginImporterExtension[] additionalExtensions = this.additionalExtensions; for (int i = 0; i < additionalExtensions.Length; i++) { IPluginImporterExtension pluginImporterExtension = additionalExtensions[i]; pluginImporterExtension.OnEnable(this); } foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets()) { IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current); if (pluginImporterExtension2 != null) { pluginImporterExtension2.OnEnable(this); pluginImporterExtension2.ResetValues(this); } } PluginImporter pluginImporter = (PluginImporter)this.target; this.pluginInformation = new Dictionary <string, string>(); this.pluginInformation["Path"] = pluginImporter.assetPath; this.pluginInformation["Type"] = ((!pluginImporter.isNativePlugin) ? "Managed" : "Native"); }
private void ValidateUniversalTargets(PluginImporterInspector inspector) { bool flag = this.m_LinuxX86.IsTargetEnabled(inspector); bool flag2 = this.m_LinuxX86_X64.IsTargetEnabled(inspector); DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture = this.CalculateMultiCPUArchitecture(flag, flag2); PluginImporter[] importers = inspector.importers; for (int i = 0; i < importers.Length; i++) { PluginImporter pluginImporter = importers[i]; pluginImporter.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", desktopPluginCPUArchitecture.ToString()); } inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), flag || flag2); bool flag3 = this.m_OSX_X64.IsTargetEnabled(inspector); DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture2 = this.CalculateMultiCPUArchitecture(true, flag3); PluginImporter[] importers2 = inspector.importers; for (int j = 0; j < importers2.Length; j++) { PluginImporter pluginImporter2 = importers2[j]; pluginImporter2.SetPlatformData(BuildTarget.StandaloneOSX, "CPU", desktopPluginCPUArchitecture2.ToString()); } inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSX), flag3); }
public void ValidateSingleCPUTargets(PluginImporterInspector inspector) { DesktopPluginImporterExtension.DesktopSingleCPUProperty[] array = new DesktopPluginImporterExtension.DesktopSingleCPUProperty[] { this.m_WindowsX86, this.m_WindowsX86_X64, this.m_LinuxX86, this.m_LinuxX86_X64, this.m_OSX_X64 }; DesktopPluginImporterExtension.DesktopSingleCPUProperty[] array2 = array; for (int i = 0; i < array2.Length; i++) { DesktopPluginImporterExtension.DesktopSingleCPUProperty desktopSingleCPUProperty = array2[i]; string value = (!desktopSingleCPUProperty.IsTargetEnabled(inspector)) ? DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None.ToString() : desktopSingleCPUProperty.defaultValue.ToString(); PluginImporter[] importers = inspector.importers; for (int j = 0; j < importers.Length; j++) { PluginImporter pluginImporter = importers[j]; pluginImporter.SetPlatformData(desktopSingleCPUProperty.platformName, "CPU", value); } } this.ValidateUniversalTargets(inspector); }
public PluginInfo(string buildTargetName, PluginImporter plugin) { this.assetPath = plugin.assetPath; this.assetName = Path.GetFileName(plugin.assetPath); this.cpuType = plugin.GetPlatformData(buildTargetName, AndroidPluginImporterExtension.cpuTag); }
private bool IsUsableOnWindows(PluginImporter imp) { return(!imp.isNativePlugin || Path.GetExtension(imp.assetPath) == ".dll"); }
public static PluginImporter[] GetImporters(BuildTarget platform) { return(PluginImporter.GetImporters(BuildPipeline.GetBuildTargetName(platform))); }
private static void LogIgnoredDuplicateAssembly(PluginImporter usedPluginImporter, PluginImporter ignoredPluginImporter) { var assemblyName = Path.GetFileName(usedPluginImporter.assetPath); // keep this message here in sync with PrecompiledAssemblies.cpp LogIgnoredDuplicateAssembly var message = $"Duplicate assembly '{assemblyName}' with different versions detected, using '{usedPluginImporter.assetPath}, Version={usedPluginImporter.assemblyFullName.Version}' and ignoring '{ignoredPluginImporter.assetPath}, Version={ignoredPluginImporter.assemblyFullName.Version}'."; Console.WriteLine(message); }
private bool IsUsableOnWindows(PluginImporter imp) { return !imp.isNativePlugin || Path.GetExtension(imp.assetPath) == ".dll"; }
internal static bool IsUniversalSDK81(PluginImporter imp) { return IsSDK(imp, "UniversalSDK81"); }
static void FixPlayMakerPluginSettings(PluginImporter pluginImporter) { LogChange("Fixed Plugin Settings: " + pluginImporter.assetPath); pluginImporter.SetCompatibleWithAnyPlatform(false); pluginImporter.SetCompatibleWithEditor(true); SetCompatiblePlatforms(pluginImporter, standardPlatforms); AssetDatabase.Refresh(); }
private void UpgradePluginCPU(PluginImporter plugin, BuildTarget buildTarget) { string extension = Path.GetExtension(plugin.assetPath); string platformData = plugin.GetPlatformData(buildTarget, "CPU"); if ((extension == ".so") && (platformData == "AnyCPU")) { plugin.SetPlatformData(buildTarget, "CPU", "ARMv7"); } }
public static PluginImporter[] GetImporters(string buildTargetGroup, string buildTarget) { return((from imp in PluginImporter.GetAllImporters() where PluginImporter.IsCompatible(imp, buildTargetGroup, buildTarget) select imp).ToArray <PluginImporter>()); }
private bool IsUsableOnLinux(PluginImporter imp) { return (!imp.isNativePlugin || (Path.GetExtension(imp.assetPath).ToLower() == ".so")); }
private bool IsUsableOnLinux(PluginImporter imp) { return !imp.isNativePlugin || Path.GetExtension(imp.assetPath) == ".so"; }
private bool IsUsableOnOSX(PluginImporter imp) { if (!imp.isNativePlugin) { return true; } switch (Path.GetExtension(imp.assetPath).ToLower()) { case ".so": case ".bundle": return true; } return false; }
private static bool IsSDK(PluginImporter imp, string sdk) { return (string.Compare(imp.GetPlatformData(platformName, Plugin.sdkTag), sdk) == 0); }
static void SetCompatiblePlatforms(PluginImporter pluginImporter, IEnumerable<BuildTarget> platforms) { foreach (var platform in platforms) { pluginImporter.SetCompatibleWithPlatform(platform, true); } }
internal static bool IsSDK81(PluginImporter imp) { return IsSDK(imp, "SDK81"); }
private static void AddReferencedAssembliesRecurse(string assemblyPath, List <string> alreadyFoundAssemblies, string[] allAssemblyPaths, string[] foldersToSearch, Dictionary <string, AssemblyDefinition> cache, BuildTarget target) { if (AssemblyHelper.IgnoreAssembly(assemblyPath, target)) { return; } AssemblyDefinition assemblyDefinitionCached = AssemblyHelper.GetAssemblyDefinitionCached(assemblyPath, cache); if (assemblyDefinitionCached == null) { throw new ArgumentException("Referenced Assembly " + Path.GetFileName(assemblyPath) + " could not be found!"); } if (alreadyFoundAssemblies.IndexOf(assemblyPath) != -1) { return; } alreadyFoundAssemblies.Add(assemblyPath); IEnumerable <string> source = (from i in PluginImporter.GetImporters(target).Where(delegate(PluginImporter i) { string platformData = i.GetPlatformData(target, "CPU"); return(!string.IsNullOrEmpty(platformData) && !string.Equals(platformData, "AnyCPU", StringComparison.InvariantCultureIgnoreCase)); }) select Path.GetFileName(i.assetPath)).Distinct <string>(); foreach (AssemblyNameReference referencedAssembly in assemblyDefinitionCached.MainModule.AssemblyReferences) { if (!(referencedAssembly.Name == "BridgeInterface")) { if (!(referencedAssembly.Name == "WinRTBridge")) { if (!(referencedAssembly.Name == "UnityEngineProxy")) { if (!AssemblyHelper.IgnoreAssembly(referencedAssembly.Name + ".dll", target)) { string text = AssemblyHelper.FindAssemblyName(referencedAssembly.FullName, referencedAssembly.Name, allAssemblyPaths, foldersToSearch, cache); if (text == string.Empty) { bool flag = false; string[] array = new string[] { ".dll", ".winmd" }; string extension; for (int j = 0; j < array.Length; j++) { extension = array[j]; if (source.Any((string p) => string.Equals(p, referencedAssembly.Name + extension, StringComparison.InvariantCultureIgnoreCase))) { flag = true; break; } } if (!flag) { throw new ArgumentException(string.Format("The Assembly {0} is referenced by {1} ('{2}'). But the dll is not allowed to be included or could not be found.", referencedAssembly.Name, assemblyDefinitionCached.MainModule.Assembly.Name.Name, assemblyPath)); } } else { AssemblyHelper.AddReferencedAssembliesRecurse(text, alreadyFoundAssemblies, allAssemblyPaths, foldersToSearch, cache, target); } } } } } } }
internal static bool IsUWP(PluginImporter imp) { return IsSDK(imp, "UWP"); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName); bool flag1 = buildTargetByName == BuildTarget.StandaloneWindows || buildTargetByName == BuildTarget.StandaloneWindows64; bool flag2 = buildTargetByName == BuildTarget.StandaloneOSXIntel || buildTargetByName == BuildTarget.StandaloneOSXIntel64 || buildTargetByName == BuildTarget.StandaloneOSXUniversal; bool flag3 = buildTargetByName == BuildTarget.StandaloneLinux || buildTargetByName == BuildTarget.StandaloneLinux64 || buildTargetByName == BuildTarget.StandaloneLinuxUniversal; if (!flag3 && !flag2 && !flag1) throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", (object) platformName, (object) buildTargetByName.ToString())); if (flag1 && !this.IsUsableOnWindows(imp) || flag2 && !this.IsUsableOnOSX(imp) || flag3 && !this.IsUsableOnLinux(imp)) return string.Empty; string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) return string.Empty; if (!string.IsNullOrEmpty(platformData) && string.Compare(platformData, "AnyCPU", true) != 0) return Path.Combine(platformData, Path.GetFileName(imp.assetPath)); return Path.GetFileName(imp.assetPath); }
static void FixPlayMakerMetroPluginSettings(PluginImporter pluginImporter) { LogChange("Fixed Plugin Settings: " + pluginImporter.assetPath); pluginImporter.SetCompatibleWithAnyPlatform(false); pluginImporter.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true); AssetDatabase.Refresh(); }
static private void AddReferencedAssembliesRecurse(string assemblyPath, List <string> alreadyFoundAssemblies, string[] allAssemblyPaths, string[] foldersToSearch, Dictionary <string, AssemblyDefinition> cache, BuildTarget target, ScriptingImplementation scriptingImplementation) { if (IgnoreAssembly(assemblyPath, target, scriptingImplementation)) { return; } if (!File.Exists(assemblyPath)) { return; } AssemblyDefinition assembly = GetAssemblyDefinitionCached(assemblyPath, cache); if (assembly == null) { throw new System.ArgumentException("Referenced Assembly " + Path.GetFileName(assemblyPath) + " could not be found!"); } // Ignore it if we already added the assembly if (alreadyFoundAssemblies.IndexOf(assemblyPath) != -1) { return; } alreadyFoundAssemblies.Add(assemblyPath); var architectureSpecificPlugins = PluginImporter.GetImporters(target).Where(i => { var cpu = i.GetPlatformData(target, "CPU"); return(!string.IsNullOrEmpty(cpu) && !string.Equals(cpu, "AnyCPU", StringComparison.InvariantCultureIgnoreCase)); }).Select(i => Path.GetFileName(i.assetPath)).Distinct(); // Go through all referenced assemblies foreach (AssemblyNameReference referencedAssembly in assembly.MainModule.AssemblyReferences) { // Special cases for Metro if (referencedAssembly.Name == "BridgeInterface") { continue; } if (referencedAssembly.Name == "WinRTBridge") { continue; } if (referencedAssembly.Name == "UnityEngineProxy") { continue; } if (IgnoreAssembly(referencedAssembly.Name + ".dll", target, scriptingImplementation)) { continue; } string foundPath = FindAssemblyName(referencedAssembly.FullName, referencedAssembly.Name, allAssemblyPaths, foldersToSearch, cache); if (foundPath == "") { // Ignore architecture specific plugin references var found = false; foreach (var extension in new[] { ".dll", ".winmd" }) { if (architectureSpecificPlugins.Any(p => string.Equals(p, referencedAssembly.Name + extension, StringComparison.InvariantCultureIgnoreCase))) { found = true; break; } } if (found) { continue; } throw new System.ArgumentException(string.Format("The Assembly {0} is referenced by {1} ('{2}'). But the dll is not allowed to be included or could not be found.", referencedAssembly.Name, assembly.MainModule.Assembly.Name.Name, assemblyPath)); } AddReferencedAssembliesRecurse(foundPath, alreadyFoundAssemblies, allAssemblyPaths, foldersToSearch, cache, target, scriptingImplementation); } }
private static bool IsCompatible(PluginImporter imp, string buildTargetGroup, string buildTarget) { return(!string.IsNullOrEmpty(imp.assetPath) && (imp.GetCompatibleWithPlatform(buildTargetGroup, buildTarget) || imp.GetCompatibleWithAnyPlatform())); }
public static PluginImporter[] GetImporters(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget) { return(PluginImporter.GetImporters(BuildPipeline.GetBuildTargetGroupName(buildTargetGroup), BuildPipeline.GetBuildTargetName(buildTarget))); }
private static bool IsCompatible(PluginImporter imp, string platformName) { return(!string.IsNullOrEmpty(imp.assetPath) && (imp.GetCompatibleWithPlatform(platformName) || (imp.GetCompatibleWithAnyPlatform() && !imp.GetExcludeFromAnyPlatform(platformName))) && imp.ShouldIncludeInBuild()); }
private static bool IsCPUArchitecture(PluginImporter imp, string cpu) { return (string.Compare(imp.GetPlatformData(platformName, Plugin.cpuTag), cpu) == 0); }
public static PluginImporter[] GetImporters(string platformName) { return((from imp in PluginImporter.GetAllImporters() where PluginImporter.IsCompatible(imp, platformName) select imp).ToArray <PluginImporter>()); }
internal static bool IsCPUArchitectureAnyCPU(PluginImporter imp) { return (IsCPUArchitecture(imp, "") || IsCPUArchitecture(imp, "AnyCPU")); }
private static bool IsCompatible(PluginImporter imp, string platformName) { return(!string.IsNullOrEmpty(imp.assetPath) && (imp.GetCompatibleWithPlatform(platformName) || imp.GetCompatibleWithAnyPlatform())); }
internal static bool IsCPUArchitectureARM(PluginImporter imp) { return IsCPUArchitecture(imp, "ARM"); }
private bool IsUsableOnLinux(PluginImporter imp) { return(!imp.isNativePlugin || Path.GetExtension(imp.assetPath) == ".so"); }
internal static bool IsCPUArchitectureX86(PluginImporter imp) { return IsCPUArchitecture(imp, "X86"); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) { return string.Empty; } if (!string.IsNullOrEmpty(platformData) && string.Compare(platformData, "AnyCPU", true) != 0) { return Path.Combine(platformData, Path.GetFileName(imp.assetPath)); } return Path.GetFileName(imp.assetPath); }
private bool IsUsableOnLinux(PluginImporter imp) => (!imp.isNativePlugin || (Path.GetExtension(imp.assetPath).ToLower() == ".so"));
private bool IsUsableOnWindows(PluginImporter imp) { if (!imp.isNativePlugin) { return true; } string extension = Path.GetExtension(imp.assetPath); return extension == ".dll"; }
internal static bool IsAnySDK(PluginImporter imp) { return (IsSDK(imp, "") || IsSDK(imp, "AnySDK")); }
private static void FilterOutPlatformIfNeeded_Default(UnityEditor.BuildTarget target, UnityEditor.PluginImporter pluginImporter, string pluginPlatform) { }
private bool IsUsableOnOSX(PluginImporter imp) { if (imp.isNativePlugin) { string extension = Path.GetExtension(imp.assetPath); if (!(extension == ".so") && !(extension == ".bundle")) { return false; } } return true; }