newrelic / newrelic-cordova-plugin

A Cordova plugin for the New Relic Mobile SDKs
Apache License 2.0
18 stars 66 forks source link

Adding plugin breaks CocoaPods in iOS #6

Closed jopache closed 2 years ago

jopache commented 7 years ago

I've got a Cordova plugin that uses Cocoapods to reference a dependency. The build runs just fine when adding my plugin, however if I add this plugin as well, it breaks the 'Pod Install' command so the dependencies never get referenced correctly, causing the build of my iOS project to fail.

The error I'm seeing in the 'pod install' command is the following:

runtimeError - [!] Xcodeproj doesn't know about the following attributes {"uuid"=>"undefined"} for the 'PBXShellScriptBuildPhase' isa.
If this attribute was generated by Xcode please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new
/Users/jose.pacheco/.rvm/gems/ruby-2.4.1/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object.rb:321:in `configure_with_plist'
/Users/jose.pacheco/.rvm/gems/ruby-2.4.1/gems/xcodeproj-1.5.2/lib/xcodeproj/project.rb:261:in `new_from_plist'
/Users/jose.pacheco/.rvm/gems/ruby-2.4.1/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object.rb:350:in `object_with_uuid'

And looking through the plugin scripts, it looks like installing the plugin adds this to the project.pbxproj file

751B37AA16934125868FBCA2 /* "New Relic dSYM Upload" */ = {
            isa = PBXShellScriptBuildPhase;
            buildActionMask = 2147483647;
            files = (
            );
            inputPaths = (
            );
            name = "New Relic dSYM Upload";
            outputPaths = (
            );
            runOnlyForDeploymentPostprocessing = 0;
            shellPath = /bin/sh;
            shellScript = "SCRIPT=`/usr/bin/find \"${SRCROOT}\" -name newrelic_postbuild.sh | head -n 1`;/bin/sh \"${SCRIPT}\" \"key omitted\"; ";
            showEnvVarsInLog = 0;
            uuid = undefined;
        };

looks like the uuid = undefined (second to last line above) is what is causing all the trouble. If I remove the line manually, then the project will build, however this does not work with my continuous integration as it requires pulling down the repo, adding the plugins, then building and is not user intervention friendly.

Is there any way to remove the uuid = undefined or alleviate the issue? What is it even used for?

jopache commented 7 years ago

Looks like https://github.com/newrelic/newrelic-cordova-plugin/blob/master/hooks/ios/script-phase.js gets serialized and written out to the pbx proj.

The only place that script above appears to be referenced is here: https://github.com/newrelic/newrelic-cordova-plugin/blob/master/hooks/ios/ios.js#L77

and the uuid property is not even passed in. I dont see any other references to any uuid property of any type in any javascript, however I see a UUID referenced in the post build shell script (although I'm not sure if this is the same uuid in question as its doing some curl commands and stuff): https://github.com/newrelic/newrelic-cordova-plugin/blob/master/libs/ios/NewRelicAgent.framework/Versions/A/Resources/newrelic_postbuild.sh#L51

Given that:

I will be creating a PR to have this removed.

jopache commented 7 years ago

Created #7 to address this.

jopache commented 7 years ago

Regarding my comment where the shell script has references to an UUID; by removing the uuid entry in the js file in my PR above, the pbxshellscriptbuildphase did remove the uuid property from it. Also, in the build process itself: https://github.com/newrelic/newrelic-cordova-plugin/blob/master/libs/ios/NewRelicAgent.framework/Versions/A/Resources/newrelic_postbuild.sh#L96

did spit out a uuid to the console, so I'm pretty sure removing the JS won't affect that script.

ndesai-newrelic commented 2 years ago

@jopache we are updating this and it will resolve this issue.