Skip to content

chore: Removed deprecated Sentry json options #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

### Fixes

- Dropped support for Sentry options as Json ([#709](https://github.com/getsentry/sentry-unity/pull/709))
- If you're migrating from version 0.3.0 or older, make sure to upgrade to 0.15.0 first, as it is the last version supporting the automated conversion of the options as Json file to a Scriptable Object.

## 0.15.0

### Features
Expand Down
21 changes: 0 additions & 21 deletions src/Sentry.Unity.Editor/ConfigurationWindow/SentryWindow.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using Sentry.Extensibility;
using Sentry.Unity.Json;
using UnityEditor;
using UnityEngine;

Expand Down Expand Up @@ -43,7 +42,6 @@ private void Awake()
{
SetTitle();

CheckForAndConvertJsonConfig();
Options = LoadOptions();
CliOptions = SentryCliOptions.LoadCliOptions();
}
Expand Down Expand Up @@ -83,25 +81,6 @@ internal static ScriptableSentryUnityOptions CreateOptions(string? notDefaultCon
return scriptableOptions;
}

private void CheckForAndConvertJsonConfig()
{
var sentryOptionsTextAsset =
AssetDatabase.LoadAssetAtPath(JsonSentryUnityOptions.GetConfigPath(), typeof(TextAsset)) as TextAsset;
if (sentryOptionsTextAsset is null)
{
// Json config not found, nothing to do.
return;
}

var scriptableOptions = CreateOptions(SentryOptionsAssetName);
JsonSentryUnityOptions.ToScriptableOptions(sentryOptionsTextAsset, scriptableOptions);

EditorUtility.SetDirty(scriptableOptions);
AssetDatabase.SaveAssets();

AssetDatabase.DeleteAsset(JsonSentryUnityOptions.GetConfigPath());
}

// ReSharper disable once UnusedMember.Local
private void OnGUI()
{
Expand Down
8 changes: 0 additions & 8 deletions src/Sentry.Unity/ScriptableSentryUnityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ public static string GetConfigPath(string? notDefaultConfigName = null)

public static SentryUnityOptions? LoadSentryUnityOptions(bool isBuilding = false)
{
// TODO: Deprecated and to be removed once we update far enough.
var sentryOptionsTextAsset = Resources.Load<TextAsset>($"{ConfigRootFolder}/{ConfigName}");
if (sentryOptionsTextAsset != null)
{
var options = JsonSentryUnityOptions.LoadFromJson(sentryOptionsTextAsset);
return options;
}

var scriptableOptions = Resources.Load<ScriptableSentryUnityOptions>($"{ConfigRootFolder}/{ConfigName}");
if (scriptableOptions is not null)
{
Expand Down
11 changes: 0 additions & 11 deletions test/Sentry.Unity.Tests/ScriptableSentryUnityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ class TestOptionsConfiguration : ScriptableOptionsConfiguration
public void Setup() => _fixture = new Fixture();
private Fixture _fixture = null!;

[Test]
public void Options_ReadFromJson_Success()
{
var optionsFilePath = GetTestOptionsFilePath();
Assert.IsTrue(File.Exists(optionsFilePath));

var jsonTextAsset = new TextAsset(File.ReadAllText(GetTestOptionsFilePath()));

JsonSentryUnityOptions.LoadFromJson(jsonTextAsset);
}

[Test]
[TestCase(true)]
[TestCase(false)]
Expand Down