/// <summary> /// Manage the ios dependecies based on the project settings. /// </summary> /// <param name="settings"> /// The <see cref="ARCoreExtensionsProjectSettings"/> used by current build. /// </param> public void ManageIOSDependencies(ARCoreExtensionsProjectSettings settings) { _enabledIOSTemplate.Clear(); List <IDependentModule> featureModules = DependentModulesManager.GetModules(); foreach (IDependentModule module in featureModules) { string iOSDependenciesTemplateFile = module.GetIOSDependenciesTemplateFileName(); if (!string.IsNullOrEmpty(iOSDependenciesTemplateFile)) { bool isModuleEnabled = module.IsEnabled( settings, UnityEditor.BuildTarget.iOS); if (isModuleEnabled) { Debug.LogFormat("ARCoreExtensions: Include {0} for {1}.", iOSDependenciesTemplateFile, module.GetType().Name); _enabledIOSTemplate.Add(iOSDependenciesTemplateFile); IOSSupportHelper.UpdateIOSPodDependencies( true, iOSDependenciesTemplateFile); } else { Debug.LogFormat("ARCoreExtensions: Exclude {0} for {1}.", iOSDependenciesTemplateFile, module.GetType().Name); IOSSupportHelper.UpdateIOSPodDependencies( false, iOSDependenciesTemplateFile); } } } }
public static void OnPostprocessBuild( UnityEditor.BuildTarget target, string pathToBuiltProject) { if (!UnityEditorInternal.InternalEditorUtility.inBatchMode) { // Only clean up resolver in Batch Mode. return; } if (target == UnityEditor.BuildTarget.Android) { Debug.Log("ARCoreExtensions: Cleaning up Android library dependencies."); string folderPath = Application.dataPath + _dependenciesDirectory; Directory.Delete(folderPath, true); AssetDatabase.Refresh(); AndroidDependenciesHelper.DoPlayServicesResolve(); } else if (target == UnityEditor.BuildTarget.iOS) { foreach (string enabledTemplateFile in _enabledIOSTemplate) { Debug.LogFormat("ARCoreExtensions: Cleaning up {0} in PostprocessBuild.", enabledTemplateFile); IOSSupportHelper.UpdateIOSPodDependencies(false, enabledTemplateFile); } } }
/// <summary> /// Manage the ios dependencies based on the project settings. /// </summary> /// <param name="settings"> /// The <see cref="ARCoreExtensionsProjectSettings"/> used by current build. /// </param> public void ManageIOSDependencies(ARCoreExtensionsProjectSettings settings) { _enabledIOSTemplate.Clear(); List <IDependentModule> featureModules = DependentModulesManager.GetModules(); foreach (IDependentModule module in featureModules) { string[] iOSDependenciesTemplates = module.GetIOSDependenciesTemplateFileNames(); if (iOSDependenciesTemplates != null && iOSDependenciesTemplates.Length > 0) { bool isModuleEnabled = module.IsEnabled( settings, UnityEditor.BuildTarget.iOS); foreach (string iOSDependenciesTemplateFile in iOSDependenciesTemplates) { if (!string.IsNullOrEmpty(iOSDependenciesTemplateFile)) { Debug.LogFormat("ARCoreExtensions: {0} {1} for {2}.", isModuleEnabled ? "Include" : "Exclude", iOSDependenciesTemplateFile, module.GetType().Name); IOSSupportHelper.UpdateIOSPodDependencies( isModuleEnabled, iOSDependenciesTemplateFile); if (isModuleEnabled) { _enabledIOSTemplate.Add(iOSDependenciesTemplateFile); } } } } } }
/// <summary> /// A callback before the build is started to enable IOS support. /// </summary> /// <param name="report">A report containing information about the build.</param> public void OnPreprocessBuild(BuildReport report) { if (report.summary.platform == BuildTarget.iOS) { bool arcoreiOSEnabled = ARCoreExtensionsProjectSettings.Instance.IsIOSSupportEnabled; Debug.LogFormat("Building application with ARCore Extensions for AR Foundation " + "iOS Support {0}", arcoreiOSEnabled ? "ENABLED" : "DISABLED"); // Setup scripting define symbols: IOSSupportHelper.UpdateIOSScriptingDefineSymbols( ARCoreExtensionsProjectSettings.Instance); // Setup CocoaPod templates: IOSSupportHelper.UpdateIOSPodDependencies( arcoreiOSEnabled, IOSSupportHelper.ARCoreIOSDependencyFileName); Dictionary <string, bool> templates = ARCoreExtensionsProjectSettings.Instance.GetIOSDependenciesStatus(); foreach (var keyvalue in templates) { IOSSupportHelper.UpdateIOSPodDependencies( arcoreiOSEnabled && keyvalue.Value, keyvalue.Key); } } }
public static void OnPostprocessBuild( UnityEditor.BuildTarget target, string pathToBuiltProject) { if (target == UnityEditor.BuildTarget.Android) { Debug.Log("ARCoreExtensions: Cleaning up Android library dependencies."); string folderPath = AssetDatabase.GUIDToAssetPath(_buildResourceFolderGUID) + _dependenciesDirectory; Directory.Delete(folderPath, true); AssetDatabase.Refresh(); AndroidDependenciesHelper.DoPlayServicesResolve(); } else if (target == UnityEditor.BuildTarget.iOS) { foreach (string enabledTemplateFile in _enabledIOSTemplate) { Debug.LogFormat("ARCoreExtensions: Cleaning up {0} in PostprocessBuild.", enabledTemplateFile); IOSSupportHelper.UpdateIOSPodDependencies(false, enabledTemplateFile); } } }
private static void AddEarthDependencyOnIos(bool enabled) { Debug.LogFormat("ARCoreExtensions: {0} Earth Cloud Anchor dependencies.", enabled ? "Adding" : "Removing"); IOSSupportHelper.UpdateIOSPodDependencies(enabled, _locationIosDependencyFileName); }