hjanuschka / fastlane-plugin-update_project_codesigning

MIT License
52 stars 8 forks source link

`ProvisioningStyle` value not present in project.pbxproj #4

Closed realyze closed 7 years ago

realyze commented 7 years ago

If the xcode project hasn't been changed, the ProvisionStyle value may not be set at all, so the replacement will just silently fail.

hjanuschka commented 7 years ago

this https://github.com/hjanuschka/fastlane-plugin-update_project_codesigning/commit/87b55e0a461f6a5d9f9e016b83b1260fbde15768 should do it - it uses xcodeproj to modify project - and sets ProvisioningStyle even if it is unset.

rubygem release is also pushed

eneskaya commented 7 years ago

Hey I get following error message after your changes:

/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-update_provisioning_profile_specifier-1.1.0/lib/fastlane/plugin/update_provisioning_profile_specifier/actions/update_provisioning_profile_specifier_action.rb:13:in `join': [!] no implicit conversion of nil into String (TypeError)
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-update_provisioning_profile_specifier-1.1.0/lib/fastlane/plugin/update_provisioning_profile_specifier/actions/update_provisioning_profile_specifier_action.rb:13:in `run'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:202:in `block (2 levels) in execute_action'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:187:in `block in execute_action'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:186:in `chdir'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:186:in `execute_action'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:112:in `trigger_action_by_name'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/fast_file.rb:140:in `method_missing'
    from Fastfile:27:in `block (2 levels) in parsing_binding'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/lane.rb:33:in `call'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:49:in `block in execute'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:45:in `chdir'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:45:in `execute'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/lane_manager.rb:52:in `cruise_lane'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/command_line_handler.rb:30:in `handle'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:69:in `block (2 levels) in run'
    from /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:178:in `call'
    from /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:153:in `run'
    from /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/runner.rb:444:in `run_active_command'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane_core-0.54.0/lib/fastlane_core/ui/fastlane_runner.rb:38:in `run!'
    from /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/delegates.rb:15:in `run!'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:257:in `run'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:31:in `start'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/cli_tools_distributor.rb:58:in `take_off'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/bin/fastlane:5:in `<top (required)>'
    from /usr/local/bin/fastlane:23:in `load'
    from /usr/local/bin/fastlane:23:in `<main>'
hjanuschka commented 7 years ago

the stacktrace is from another plugin update_provisioning_profile_specifier_action

it seems to fail on

 pdir = params[:xcodeproj] || Dir["*.xcodeproj"].first
project_file_path = File.join(pdir, "project.pbxproj")

with pdir = nil this can happen if

so i think you should open an issue on the plugin repo https://github.com/faithfracture/update_provisioning_profile_specifier

fiahfy commented 7 years ago

Hi, I encountered following error when the Xcode project isn't opened.

bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
NoMethodError: [!] undefined method `each' for nil:NilClass
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-update_project_codesigning-0.1.3/lib/fastlane/plugin/update_project_codesigning/actions/update_project_codesigning_action.rb:12:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:202:in `block (2 levels) in execute_action'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:187:in `block in execute_action'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:186:in `chdir'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:186:in `execute_action'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:112:in `trigger_action_by_name'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/fast_file.rb:140:in `method_missing'
  Fastfile:65:in `block (2 levels) in parsing_binding'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/lane.rb:33:in `call'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:49:in `block in execute'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:45:in `chdir'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:45:in `execute'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/lane_manager.rb:52:in `cruise_lane'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/command_line_handler.rb:30:in `handle'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:69:in `block (2 levels) in run'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:178:in `call'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:153:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/runner.rb:444:in `run_active_command'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane_core-0.54.0/lib/fastlane_core/ui/fastlane_runner.rb:38:in `run!'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/delegates.rb:15:in `run!'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:257:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:31:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/cli_tools_distributor.rb:58:in `take_off'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/bin/fastlane:5:in `<top (required)>'
  /usr/local/bin/fastlane:23:in `load'
  /usr/local/bin/fastlane:23:in `<top (required)>'

I think that the error occurred if "TargetAttributes" is not set.

hjanuschka commented 7 years ago

@fiahfy - ohh ok an unconverted project - could you provide me a a sample project? i think we should check the LastUpgradeCheck - and bail out - telling the user to open xcode and convert to xcode8+ standards - before using this plugin.

fiahfy commented 7 years ago

@hjanuschka I pushed the sample project. https://github.com/fiahfy/ionic2-fastlane-sample/tree/master/platforms/ios This project has be created by cordova ionic2.

hjanuschka commented 7 years ago

@fiahfy thx for providing the sample. actually the problem is more complex - as the TargetAttributes settings are only available when you upgraded your project once with xcode8.

so the best solution would be - to open the xcode proj. convert it to new format, or cordova ships xcode8 projects?! 👍

however based on your sample project, i tried to implement a "upgrade-procedure" - wich is highly beta - and you should backup the .xcodeproj before you run it. - it will prompt you before it does actuall stuff.

the commit is https://github.com/hjanuschka/fastlane-plugin-update_project_codesigning/commit/67a2f8df27fc5afc40f6e06e7833c1bc9c163645

you have to get your iTC - team id - and provide it with team_id: XXXX or the env FASTLANE_TEAM_ID

let me know if this helps you, release on rubygems is pushed.

bildschirmfoto 2016-11-11 um 10 28 07

fiahfy commented 7 years ago

@hjanuschka Thanks for your support! I tried again after updating your plugin, it works fine. ...but I want to run this action with no interaction for automation on the platforms like CircleCI.

hjanuschka commented 7 years ago

@fiahfy good to know 👍

i release 0.1.5 gem - wich supports ENV["FL_PROJECT_SIGNING_FORCE_UPGRADE"]

so run it like this:

 lane :update_codesigning do
    ENV["FL_PROJECT_SIGNING_FORCE_UPGRADE"]=1
    update_project_codesigning(
      path: 'platforms/ios/HelloCordova.xcodeproj',
      use_automatic_signing: false,
      team_id: "XXXX"
    )
  end

it should bypass the confirm and treat it like yes

hjanuschka commented 7 years ago

as there are many diffrent issues inside this on. i ll close it

@fiahfy @eneskaya @realyze if your issues still persist, please create seperate issues - otherwise we are spamming thread members with notifications

fiahfy commented 7 years ago

Great! thank you.