DataDog / datadog-react-native-wizard

Setup wizard for Datadog React Native SDK
Apache License 2.0
4 stars 2 forks source link

(iOS) Multiple target support. #30

Open Volksfeld opened 5 months ago

Volksfeld commented 5 months ago

Describe what happened Beforehand, please let me know if I missed something from the source or if this is a expected behavior!

While configuring the project and running the wizard, I've noticed that the buildPhase "Upload dSYMs to Datadog" was only created for one of the targets. In our app, we have the targets "staging" and "production". In our Podfile, these targets are also targets of our "main" abstract target. I came about this issue out of luck: while reviewing the diffs in the .pbxproj, I noticed that the buildPhase was only delcared in one of the targets (staging).

Steps to reproduce the issue: 📝 Have a React Native project with 2 iOS targets and run the wizard.

Expected behaviour: 📝 All targets should be affected by the wizard.

Actual behaviour: 📝 Only one target was affected by the wizard.

Additional context I've done some tinkering and copied the build phase from one target into the other. I'll add a comment if it works as expected.

   xcodeProject.addBuildPhase(
        [],
        "PBXShellScriptBuildPhase",
        "Upload dSYMs to Datadog",
        // ================
        // THIS GUY:
        null /* target */,
        // ================
        {
          shellScript: `set -e\\n../node_modules/.bin/datadog-ci dsyms upload $DWARF_DSYM_FOLDER_PATH`,
          shellPath: "/bin/sh",
        }
      );

We could have an array of targets and resolve a promise for each of those targets. Something like:

 const addBuilPhaseToPbxprojPromisse = targets.map(target => ...);
      await Promise.all(addBuilPhaseToPbxprojPromiesse);
marco-saia-datadog commented 4 months ago

Hey @Volksfeld, sorry for the long wait and thank you for your feedback.

You are correct, we should grant support for multiple targets in our wizard.

Did you manage to fix your problem by using the workaround you described?

I will keep you posted here as soon as we have a PR!