public AndroidManifestConfiguration() : this(() => ScriptableSentryUnityOptions.LoadSentryUnityOptions(BuildPipeline.isBuildingPlayer), () => SentryCliOptions.LoadCliOptions(), isDevelopmentBuild : EditorUserBuildSettings.development, scriptingImplementation : PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android)) { }
internal static void Display(SentryCliOptions cliOptions) { cliOptions.UploadSymbols = EditorGUILayout.BeginToggleGroup( new GUIContent("Upload Symbols", "Whether debug symbols should be uploaded automatically " + "on release builds."), cliOptions.UploadSymbols); cliOptions.UploadDevelopmentSymbols = EditorGUILayout.Toggle( new GUIContent("Upload Dev Symbols", "Whether debug symbols should be uploaded automatically " + "on development builds."), cliOptions.UploadDevelopmentSymbols); EditorGUILayout.EndToggleGroup(); cliOptions.Auth = EditorGUILayout.TextField( new GUIContent("Auth Token", "The authorization token from your user settings in Sentry"), cliOptions.Auth); cliOptions.Organization = EditorGUILayout.TextField( new GUIContent("Org Slug", "The organization slug in Sentry"), cliOptions.Organization); cliOptions.Project = EditorGUILayout.TextField( new GUIContent("Project Name", "The project name in Sentry"), cliOptions.Project); }
private void Awake() { SetTitle(); CopyLinkXmlToPlugins(); CheckForAndConvertJsonConfig(); Options = LoadOptions(); CliOptions = SentryCliOptions.LoadCliOptions(); }
public static void OnPostProcessBuild(BuildTarget target, string pathToProject) { if (target != BuildTarget.iOS) { return; } var options = ScriptableSentryUnityOptions.LoadSentryUnityOptions(BuildPipeline.isBuildingPlayer); var logger = options?.DiagnosticLogger ?? new UnityLogger(new SentryUnityOptions()); try { // Unity doesn't allow an appending builds when switching iOS SDK versions and this will make sure we always copy the correct version of the Sentry.framework var frameworkDirectory = PlayerSettings.iOS.sdkVersion == iOSSdkVersion.DeviceSDK ? "Device" : "Simulator"; var frameworkPath = Path.GetFullPath(Path.Combine("Packages", SentryPackageInfo.GetName(), "Plugins", "iOS", frameworkDirectory, "Sentry.framework")); CopyFramework(frameworkPath, Path.Combine(pathToProject, "Frameworks", "Sentry.framework"), options?.DiagnosticLogger); var nativeBridgePath = Path.GetFullPath(Path.Combine("Packages", SentryPackageInfo.GetName(), "Plugins", "iOS", "SentryNativeBridge.m")); CopyFile(nativeBridgePath, Path.Combine(pathToProject, "Libraries", SentryPackageInfo.GetName(), "SentryNativeBridge.m"), options?.DiagnosticLogger); using var sentryXcodeProject = SentryXcodeProject.Open(pathToProject); sentryXcodeProject.AddSentryFramework(); sentryXcodeProject.AddSentryNativeBridge(); if (options?.IsValid() is not true) { logger.LogWarning("Failed to validate Sentry Options. Native support disabled."); return; } if (!options.IosNativeSupportEnabled) { logger.LogDebug("iOS Native support disabled through the options."); return; } sentryXcodeProject.AddNativeOptions(options); sentryXcodeProject.AddSentryToMain(options); var sentryCliOptions = SentryCliOptions.LoadCliOptions(); if (sentryCliOptions.IsValid(logger)) { SentryCli.CreateSentryProperties(pathToProject, sentryCliOptions); SentryCli.AddExecutableToXcodeProject(pathToProject, logger); sentryXcodeProject.AddBuildPhaseSymbolUpload(logger); } } catch (Exception e) { logger.LogError("Failed to add the Sentry framework to the generated Xcode project", e); } }
private static void UploadDebugSymbols(IDiagnosticLogger logger, string projectDir, string executableName) { var cliOptions = SentryCliOptions.LoadCliOptions(); if (!cliOptions.IsValid(logger)) { return; } logger.LogInfo("Uploading debugging information using sentry-cli in {0}", projectDir); var paths = ""; Func <string, bool> addPath = (string name) => { var fullPath = Path.Combine(projectDir, name); if (Directory.Exists(fullPath) || File.Exists(fullPath)) { paths += $" \"{name}\""; logger.LogDebug($"Adding '{name}' to the debug-info upload"); return(true); } else { logger.LogWarning($"Coudn't find '{name}' - debug symbol upload will be incomplete"); return(false); } }; addPath(executableName); addPath("GameAssembly.dll"); addPath("UnityPlayer.dll"); addPath(Path.GetFileNameWithoutExtension(executableName) + "_BackUpThisFolder_ButDontShipItWithYourGame"); addPath(Path.GetFileNameWithoutExtension(executableName) + "_Data/Plugins/x86_64/sentry.dll"); // Note: using Path.GetFullPath as suggested by https://docs.unity3d.com/Manual/upm-assets.html addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Windows/Sentry/sentry.pdb")); // Configure the process using the StartInfo properties. var process = new Process { StartInfo = new ProcessStartInfo { FileName = SentryCli.SetupSentryCli(), WorkingDirectory = projectDir, Arguments = "upload-dif " + paths, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true } }; process.StartInfo.EnvironmentVariables["SENTRY_ORG"] = cliOptions.Organization; process.StartInfo.EnvironmentVariables["SENTRY_PROJECT"] = cliOptions.Project; process.StartInfo.EnvironmentVariables["SENTRY_AUTH_TOKEN"] = cliOptions.Auth; process.OutputDataReceived += (sender, args) => logger.LogDebug($"sentry-cli: {args.Data.ToString()}"); process.ErrorDataReceived += (sender, args) => logger.LogError($"sentry-cli: {args.Data.ToString()}"); process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(); }