public void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { if (target == BuildTarget.WSAPlayer) { AddInternetClientCapability(pathToBuiltProject); AddHelperCodeToUWPProject(pathToBuiltProject); if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.IL2CPP) { // Fix System.Diagnostics.Debug IL2CPP implementation. FixIl2CppLogging(pathToBuiltProject); } } if (target == BuildTarget.iOS && PBXProjectWrapper.PBXProjectIsAvailable && PlistDocumentWrapper.PlistDocumentIsAvailable) { var pbxProject = new PBXProjectWrapper(pathToBuiltProject); // Update project. OnPostprocessProject(pbxProject); pbxProject.WriteToFile(); // Update Info.plist. var settings = AppCenterSettingsContext.SettingsInstance; var infoPath = pathToBuiltProject + "/Info.plist"; var info = new PlistDocumentWrapper(infoPath); OnPostprocessInfo(info, settings); info.WriteToFile(); // Update capabilities (if possible). if (ProjectCapabilityManagerWrapper.ProjectCapabilityManagerIsAvailable) { var capabilityManager = new ProjectCapabilityManagerWrapper(pbxProject.ProjectPath, PBXProjectWrapper.GetUnityTargetName(), pbxProject.GetUnityTargetGuid()); OnPostprocessCapabilities(capabilityManager, settings); capabilityManager.WriteToFile(); } } if (target == BuildTarget.Android) { // No linking/unlinking in case module isn't added. if (AppCenter.Distribute != null) { LinkModule(AppCenterSettingsContext.SettingsInstance.UseDistribute, "distribute"); } if (AppCenter.Analytics != null) { LinkModule(AppCenterSettingsContext.SettingsInstance.UseAnalytics, "analytics"); } if (AppCenter.Crashes != null) { LinkModule(AppCenterSettingsContext.SettingsInstance.UseCrashes, "crashes"); } if (AppCenter.Push != null) { LinkModule(AppCenterSettingsContext.SettingsInstance.UsePush, "push"); } } }
private static void OnPostprocessCapabilities(ProjectCapabilityManagerWrapper capabilityManager, AppCenterSettings settings) { if (settings.UsePush && AppCenter.Push != null) { capabilityManager.AddPushNotifications(); capabilityManager.AddRemoteNotificationsToBackgroundModes(); } }
public void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { if (target == BuildTarget.WSAPlayer) { AddInternetClientCapability(pathToBuiltProject); AddHelperCodeToUWPProject(pathToBuiltProject); if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) != ScriptingImplementation.IL2CPP) { // If UWP with .NET scripting backend, need to add NuGet packages. var projectJson = pathToBuiltProject + "/" + PlayerSettings.productName + "/project.json"; AddDependenciesToProjectJson(projectJson); var nuget = EditorApplication.applicationContentsPath + "/PlaybackEngines/MetroSupport/Tools/nuget.exe"; ExecuteCommand(nuget, "restore \"" + projectJson + "\" -NonInteractive"); } else { // Fix System.Diagnostics.Debug IL2CPP implementation. FixIl2CppLogging(pathToBuiltProject); } } if (target == BuildTarget.iOS && PBXProjectWrapper.PBXProjectIsAvailable && PlistDocumentWrapper.PlistDocumentIsAvailable) { var pbxProject = new PBXProjectWrapper(pathToBuiltProject); // Update project. OnPostprocessProject(pbxProject); pbxProject.WriteToFile(); // Update Info.plist. var settings = AppCenterSettingsContext.SettingsInstance; var infoPath = pathToBuiltProject + "/Info.plist"; var info = new PlistDocumentWrapper(infoPath); OnPostprocessInfo(info, settings); info.WriteToFile(); // Update capabilities (if possible). if (ProjectCapabilityManagerWrapper.ProjectCapabilityManagerIsAvailable) { var capabilityManager = new ProjectCapabilityManagerWrapper(pbxProject.ProjectPath, PBXProjectWrapper.GetUnityTargetName()); OnPostprocessCapabilities(capabilityManager, settings); capabilityManager.WriteToFile(); } } }
public void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { if (target == BuildTarget.WSAPlayer) { AddInternetClientCapability(pathToBuiltProject); AddHelperCodeToUWPProject(pathToBuiltProject); if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.IL2CPP) { // Fix System.Diagnostics.Debug IL2CPP implementation. FixIl2CppLogging(pathToBuiltProject); } } if (target == BuildTarget.iOS && PBXProjectWrapper.PBXProjectIsAvailable && PlistDocumentWrapper.PlistDocumentIsAvailable) { var pbxProject = new PBXProjectWrapper(pathToBuiltProject); // Update project. OnPostprocessProject(pbxProject); pbxProject.WriteToFile(); // Update Info.plist. var settings = AppCenterSettingsContext.SettingsInstance; var infoPath = pathToBuiltProject + "/Info.plist"; var info = new PlistDocumentWrapper(infoPath); OnPostprocessInfo(info, settings); info.WriteToFile(); // Update capabilities (if possible). if (ProjectCapabilityManagerWrapper.ProjectCapabilityManagerIsAvailable) { var capabilityManager = new ProjectCapabilityManagerWrapper(pbxProject.ProjectPath, PBXProjectWrapper.GetUnityTargetName(), pbxProject.GetUnityTargetGuid()); OnPostprocessCapabilities(capabilityManager, settings); capabilityManager.WriteToFile(); } } }