vtourraine / VTAcknowledgementsViewController

Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automating Pods-Acknowledgements.plist copy

billyto opened this issue · comments

If you want to automatically copy Pods-Acknowledgements, there are two options:

Add a hook to the Podfile:

post_install do | installer |
    require 'fileutils'
    FileUtils.cp_r('Pods/Pods-Acknowledgements.plist', 'Pods-Acknowledgements.plist', :remove_destination => true)
end

or

Add a new run script build phase at the end of your target build phases with the following line:

cp ${SRCROOT}/Pods/Pods-acknowledgements.plist ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Pods-acknowledgements.plist

Really nice :)

Thanks a lot for these instructions, they’re definitely useful. I’ve added a mention to this “issue” in the project readme, so I’ll close it.

Ideally, these instructions should be located inside the podspec file itself, and I’m still looking for a way to achieve this. AFAIK, that’s not possible with the current CocoaPods, but it is on the roadmap. I guess I’ll give this pod a “1.0” version tag as soon as it gets implemented.

Any way to put the target name in the filename automagically so it picks up plists with 'fancy' names?

@stevemoser Hum, I guess we could parse the content of the app bundle, and look for files with names ending with “-acknowledgements.plist”. I’ll put that in the next version, if that sounds good.

That's really cool!

With CocoaPods version 0.34, the path to the Pods-Acknowledgements.plist file changed. It is now Pods/Target Support Files/Pods/Pods-acknowledgements.plist

Thanks @lukaskollmer for the info!

In run script phase, don't forget the quotation marks! In case of CocoaPods ver. 0.34 it should be like:

cp "${SRCROOT}/Pods/Target Support Files/Pods/Pods-acknowledgements.plist" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Pods-acknowledgements.plist"

Adding a hook to the Podfile changed, and it should be:

post_install do | installer |
    require 'fileutils'
    FileUtils.cp_r('Pods/Target Support Files/Pods/Pods-Acknowledgements.plist', 'Pods-Acknowledgements.plist', :remove_destination => true)
end

I think it's worth not only mentioning this issue, but also inserting these instructions in the Read Me. @vtourraine if you agree, I can do a PR.

Guys, these don't work anymore since cocoapods v1.0.0, because of the "abstract_target" definition.

anybody, how does it help to copy acknowledgements to project directory? Which of scripts in build target would put this file in archive/app on archive/build action?

Answer: your hands :/

BTW

def after_install_section(target_name)
    # pod acknowledgements section
    require 'fileutils'
    file = %Q'Pods-#{target_name}-acknowledgements.plist'
    from = %Q'Pods/Target Support Files/Pods-#{target_name}/'
    to = %Q'Custom/Resources/Pods/'
    FileUtils.cp_r(from + file, to + file, :remove_destination => true)
end