microsoft / entra-verifiedid-wallet-library-ios

A library to manage your Decentralized Identities and Verified IDs on iOS.
MIT License
23 stars 10 forks source link

Missing Identifier.mom file during build #48

Open nzcodarnoc opened 1 year ago

nzcodarnoc commented 1 year ago

During the build phase, the application is unable to find the Identifier.mom file, causing the build to fail.

The error message displayed is:

Resource "/Users/conrad/dev/JNCTN-UX/apps/jnctn-mobile/ios/build/Build/Products/Debug-iphonesimulator/WalletLibrary/WalletLibrary.framework/Identifier.mom" not found. Run 'pod install' to update the copy resources script.

To Reproduce

Steps to reproduce the behavior:

  1. Clone the repository
  2. In the Podfile set use_frameworks! :linkage => :static
  3. Run pod install
  4. Build the project
  5. See error

Expected behavior

The Identifier.mom file should be correctly located and the build should succeed without any issues.

Workaround

Currently, a workaround for this issue involves adding a new "Run Script" phase in the build phases of the WalletLibrary target using a post_install hook in the Podfile.

Here is the script:

    installer.pods_project.targets.each do |target|
      # BEGIN support for WalletLibrary
      if target.name == 'WalletLibrary'
        target.build_configurations.each do |config|
          config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = ['$(inherited)', '@executable_path/Frameworks']
          phase_name = "Copy Identifier.mom for WalletLibrary"
          script_phase = target.shell_script_build_phases.find { |bp| bp.name == phase_name }
          unless script_phase
            script_phase = target.new_shell_script_build_phase(phase_name)
            script_phase.shell_script = <<-SCRIPT
              SOURCE_PATH="${TARGET_BUILD_DIR}/WalletLibrary.framework/VerifiableCredentialDataModel.momd/Identifier.mom"
              DEST_PATH="${TARGET_BUILD_DIR}/WalletLibrary.framework/Identifier.mom"
              mkdir -p "$(dirname "$DEST_PATH")"
              if [ -f "$SOURCE_PATH" ]; then
                  cp "$SOURCE_PATH" "$DEST_PATH"
              else
                  echo "File $SOURCE_PATH does not exist."
              fi
            SCRIPT
          end
        end
      end
      # END support for WalletLibrary
    end      

This script will copy the Identifier.mom file from its generated location to the expected location, resolving the build error.

This is only a workaround, and the issue should ideally be addressed in the core project so that manual intervention is not required.

Environment

WalletLibrary: 0.0.1-beta.2 OS: macOS 13.4 Xcode version: 14.3 Cocoapods version: 1.11.3

symorton commented 1 year ago

Thank you for this work around. We currently have it in the roadmap to make the Identifier layer pluggable, hopefully fixing this issue. We are still working on the priority for this feature. Will update the issue when this feature is added.

nzcodarnoc commented 5 months ago

Based on testing just now, this patch is still required for v1.0.0