Monday, 28 May 2018

Post install hook for .podspec file

Hi I have private pod framework, I'm using, and till now it wasn't a problem because in pod file I can edit SWIFT_OPTIMIZATION_LEVEL like:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if (target.name == "MyLib")
                config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
            end
        end
    end
end

but now I want to use this pod as dependency in my other pod so in .podspec file I Have

s.dependency 'MyLib', '~> 1.0'

So I can't do it in post_install Podfile because it doesn't exist. I tried to do this like

prepare = <<-PREPARECOMMAND
ruby SWIFT_OPTIMALIZATION.rb
PREPARECOMMAND
s.prepare_command = prepare

But it run to early and at the end it's not changed. I also tried to run this in

s.script_phase

It works but only after first failure, in first build it changes the optimisation and cancel, on second time it build. Is there any way to add post install hook to podspec?



from Post install hook for .podspec file

No comments:

Post a Comment