Commit a7bbbb93 authored by Eloy Durán's avatar Eloy Durán Committed by Marius Rackwitz

[Frameworks] Add project/dylib/compatibility versions.

parent 8b7690f7
...@@ -36,6 +36,24 @@ module Pod ...@@ -36,6 +36,24 @@ module Pod
private private
# Adds the project/library and compatibility versions, which are only
# applicable to dynamic libraries.
#
# @return [Hash{String => String}]
#
def custom_build_settings
settings = super
if target.requires_frameworks?
version = target.root_spec.version
compatibility_version = version.segments.first
compatibility_version = version.version if compatibility_version < 1
settings['CURRENT_PROJECT_VERSION'] = version.version
settings['DYLIB_COMPATIBILITY_VERSION'] = compatibility_version.to_s
settings['DYLIB_CURRENT_VERSION'] = '$(CURRENT_PROJECT_VERSION)'
end
settings
end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
SOURCE_FILE_EXTENSIONS = Sandbox::FileAccessor::SOURCE_FILE_EXTENSIONS SOURCE_FILE_EXTENSIONS = Sandbox::FileAccessor::SOURCE_FILE_EXTENSIONS
......
...@@ -219,6 +219,7 @@ module Pod ...@@ -219,6 +219,7 @@ module Pod
end end
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
describe 'concerning compiler flags' do describe 'concerning compiler flags' do
before do before do
@spec = Pod::Spec.new @spec = Pod::Spec.new
...@@ -296,6 +297,33 @@ module Pod ...@@ -296,6 +297,33 @@ module Pod
end end
end end
end end
#--------------------------------------------------------------------------------#
describe 'concerning framework versions' do
before do
@pod_target.stubs(:requires_frameworks? => true)
@spec.stubs(:version => Version.new('1.2.3'))
end
it 'sets the project and library version' do
settings = @installer.send(:custom_build_settings)
settings['CURRENT_PROJECT_VERSION'].should == '1.2.3'
settings['DYLIB_CURRENT_VERSION'].should == '$(CURRENT_PROJECT_VERSION)'
end
it 'sets the library compatibility version to the major version' do
settings = @installer.send(:custom_build_settings)
settings['DYLIB_COMPATIBILITY_VERSION'].should == '1'
end
it 'sets the library compatibility version to the exact version when it is less than v1 (because SemVer makes no promises)' do
@spec.stubs(:version => Version.new('0.1.2'))
settings = @installer.send(:custom_build_settings)
settings['DYLIB_COMPATIBILITY_VERSION'].should == '0.1.2'
end
end
end end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment