Skip to content

Commit

Permalink
Fix: Duplicated Signature issue with Xcode 15 #12022
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrauber committed Jan 29, 2024
1 parent 63c2c0b commit a32bb57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/src/withMapLibre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ export function setExcludedArchitectures(project: XcodeProject): XcodeProject {
typeof buildSettings?.PRODUCT_NAME !== 'undefined'
) {
buildSettings['"EXCLUDED_ARCHS[sdk=iphonesimulator*]"'] = '"arm64"';
project.addBuildPhase([
'name = "Remove Signatures"',
'shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then\n echo \"********* Remove signature files (Xcode 15 workaround)\"\n\n rm -rf \"$BUILD_DIR/Release-iphoneos/Mapbox.xcframework-ios.signature\"\n fi\n";',

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Replace `\"$XCODE_VERSION_MAJOR\"·=·\"1500\"·];·then\n·echo·\"*********·Remove·signature·files·(Xcode·15·workaround)\"\n\n·rm·-rf·\"$BUILD_DIR/Release-iphoneos/Mapbox.xcframework-ios.signature\` with `"$XCODE_VERSION_MAJOR"·=·"1500"·];·then\n·echo·"*********·Remove·signature·files·(Xcode·15·workaround)"\n\n·rm·-rf·"$BUILD_DIR/Release-iphoneos/Mapbox.xcframework-ios.signature`

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"

Check failure on line 130 in plugin/src/withMapLibre.ts

View workflow job for this annotation

GitHub Actions / lint_test_generate

Unnecessary escape character: \"
]);
}
}

return project;
}

Expand Down

3 comments on commit a32bb57

@gorbypark
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry for the drive by comment but I am trying to fix this issue in our project as well that is using maplibre-react-native. For some reason it seems the escaping is not correct, I keep getting the error SyntaxError: [ios.entitlements]: withIosEntitlementsBaseMod: Expected "/*" or ";" but "R" found.. Any chance you could post your transpiled withMapLibre.js so I can try and use patch-package with it? I'm also having issues forking+applying this patch+building and actually using this fork.

@tyrauber
Copy link
Owner Author

@tyrauber tyrauber commented on a32bb57 Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @gorbypark, I don't have a working plugin yet. I just burnt through my monthly EAS minutes trying to debug this.

SyntaxError: [ios.entitlements]: withIosEntitlementsBaseMod: Expected "/*" or ";" but "R" found.
I was getting that error on EAS as well. I am concerned project.addBuildPhase may not be correct.

      project.addBuildPhase([
        'name = "Remove Signatures"',
        'shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then\n echo \"********* Remove signature files (Xcode 15 workaround)\"\n\n rm -rf \"$BUILD_DIR/Release-iphoneos/Mapbox.xcframework-ios.signature\"\n fi\n";',
      ]);

I am now trying a project specific plugin to see if I can come up with a working system, which I can back port to maplibre-rect-native:

const { createRunOncePlugin, withXcodeProject } = require('@expo/config-plugins');
const { execSync } = require('child_process');

function removeSignature(project) {
  const configurations = project.pbxXCBuildConfigurationSection();
  Object.values(configurations).forEach(({name, buildSettings}) => {
    console.log({name, buildSettings});
    if (
      name === 'Release'
    ) {
      // project.addBuildPhase([
      //   'name = "Remove Signatures"',
      //   'shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then\n echo \"********* Remove signature files (Xcode 15 workaround)\"\n\n rm -rf \"$BUILD_DIR/Release-iphoneos/Mapbox.xcframework-ios.signature\"\n fi\n";',
      // ]);
      try {
        execSync('find "$BUILD_DIR" -type f -name "Mapbox.xcframework-ios.signature" -exec rm {} \\;');
        console.log('Files removed successfully.');
      } catch (error) {
        console.error('Error while removing files:', error.message);
      }
    }
  });
  return project;
}

const withPlugin = (c) => {
 return withXcodeProject(c, (config) => {
    config.modResults = removeSignature(config.modResults);
    return config;
  });
};

module.exports = createRunOncePlugin(withPlugin);

II am trying to build locally as well to limit my EAS financial exposure:

$ ENVIRONMENT=staging npx eas build --platform ios --local --profile staging

But I am hitting this error: expo/eas-cli#2111

Seems like XCode 15 doesn't play as nicely with expo as previous versions.

@gorbypark
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I am hitting this error: expo/eas-cli#2111

this seems to be fixed in Xcode 15.2 if upgrading is an option

Please sign in to comment.