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

Flexible bundle id config #40

Closed
champo opened this issue Feb 12, 2015 · 14 comments
Closed

Flexible bundle id config #40

champo opened this issue Feb 12, 2015 · 14 comments

Comments

@champo
Copy link
Contributor

champo commented Feb 12, 2015

I need to be able to switch bundle id (depends on whether I'm doing an internal testing build or a client distribution build, ie.: our developer account vs theirs). Right now the bundle id can only be set through the Appfile. I would have to modify the file before using fastlane, losing the "one command to deploy".

@KrauseFx
Copy link
Member

Right now, the only solution is to remove the app_identifier information from your Appfile and launch the tool by passing your app identifier using the environment or flag.

There a lot of room for improvement, thanks for letting me know 👍

@champo
Copy link
Contributor Author

champo commented Feb 12, 2015

Thing is, the sigh action uses the AppfileConfig.try_fetch_value directly (see here). Just verified what happens and I'm gettting a nice RuntimeError:

FATAL [2015-02-12 16:08:22.76]: No app_identifier definied in `./fastlane/Appfile`
FATAL [2015-02-12 16:08:22.76]: fastlane finished with errors
/Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/actions/sigh.rb:19:in `run': No app_identifier definied in `./fastlane/Appfile` (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/fast_file.rb:81:in `block (2 levels) in method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/actions/actions_helper.rb:29:in `execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/fast_file.rb:80:in `block in method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/fast_file.rb:79:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/fast_file.rb:79:in `method_missing'
    from (eval):8:in `block (2 levels) in parse'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/runner.rb:18:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/runner.rb:18:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/runner.rb:12:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/runner.rb:12:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/lane_manager.rb:15:in `block in cruise_lanes'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/lane_manager.rb:14:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/lib/fastlane/lane_manager.rb:14:in `cruise_lanes'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/bin/fastlane:31:in `block (2 levels) in run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/bin/fastlane:59:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-0.1.7/bin/fastlane:63:in `<top (required)>'
    from /usr/bin/fastlane:23:in `load'
    from /usr/bin/fastlane:23:in `<main>'

@KrauseFx
Copy link
Member

Easy solution for now: Change your Appfile to

app_identifier ENV["APP_IDENTIFIER"]

and set the correct app identifier in each lane:

ENV["APP_IDENTIFIER"] = "com.krausefx.beta"

@champo
Copy link
Contributor Author

champo commented Feb 12, 2015

Awesome! That's the most ruby thing I've seen.

@gabu
Copy link
Contributor

gabu commented Mar 1, 2015

👍

@joshdholtz
Copy link
Member

@champo Did that solution work for you? Just curious cause doing some issues cleaning 😁

@KrauseFx KrauseFx closed this as completed Mar 4, 2015
@KrauseFx
Copy link
Member

KrauseFx commented Mar 4, 2015

Yes, this worked, let's leave it like this for now 👍

@gwennguihal
Copy link

I'm used the version 1.0.0 and I can't switch the bundle ID and the team using for_lane in the AppFile.
In the generated ipa, in the info.plist, the bundle id is still that of the beta lane.

for_lane "ios beta" do
    app_identifier "com.beta.FastLanePOC"
    apple_id "gwenn@mail.com"
    team_id "1TEAM1"
end

for_lane "ios deploy" do
    app_identifier "com.deploy.FastLanePOC"
    apple_id "gwenn@mail.com"
    team_id "2TEAM2"
end

@KrauseFx
Copy link
Member

KrauseFx commented May 6, 2015

@myrddinus sorry that was my mistake. Depending on your Fastfile, you'll probably have to use for_lane "beta" with the ios. If that doesn't work, please share your Fastfile

@gwennguihal
Copy link

@KrauseFx My Fastfile below :

# Customise this file, documentation can be found here:
# https://github.com/KrauseFx/fastlane/tree/master/docs

# If you want to automatically update fastlane if a new version is available:
update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.0.0"

default_platform :ios

platform :ios do

  before_all do
    ENV["DELIVER_USER"] = "gwenn@mail.com"
    ENV["DELIVER_PASSWORD"] = "MyPassword"

    cocoapods

  xctool :test, [
      "--workspace", "'FastLanePOC.xcworkspace'",
      "--scheme", "'FastLanePOC'",
      "--configuration", "Debug",
      "--sdk", "iphonesimulator",
      "--arch", "i386"
    ].join(" ")

    increment_build_number
  end

  desc "Runs all the tests"
  lane :test do
    # snapshot
  end

  desc "Submit a new Beta Build to Apple TestFlight"
  desc "This will also make sure the profile is up to date"
  lane :beta do
    sigh(
      output_path: "build",
      filename: "inhouse.mobileprovision"
      )
    ipa(
      workspace: "FastLanePOC.xcworkspace",
      configuration: "Release",
      scheme: "FastLanePOC",
      embed: "inhouse.mobileprovision", 
      clean: true, 
      destination: "build",
      ipa: "my-app.ipa",
      xcargs: "DEBUG=0",
      archive: nil
    )
  end

  desc "Deploy a new version to the App Store"
  desc "** Full Markdown** Support: `code`"
  lane :deploy do
    # Helper.log.info "Bundle id '#{app_identifier}'".blue
    sigh(
      output_path: "build",
      filename: "distrib.mobileprovision"
      )
    ipa(
      workspace: "FastLanePOC.xcworkspace",
      configuration: "Release",
      scheme: "FastLanePOC",
      embed: "distrib.mobileprovision", 
      clean: true, 
      destination: "build",
      ipa: "my-app-distrib.ipa",
      xcargs: "DEBUG=0",
      archive: true
    )
  end

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    # slack({
    #   message: "Successfully deployed new App Update."
    # })
  end


  error do |lane, exception|
    # slack({
    #   message: exception.message,
    #   success: false
    # })
  end

end


# More information about multiple platforms in fastlane: 
# https://github.com/KrauseFx/fastlane/blob/master/docs/Platforms.md

@KrauseFx
Copy link
Member

KrauseFx commented May 6, 2015

@myrddinus I'm not sure, but I think you misunderstood what the app_identifier option in the Appfile is about (I think I could improve documentation on that). The app_identifier doesn't change your app's app identifier, but is used for deliver, snapshot and so on.

@gwennguihal
Copy link

@KrauseFx Thanks for your response.
I can only do this by resigning the app if I understand.
I believed I could switch the bundle id before launch an ipa action. Resigning may cause some problem with the apple watch.

@gwennguihal
Copy link

Using custom xcconfig, I can change the bundle ID, the signing identity and the provisioning profile according to the configuration (debug, release, ...).
Then ipa action is working.

KrauseFx pushed a commit that referenced this issue Mar 7, 2016
Remove HTML descriptor from open summary option
@marcomorain
Copy link
Contributor

👍

@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

6 participants