bamlab / fastlane-plugin-cordova

Integrate your Cordova build into your Fastlane setup
MIT License
115 stars 39 forks source link

Cordova build works and ipa is archived but error occurs at cordova stage #20

Open gianpaj opened 7 years ago

gianpaj commented 7 years ago

Any suggestions?

$ bundle exec fastlane ios release
+-------------------------+---------+---------+
|                Used plugins                 |
+-------------------------+---------+---------+
| Plugin                  | Version | Action  |
+-------------------------+---------+---------+
| fastlane-plugin-cordova | 1.0.0   | cordova |
+-------------------------+---------+---------+

[00:32:48]: -------------------------------------------------
[00:32:48]: --- Step: Verifying required fastlane version ---
[00:32:48]: -------------------------------------------------
[00:32:48]: Your fastlane version 2.67.0 matches the minimum requirement of 2.25.0  ✅
[00:32:48]: ------------------------------
[00:32:48]: --- Step: default_platform ---
[00:32:48]: ------------------------------
[00:32:48]: Driving the lane 'ios release' 🚀
[00:32:48]: -------------------
[00:32:48]: --- Step: match ---
[00:32:48]: -------------------
[00:32:48]: Successfully loaded 'fastlane/Matchfile' 📄

+----------------+----------------------------------------------------+
|             Detected Values from './fastlane/Matchfile'             |
+----------------+----------------------------------------------------+
| git_url        | git@bitbucket.org:app/ios.certs.git |
| type           | development                                        |
| app_identifier | xxx                                        |
| username       | xxx                             |
+----------------+----------------------------------------------------+

+-----------------------+----------------------------------------------------+
|                          Summary for match 2.67.0                          |
+-----------------------+----------------------------------------------------+
| type                  | appstore                                           |
| readonly              | true                                               |
| git_url        | git@bitbucket.org:app/ios.certs.git |
| git_branch            | master                                             |
| app_identifier        | xxx                                        |
| username              | xxx                             |
| keychain_name         | login.keychain                                     |
| team_id               | 6TYG6TV7WQ                                         |
| verbose               | false                                              |
| force                 | false                                              |
| skip_confirmation     | false                                              |
| shallow_clone         | false                                              |
| clone_branch_directly | false                                              |
| force_for_new_devices | false                                              |
| skip_docs             | false                                              |
| platform              | ios                                                |
+-----------------------+----------------------------------------------------+

[00:32:48]: Cloning remote git repo...
[00:32:48]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[00:32:54]: 🔓  Successfully decrypted certificates repo
[00:32:54]: Installing certificate...

+-------------------+------------------------------------------------------+
|                          Installed Certificate                           |
+-------------------+------------------------------------------------------+
| User ID           | 6TYG6TV7WQ                                           |
| Common Name       | iPhone Distribution: Gianfranco Palumbo (6TYG6TV7WQ) |
| Organisation Unit | 6TYG6TV7WQ                                           |
| Organisation      | Gianfranco Palumbo                                   |
| Country           | US                                                   |
| Start Datetime    | Nov  9 13:57:32 2017 GMT                             |
| End Datetime      | Nov  9 13:57:32 2018 GMT                             |
+-------------------+------------------------------------------------------+

[00:32:54]: Installing provisioning profile...

+---------------------+----------------------------------------+---------------------------------------------------------------+
|                                                Installed Provisioning Profile                                                |
+---------------------+----------------------------------------+---------------------------------------------------------------+
| Parameter           | Environment Variable                   | Value                                                         |
+---------------------+----------------------------------------+---------------------------------------------------------------+
| App Identifier      |                                        | xxx                                                   |
| Type                |                                        | appstore                                                      |
| Platform            |                                        | ios                                                           |
| Profile UUID        | sigh_xyz.appstore              | b8fb95a1-64df-425d-ad85-331d51fc25fe                          |
| Profile Name        | sigh_xyz.appstore_profile-name | match AppStore xxx                                    |
| Profile Path        | sigh_xyz.appstore_profile-path | /Library/MobileDevice/Provisioning           |
|                     |                                        | Profiles/b8fb95a1-64df-425d-ad85-331d51fc25fe.mobileprovision |
| Development Team ID | sigh_xyz.appstore_team-id      | 6TYG6TV7WQ                                                    |
+---------------------+----------------------------------------+---------------------------------------------------------------+

[00:32:54]: All required keys, certificates and provisioning profiles are installed 🙌
[00:32:54]: Setting Provisioning Profile type to 'app-store'
[00:32:54]: ---------------------
[00:32:54]: --- Step: cordova ---
[00:32:54]: ---------------------
[00:32:54]: $ cordova prepare ios --release --device --packageType=app-store --developmentTeam=6TYG6TV7WQ --provisioningProfile=b8fb95a1-64df-425d-ad85-331d51fc25fe --

...

** ARCHIVE SUCCEEDED **

Error: ENOENT: no such file or directory, open 'platforms/ios/App.xcworkspace/project.pbxproj'

Lane:

  lane :release do
    match(type: "appstore", readonly: true)

    # Build ionic angular app
    sh("NODE_ENV=prod ionic build --prod")

    # Compile the ionic app (release and appstore/production)
    cordova(platform: 'ios')

    # Upload a new binary to iTunes Connect for TestFlight beta testing
    pilot(
      skip_waiting_for_build_processing: true,
      ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'])
  end
$ ionic info

cli packages: (/Users/gianfranco/.config/yarn/global/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : android 6.2.3 ios 4.5.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v6.11.3
    npm               : 5.5.1
    OS                : macOS Sierra
    Xcode             : Xcode 9.1 Build version 9B55

Environment Variables:

    ANDROID_HOME : /Users/gianfranco/Library/Android/sdk

Any suggestions?

Building and archiving works when done from Xcode

janpio commented 7 years ago

Is this all the output you get when running the lane? Nothing else before or after ** ARCHIVE SUCCEEDED **?

gianpaj commented 7 years ago

There's all the output from the cordova build command of course.

Here's a little bit more:

Touch build/device/App.app.dSYM
    cd mobile/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bin:/Users/gianfranco/.rbenv/versions/2.3.1/bin:/usr/local/Cellar/rbenv/1.1.1/libexec:/Users/gianfranco/.yarn/bin:/Users/gianfranco/.rbenv/shims:/usr/local/opt/qt/bin:/Users/gianfranco/google-cloud-sdk/bin:/Users/gianfranco/.fastlane/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:/Users/gianfranco/bin:/usr/local/opt/openssl/bin:/Users/gianfranco/.nvm/versions/node/v6.11.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/ImageMagick/bin:/usr/local/MacGPG2/bin:/Users/gianfranco/.composer/vendor/bin:/Users/gianfranco/Library/Android/sdk/platform-tools:/Users/gianfranco/Library/Android/sdk/tools:/Users/gianfranco/.themekit"
    /usr/bin/touch -c platforms/ios/build/device/App.app.dSYM

** ARCHIVE SUCCEEDED **

Error: ENOENT: no such file or directory, open 'platforms/ios/App.xcworkspace/project.pbxproj'

  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane_core/lib/fastlane_core/ui/interface.rb:143:in `shell_error!'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane_core/lib/fastlane_core/ui/ui.rb:14:in `method_missing'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/helper/sh_helper.rb:56:in `sh_control_output'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/action.rb:98:in `sh'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-plugin-cordova-1.0.0/lib/fastlane/plugin/cordova/actions/cordova_action.rb:94:in `build'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-plugin-cordova-1.0.0/lib/fastlane/plugin/cordova/actions/cordova_action.rb:107:in `run'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/runner.rb:253:in `block (2 levels) in execute_action'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/runner.rb:231:in `block in execute_action'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/runner.rb:148:in `trigger_action_by_name'
  /Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.67.0/fastlane/lib/fastlane/fast_file.rb:146:in `method_missing'
  Fastfile:52:in `block (2 levels) in parsing_binding'
janpio commented 7 years ago

Hmm, I don't understand what is triggering this command that is failing...

You are not using the build_number param, correct? Inside the build output should be a generated cordova compile command. Can you post that one and execute it manually, then post what happens? Maybe really post (or attach a file containing) the complete output of the command with nothing missing.

gianpaj commented 7 years ago

There is a cordova compile:

[12:07:26]: $ cordova compile ios --release --device --packageType=app-store --developmentTeam=6TYG6TV7WQ --provisioningProfile=b8fb95a1-64df-425d-ad85-331d51fc25fe --

Here is the end of that command output:

[12:07:56]: ▸ cd /Users/gianfranco/App/mobile/platforms/ios
[12:07:56]: ▸ export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bin:/Users/gianfranco/.rbenv/versions/2.3.1/bin:/usr/local/Cellar/rbenv/1.1.1/libexec:/Users/gianfranco/.yarn/bin:/Users/gianfranco/.rbenv/shims:/usr/local/opt/qt/bin:/Users/gianfranco/google-cloud-sdk/bin:/Users/gianfranco/.fastlane/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:/Users/gianfranco/bin:/usr/local/opt/openssl/bin:/Users/gianfranco/.nvm/versions/node/v6.11.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/ImageMagick/bin:/usr/local/MacGPG2/bin:/Users/gianfranco/.composer/vendor/bin:/Users/gianfranco/Library/Android/sdk/platform-tools:/Users/gianfranco/Library/Android/sdk/tools:/Users/gianfranco/.themekit"
[12:07:56]: ▸ export PRODUCT_TYPE=com.apple.product-type.application
[12:07:56]: ▸ builtin-validationUtility /Users/gianfranco/Library/Developer/Xcode/DerivedData/App-guwlrhjlnmimtjgznuegwhgvzgwd/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app
[12:07:56]: ▸ Touch build/device/App.app.dSYM
[12:07:56]: ▸ cd /Users/gianfranco/App/mobile/platforms/ios
[12:07:56]: ▸ export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/gianfranco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bin:/Users/gianfranco/.rbenv/versions/2.3.1/bin:/usr/local/Cellar/rbenv/1.1.1/libexec:/Users/gianfranco/.yarn/bin:/Users/gianfranco/.rbenv/shims:/usr/local/opt/qt/bin:/Users/gianfranco/google-cloud-sdk/bin:/Users/gianfranco/.fastlane/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:/Users/gianfranco/bin:/usr/local/opt/openssl/bin:/Users/gianfranco/.nvm/versions/node/v6.11.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/ImageMagick/bin:/usr/local/MacGPG2/bin:/Users/gianfranco/.composer/vendor/bin:/Users/gianfranco/Library/Android/sdk/platform-tools:/Users/gianfranco/Library/Android/sdk/tools:/Users/gianfranco/.themekit"
[12:07:56]: ▸ /usr/bin/touch -c platforms/ios/build/device/App.app.dSYM
[12:07:56]: ▸ ** ARCHIVE SUCCEEDED **
[12:07:56]: ▸ Error: ENOENT: no such file or directory, open platforms/ios/App.xcworkspace/project.pbxproj'
+------------------------------------+----------------------------------+
|                             Lane Context                              |
+------------------------------------+----------------------------------+
| DEFAULT_PLATFORM                   | ios                              |
| PLATFORM_NAME                      | ios                              |
| LANE_NAME                          | ios release                      |
| SIGH_PROFILE_TYPE                  | app-store                        |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"xyz.x"=>"match AppStore  |
|                                    | xyz.x"}                    |
+------------------------------------+----------------------------------+
[12:07:57]: Exit status of command 'cordova compile ios --release --device --packageType=app-store --developmentTeam=6TYG6TV7WQ --provisioningProfile=b8fb95a1-64df-425d-ad85-331d51fc25fe -- ' was 1 instead of 0.
Reading build config file:
Building project: mobile/platforms/ios/App.xcworkspace
    Configuration: Release
    Platform: device

Here is the full output (i ran it again. the lane might be slightly different): fastlane-output.txt.zip (i had to compress the 9.3MB output) 😲

I ran the cordova compile ios --release ... command manually and it gave me the same error. I suppose that needs to work first.

So, I managed to make an .ipa running the build command:

$ cordova build ios --release --device --packageType=app-store --developmentTeam=xxx --provisioningProfile=xxx

...

Touch build/device/App.app.dSYM
    cd platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/gianfranco/.yarn/bin:/Users/gianfranco/.rbenv/shims:/usr/local/opt/qt/bin:/Users/gianfranco/google-cloud-sdk/bin:/Users/gianfranco/.fastlane/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:/Users/gianfranco/bin:/usr/local/opt/openssl/bin:/Users/gianfranco/.nvm/versions/node/v6.11.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/ImageMagick/bin:/usr/local/MacGPG2/bin:/Users/gianfranco/.composer/vendor/bin:/Users/gianfranco/Library/Android/sdk/platform-tools:/Users/gianfranco/Library/Android/sdk/tools:/Users/gianfranco/.themekit"
    /usr/bin/touch -c platforms/ios/build/device/App.app.dSYM

** ARCHIVE SUCCEEDED **

Non-system Ruby in use. This may cause packaging to fail.
If you use RVM, please run `rvm use system`.
If you use chruby, please run `chruby system`.
2017-11-29 12:51:00.587 xcodebuild[63609:7028130] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/nc/scs6t9xj61l7rtzhz8cl48480000gn/T/App_2017-11-29_12-51-00.586.xcdistributionlogs'.
Exported App.xcarchive to: platforms/ios/build/device
** EXPORT SUCCEEDED **
$ ll platforms/ios/build/device/*.ipa
-rw-r--r--  1 gianfranco  staff   7.1M 29 Nov 12:51 platforms/ios/build/device/App.ipa

How do I tell the fastlane cordova plugin to run the build command instead of compile?

janpio commented 7 years ago

How do I tell the fastlane cordova plugin to run the build command instead of compile?

You don't as it runs prepare and compile, which is the same thing as build - or at least should be (https://cordova.apache.org/docs/en/latest/reference/cordova-cli/#cordova-build-command: "Shortcut for cordova prepare + cordova compile") ;)

(i had to compress the 9.3MB output) 😲

Yeah, the Cordova build commands are a bit "chatty". I am still undecided if this is a good thing.

So, I managed to make an .ipa running the build command:

Just to confirm, replacing compile from the command the plugin generated with build enabled you to create a build manually, right?


You seem to have triggered a Cordova bug here somehow.

I looked into the error message again:

[12:07:56]: ▸ Error: ENOENT: no such file or directory, open '/Users/gianfranco/givebox/givebox.ui.mobile/platforms/ios/Givebox.xcworkspace/project.pbxproj'

This is indeed true, as the project.pbxproj is inside the Givebox.xcodeproj folder, not the .xcworkspace. Could you check and confirm that please?

I just noticed Cordova Platforms : android 6.2.3 ios 4.5.3. cordova-ios 4.5.4 was release a few days ago. Could you maybe install that and try again?

(If this doesn't help, I think you should create an issue at issues.cordova.io showing your both commands, compile and build, and explain how one fails while the other succeeds)

gianpaj commented 7 years ago

This is indeed true, as the project.pbxproj is inside the App.xcodeproj folder, not the .xcworkspace. Could you check and confirm that please?

Yes. That file does not exist:

$ ll platforms/ios/App.xcworkspace/
total 8
-rw-r--r--  1 gianfranco  staff   225B  9 Nov 16:59 contents.xcworkspacedata
drwxr-xr-x  3 gianfranco  staff   102B  9 Nov 16:59 xcshareddata
drwxr-xr-x  3 gianfranco  staff   102B  9 Nov 22:04 xcuserdata

I'll open a bug report for Cordova.

In the meantime I found a workaround if anybody is having the same issue:

$ cd your_ionic_or_cordova_project
$ ln -s platforms/ios/YOUR_IOS_APP.xcodeproj/project.pbxproj platforms/ios/YOUR_IOS_APP.xcworkspace/project.pbxproj
janpio commented 7 years ago

Post the link to the Cordova issue here when done, we'll debug this further over there. Thanks.

gianpaj commented 7 years ago

I think you're right, it's an issue somewhere with cordova.

https://issues.apache.org/jira/browse/CB-13618

FYI: upgrading to cordova-ios 4.5.4 did not fix the issue

l0stpenguin commented 5 years ago

@gianpaj i am having the same issue, the cordova ticket you linked does not seem to be progressing. I tried the following workaround as you suggested but it did not work.

$ cd your_ionic_or_cordova_project
$ ln -s platforms/ios/YOUR_IOS_APP.xcodeproj/project.pbxproj platforms/ios/YOUR_IOS_APP.xcworkspace/project.pbxproj
gianpaj commented 5 years ago

@mevinDhun , sorry I don't know what it could be. I haven't used cordova in a while now.