Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference XCode variable in actions #27

Closed
sarunw opened this issue Feb 2, 2015 · 8 comments
Closed

Reference XCode variable in actions #27

sarunw opened this issue Feb 2, 2015 · 8 comments

Comments

@sarunw
Copy link

sarunw commented Feb 2, 2015

I used to have run script created in build phase which reference XCode variable like $INFOPLIST_FILE. If I want to move this code to custom action, can I still reference these variable?

@KrauseFx
Copy link
Member

KrauseFx commented Feb 2, 2015

Sorry, I don't quite understand this. You want to create your own action? Or you want to run your existing shell script?

@sarunw
Copy link
Author

sarunw commented Feb 2, 2015

I want to move my existing script to actions, but in my script contains XCode variable can ruby code in actions access them?

@KrauseFx
Copy link
Member

KrauseFx commented Feb 3, 2015

Are you talking about an xcodebuild command? Can you share your existing script?

@kdawgwilk
Copy link

I am trying to do the same thing

I try running:
sh "./ipa.sh"
which contains:

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"

in my fastlane actions for my lane.
I tried including the above script directly into a fastlane sh action but it complains about the ${
I couldn't get it to work so I tried to move it to an external script but it fails with permission denied

[SHELL COMMAND]: ./ipa.sh
INFO [2015-02-06 11:43:31.74]: Variable Dump:
INFO [2015-02-06 11:43:31.74]: {:LANE_NAME=>:beta, :START_TIME=>2015-02-06 11:42:01 -0700, :BUILD_NUMBER=>0, :SIGH_PROFILE_PATH=>"/path/to/app.mobileprovision"}
FATAL [2015-02-06 11:43:31.74]: Permission denied - fork failed
FATAL [2015-02-06 11:43:31.75]: fastlane finished with errors

is there a way to embed those variables into a fastlane sh action?

@kdawgwilk
Copy link

Heres the trace where the error occurred

/Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/actions/actions_helper.rb:60:in `spawn': Permission denied - fork failed (Errno::EACCES)
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/actions/actions_helper.rb:60:in `sh_no_action'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/fast_file.rb:60:in `block in sh'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/actions/actions_helper.rb:29:in `execute_action'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/fast_file.rb:59:in `sh'
    from (eval):24:in `block (2 levels) in parse'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/runner.rb:13:in `call'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/runner.rb:13:in `block in execute'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/runner.rb:12:in `chdir'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/runner.rb:12:in `execute'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/lane_manager.rb:15:in `block in cruise_lanes'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/lane_manager.rb:14:in `each'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/lib/fastlane/lane_manager.rb:14:in `cruise_lanes'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/bin/fastlane:31:in `block (2 levels) in run'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/bin/fastlane:59:in `run'
    from /Users/user/.rvm/gems/ruby-2.2.0@global/gems/fastlane-0.1.7/bin/fastlane:63:in `<top (required)>'
    from /Users/user/.rvm/rubies/ruby-2.2.0/bin/fastlane:23:in `load'
    from /Users/user/.rvm/rubies/ruby-2.2.0/bin/fastlane:23:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/user/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'

@KrauseFx
Copy link
Member

KrauseFx commented Feb 8, 2015

Mh, not sure why it complains about the $. Maybe you can just run puts system("your command") instead of the sh?

@almassapargali
Copy link

Ok, there is a way of getting those variables from command like using following command:

xcodebuild -workspace Appease.xcworkspace -scheme Previews -showBuildSettings

and you'll get this:
screen shot 2015-03-07 at 12 12 59 am

Though, I'm not convinced that fastlane should handle this. If all you need is $INFOPLIST_FILE, I'd suggest declare it inside that script (yep it's hardcode, but do we move infoplist around often?).

Hey, @kdawgwilk, maybe use fastlane actions to get an ipa?

@KrauseFx
Copy link
Member

KrauseFx commented Mar 9, 2015

What's the current status here? I'll close the issue for now, feel free to re-open if you're still experiencing problems.

@KrauseFx KrauseFx closed this as completed Mar 9, 2015
KrauseFx pushed a commit that referenced this issue Mar 7, 2016
Change KrauseFx references to fastlane
KrauseFx pushed a commit that referenced this issue Mar 7, 2016
Better handling of unauthorized devices
@fastlane fastlane locked and limited conversation to collaborators Sep 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants