Skip to content

Commit

Permalink
universal uploader working
Browse files Browse the repository at this point in the history
  • Loading branch information
richardelms committed Dec 17, 2024
1 parent 20c7214 commit ce2c450
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Bugsnag/Assets/Bugsnag/Editor/SymbolUpload/BugsnagCLI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private int StartProcess(string fileName, string arguments, out string standardO

public string GetIosDsymUploadCommand(string apiKey, string uploadEndpoint)
{
var command = $"{_cliExecutablePath} upload dsym --api-key={apiKey} --configuration $CONFIGURATION $DSYM_PATH";
var command = $"{_cliExecutablePath} upload xcode-build --api-key={apiKey} $DWARF_DSYM_FOLDER_PATH";
if (!string.IsNullOrEmpty(uploadEndpoint))
{
command += $" --upload-api-root-url={uploadEndpoint}";
Expand Down
39 changes: 11 additions & 28 deletions Bugsnag/Assets/Bugsnag/Editor/SymbolUpload/BugsnagSymbolUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ internal class BugsnagSymbolUploader : IPostprocessBuildWithReport
{
public int callbackOrder => 1;

private const string IOS_DSYM_UPLOAD_SCRIPT_TEMPLATE = @"
#!/bin/bash
# Iterate through all input files
for ((i=0; i<SCRIPT_INPUT_FILE_COUNT; i++))
do
# Dynamically get the input file variable name
INPUT_FILE_VAR=""SCRIPT_INPUT_FILE_$i""
INPUT_FILE=${!INPUT_FILE_VAR}
# Extract path up to and including BugsnagUnity.app.dSYM
DSYM_PATH=$(echo ""$INPUT_FILE"" | sed 's#/Contents.*##')
echo ""Uploading dSYM: $DSYM_PATH""
# Upload the dSYM file
<CLI_COMMAND>
done";
private const string IOS_DSYM_UPLOAD_SCRIPT_TEMPLATE = @"#!/bin/bash
if [ ""$ACTION"" == ""install"" ]; then
echo ""Archiving - Running Bugsnag upload script...""
if ! <CLI_COMMAND>; then
echo ""warning: Bugsnag upload failed, continuing build...""
fi
else
echo ""Not archiving - Skipping Bugsnag upload script.""
fi
";

private const string IOS_DSYM_UPLOAD_BUILD_PHASE_NAME = "BugsnagDSYMUpload";
private const string IOS_DSYM_UPLOAD_SHELL_NAME = "/bin/sh";
Expand Down Expand Up @@ -138,20 +134,7 @@ private void AddIosPostBuildScript(string pathToBuiltProject, string apiKey, str
}
}

// add the upload script to the unity framework target
string unityFrameworkGUID = pbxProject.GetUnityFrameworkTargetGuid();
foreach (var guid in pbxProject.GetAllBuildPhasesForTarget(unityFrameworkGUID))
{
if (IOS_DSYM_UPLOAD_BUILD_PHASE_NAME == pbxProject.GetBuildPhaseName(guid))
{
// remove existing build phase
var editedProject = RemoveShellScriptPhase(pbxProject.WriteToString(), guid);
pbxProject.ReadFromString(editedProject);
}
}

pbxProject.AddShellScriptBuildPhase(mainAppTargetGUID, IOS_DSYM_UPLOAD_BUILD_PHASE_NAME, IOS_DSYM_UPLOAD_SHELL_NAME, dsymUploadScript, IOS_DSYM_UPLOAD_INPUT_FILES_LIST);
pbxProject.AddShellScriptBuildPhase(unityFrameworkGUID, IOS_DSYM_UPLOAD_BUILD_PHASE_NAME, IOS_DSYM_UPLOAD_SHELL_NAME, dsymUploadScript, IOS_DSYM_UPLOAD_INPUT_FILES_LIST);
pbxProject.AddShellScriptBuildPhase(mainAppTargetGUID, IOS_DSYM_UPLOAD_BUILD_PHASE_NAME, IOS_DSYM_UPLOAD_SHELL_NAME, dsymUploadScript);
pbxProject.WriteToFile(pbxProjectPath);
#endif
}
Expand Down

0 comments on commit ce2c450

Please sign in to comment.