Skip to content

Dynamic plist dict key interpolation (e.g., exportOptions.plist provisioningProfiles) #232

@fkoeppel

Description

@fkoeppel

Description

When generating or merging a plist via Trapeze, variables placed in dictionary keys are not interpolated. Only values are interpolated. This breaks use cases like exportOptions.plist where the provisioningProfiles dictionary must use the app’s bundle identifier as the key. Trapeze leaves the literal variable name in the key, causing xcodebuild to miss the correct profile unless an additional post-processing step is applied.

Example

Desired plist output:

<dict>
  <key>provisioningProfiles</key>
  <dict>
    <key>com.example.myapp</key>
    <string>My iOS Profile</string>
  </dict>
</dict>

Actual output generated by Trapeze (note the literal key):

<dict>
  <key>provisioningProfiles</key>
  <dict>
    <key>$BUNDLE_ID</key>
    <string>My iOS Profile</string>
  </dict>
</dict>

Minimal Reproducible Configuration (trapeze.config.yaml)

context:
  env:
    BUNDLE_ID: com.example.myapp
    IOS_PROVISIONING_PROFILE: My iOS Profile

ios:
  plist:
    - path: ios/App/exportOptions.plist
      merge:
        provisioningProfiles:
          $BUNDLE_ID: $IOS_PROVISIONING_PROFILE
      # Quoting the key doesn’t help either:
      # merge:
      #   provisioningProfiles:
      #     "$BUNDLE_ID": "$IOS_PROVISIONING_PROFILE"

Steps to Reproduce

  1. Create the trapeze.config.yaml as shown above.
  2. Ensure ios/App exists; let Trapeze create/merge exportOptions.plist.
  3. Run: npx trapeze run ./trapeze.config.yaml -y.
  4. Inspect ios/App/exportOptions.plist and check the provisioningProfiles dictionary key.

Expected Behavior

  • Variables should be interpolated in dictionary keys. For the example above, the key should become com.example.myapp.

Actual Behavior

  • The key remains the literal variable name: $BUNDLE_ID.

Impact

  • xcodebuild cannot match the provisioning profile because the provisioningProfiles dictionary requires the real bundle identifier as the key. This breaks automated iOS build pipelines unless a custom post-processing step is added.

Workaround

  • Post-process the generated exportOptions.plist after running Trapeze and replace <key>$BUNDLE_ID</key> with the actual bundle identifier key.

Proposed Fix

  • Add interpolation support for dictionary keys during plist generation/merge, mirroring value interpolation behavior. This would allow:
    • provisioningProfiles: { $BUNDLE_ID: $IOS_PROVISIONING_PROFILE }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions