/// <summary> /// Manage the android dependecies based on the project settings. /// </summary> /// <param name="settings">The <see cref="ARCoreExtensionsProjectSettings"/> used by /// current build.</param> public void ManageAndroidDependencies(ARCoreExtensionsProjectSettings settings) { List <IDependentModule> featureModules = DependentModulesManager.GetModules(); string folderPath = AssetDatabase.GUIDToAssetPath(_buildResourceFolderGUID) + _dependenciesDirectory; Directory.CreateDirectory(folderPath); foreach (IDependentModule module in featureModules) { if (module.IsEnabled(settings, UnityEditor.BuildTarget.Android)) { string dependenciesSnippet = module.GetAndroidDependenciesSnippet(settings); if (!string.IsNullOrEmpty(dependenciesSnippet)) { string fileName = module.GetType().Name + _androidDependenciesFileSuffix; string fullPath = Path.Combine(folderPath, fileName); string finalSnippet = XDocument.Parse(string.Format( _androidDependenciesFormat, dependenciesSnippet)).ToString(); File.WriteAllText(fullPath, finalSnippet); Debug.LogFormat("Module {0} added Android library dependencies:\n{1}", module.GetType().Name, finalSnippet); AssetDatabase.Refresh(); AndroidDependenciesHelper.DoPlayServicesResolve(); } } } }
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); } } }
private static void PostprocessAndroidBuild() { Debug.Log("ARCoreExtensions: Cleaning up Keyless dependencies."); // Run the pre-process step with <c>Keyless</c> disabled so project files get reset. // Then run the PlayServicesResolver dependency resolution which will remove // the Keyless dependencies. PreprocessAndroidBuild(false); AndroidDependenciesHelper.DoPlayServicesResolve(); }
/// <summary> /// Preprocess step for Android Build. /// </summary> /// <param name="enabledKeyless">Whether to enable or disable keyless.</param> public static void PreprocessAndroidBuild(bool enabledKeyless) { AndroidDependenciesHelper.UpdateAndroidDependencies( enabledKeyless, _androidKeylessDependenciesGuid); if (enabledKeyless) { Debug.Log("ARCoreExtensions: Including Keyless dependencies in this build."); AndroidDependenciesHelper.DoPlayServicesResolve(); } }
private static void AddEarthDependecyOnAndroid(bool enabled) { Debug.LogFormat("ARCoreExtensions: {0} Earth Cloud Anchor dependencies.", enabled ? "Adding" : "Removing"); AndroidDependenciesHelper.UpdateAndroidDependencies(enabled, _locationDependencyGuid); // If we are in batch mode, ExternalDependencyManager won't auto-resolve so attempt to // resolve dependencies. if (enabled && UnityEditorInternal.InternalEditorUtility.inBatchMode) { AndroidDependenciesHelper.DoPlayServicesResolve(); } }
private static void CleanupEarthDependencyOnAndroid() { if (UnityEditorInternal.InternalEditorUtility.inBatchMode && System.Environment.CommandLine.Contains("-earth_cleandeps")) { Debug.Log("ARCoreExtensions: Cleaning up Earth Cloud Anchor dependencies."); // Run the pre-process step with disabled so project files get reset. // Then run the ExternalDependencyManager dependency resolution which will remove // earth cloud anchor dependencies. AddEarthDependecyOnAndroid(false); AndroidDependenciesHelper.DoPlayServicesResolve(); } }
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); } } }