-
-
Notifications
You must be signed in to change notification settings - Fork 55
Integration-test building without sentry SDK only on main
branch
#785
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,19 +20,26 @@ internal class DebugSymbolUpload | |
|
||
private readonly string _unityProjectPath; | ||
private readonly string _gradleProjectPath; | ||
private readonly ScriptingImplementation _scriptingBackend; | ||
|
||
private readonly SentryCliOptions? _cliOptions; | ||
internal string[] _symbolUploadPaths; | ||
|
||
private const string SymbolUploadTaskStartComment = "// Autogenerated Sentry symbol upload task [start]"; | ||
private const string SymbolUploadTaskEndComment = "// Autogenerated Sentry symbol upload task [end]"; | ||
|
||
private string _symbolUploadTask = @" | ||
// Credentials and project settings information are stored in the sentry.properties file | ||
gradle.taskGraph.whenReady {{ | ||
gradle.taskGraph.allTasks[-1].doLast {{ | ||
println 'Uploading symbols to Sentry' | ||
println 'Uploading symbols to Sentry. You can find the full log in ./Logs/sentry-symbols-upload.log (the file content may not be strictly sequential because it\'s a merge of two streams).' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
def sentryLogFile = new FileOutputStream('{2}/Logs/sentry-symbols-upload.log') | ||
exec {{ | ||
environment ""SENTRY_PROPERTIES"", ""./sentry.properties"" | ||
executable ""{0}"" | ||
args = [""upload-dif"", {1}] | ||
environment 'SENTRY_PROPERTIES', './sentry.properties' | ||
executable '{0}' | ||
args = ['upload-dif', {1}] | ||
standardOutput sentryLogFile | ||
errorOutput sentryLogFile | ||
}} | ||
}} | ||
}}"; | ||
|
@@ -41,13 +48,15 @@ public DebugSymbolUpload(IDiagnosticLogger logger, | |
SentryCliOptions? cliOptions, | ||
string unityProjectPath, | ||
string gradleProjectPath, | ||
ScriptingImplementation scriptingBackend, | ||
bool isExporting = false, | ||
IApplication? application = null) | ||
{ | ||
_logger = logger; | ||
|
||
_unityProjectPath = unityProjectPath; | ||
_gradleProjectPath = gradleProjectPath; | ||
_scriptingBackend = scriptingBackend; | ||
|
||
_cliOptions = cliOptions; | ||
_symbolUploadPaths = GetSymbolUploadPaths(isExporting, application); | ||
|
@@ -94,7 +103,9 @@ public void AppendUploadToGradleFile(string sentryCliPath) | |
} | ||
|
||
using var streamWriter = File.AppendText(gradleFilePath); | ||
streamWriter.Write(_symbolUploadTask, sentryCliPath, uploadDifArguments); | ||
streamWriter.WriteLine(SymbolUploadTaskStartComment); | ||
streamWriter.WriteLine(_symbolUploadTask.Trim(), sentryCliPath, uploadDifArguments, ConvertSlashes(_unityProjectPath)); | ||
streamWriter.WriteLine(SymbolUploadTaskEndComment); | ||
} | ||
|
||
public void RemoveUploadFromGradleFile() | ||
|
@@ -114,12 +125,8 @@ public void RemoveUploadFromGradleFile() | |
return; | ||
} | ||
|
||
// Replacing the paths with '.*' and escaping the task | ||
var uploadTaskFilter = string.Format(_symbolUploadTask, ".*", ".*"); | ||
uploadTaskFilter = Regex.Replace(uploadTaskFilter, "\"", "\\\""); | ||
uploadTaskFilter = Regex.Replace(uploadTaskFilter, @"\[", "\\["); | ||
|
||
gradleBuildFile = Regex.Replace(gradleBuildFile, uploadTaskFilter, ""); | ||
var regex = new Regex(Regex.Escape(SymbolUploadTaskStartComment) + ".*" + Regex.Escape(SymbolUploadTaskEndComment), RegexOptions.Singleline); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing that! |
||
gradleBuildFile = regex.Replace(gradleBuildFile, ""); | ||
|
||
using var streamWriter = File.CreateText(gradleFilePath); | ||
streamWriter.Write(gradleBuildFile); | ||
|
@@ -161,7 +168,7 @@ internal string[] GetSymbolUploadPaths(bool isExporting, IApplication? applicati | |
if (IsNewBuildingBackend(application)) | ||
{ | ||
_logger.LogInfo("Unity version 2021.2 or newer detected. Root for symbols upload: 'Library'."); | ||
if (!IsMono) | ||
if (_scriptingBackend == ScriptingImplementation.IL2CPP) | ||
{ | ||
paths.Add(Path.Combine(_unityProjectPath, RelativeBuildOutputPathNew)); | ||
} | ||
|
@@ -170,7 +177,7 @@ internal string[] GetSymbolUploadPaths(bool isExporting, IApplication? applicati | |
else | ||
{ | ||
_logger.LogInfo("Unity version 2021.1 or older detected. Root for symbols upload: 'Temp'."); | ||
if (!IsMono) | ||
if (_scriptingBackend == ScriptingImplementation.IL2CPP) | ||
{ | ||
paths.Add(Path.Combine(_unityProjectPath, RelativeBuildOutputPathOld)); | ||
} | ||
|
@@ -195,7 +202,5 @@ internal static bool IsNewBuildingBackend(IApplication? application = null) | |
|
||
// Gradle doesn't support backslashes on path (Windows) so converting to forward slashes | ||
internal static string ConvertSlashes(string path) => path.Replace(@"\", "/"); | ||
|
||
private static bool IsMono => PlayerSettings.GetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup) == ScriptingImplementation.Mono2x; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A surprise but a welcome one!